Skip to content

Commit

Permalink
revert version verify
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole00 committed Jan 12, 2024
1 parent 8226adf commit 4672a21
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class NebulaConnectionConfig(metaAddress: String,
enableStorageSSL: Boolean,
signType: SSLSignType.Value,
caSignParam: CASSLSignParams,
selfSignParam: SelfSSLSignParams,
handshakeKey: String)
selfSignParam: SelfSSLSignParams)
extends Serializable {
def getMetaAddress = metaAddress
def getGraphAddress = graphAddress
Expand All @@ -39,7 +38,6 @@ class NebulaConnectionConfig(metaAddress: String,
selfSignParam.crtFilePath + "," + selfSignParam.keyFilePath + "," + selfSignParam.password
}

def getHandshakeKey: String = handshakeKey
}

object NebulaConnectionConfig {
Expand All @@ -58,7 +56,6 @@ object NebulaConnectionConfig {
protected var sslSignType: SSLSignType.Value = _
protected var caSignParam: CASSLSignParams = null
protected var selfSignParam: SelfSSLSignParams = null
protected var handshakeKey: String = null

/**
* set nebula meta server address, multi addresses is split by English comma
Expand Down Expand Up @@ -158,14 +155,6 @@ object NebulaConnectionConfig {
this
}

/**
* set client handshakeKey
*/
def withHandshakeKey(handshakeKey: String): ConfigBuilder = {
this.handshakeKey = handshakeKey
this
}

/**
* check if the connection config is valid
*/
Expand Down Expand Up @@ -217,8 +206,7 @@ object NebulaConnectionConfig {
enableStorageSSL,
sslSignType,
caSignParam,
selfSignParam,
handshakeKey
selfSignParam
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ class NebulaOptions(@transient val parameters: CaseInsensitiveMap[String]) exten
}
}

val handshakeKey: String = parameters.getOrElse(HANDSHAKE_KEY, null)

require(parameters.isDefinedAt(TYPE), s"Option '$TYPE' is required")
val dataType: String = parameters(TYPE)
require(
Expand Down Expand Up @@ -234,8 +232,6 @@ object NebulaOptions {
val CA_SIGN_PARAM: String = "caSignParam"
val SELF_SIGN_PARAM: String = "selfSignParam"

val HANDSHAKE_KEY: String = "handshakeKey"

val OPERATE_TYPE: String = "operateType"

/** read config */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ object NebulaUtils {
nebulaOptions.enableMetaSSL,
nebulaOptions.sslSignType,
nebulaOptions.caSignParam,
nebulaOptions.selfSignParam,
nebulaOptions.handshakeKey
nebulaOptions.selfSignParam
)

import scala.collection.JavaConverters._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class GraphProvider(addresses: List[Address],
enableSSL: Boolean = false,
sslSignType: String = null,
caSignParam: CASSLSignParams = null,
selfSignParam: SelfSSLSignParams = null,
handshakeKey:String = null)
selfSignParam: SelfSSLSignParams = null)
extends AutoCloseable
with Serializable {
@transient private[this] lazy val LOG = Logger.getLogger(this.getClass)
Expand All @@ -42,7 +41,6 @@ class GraphProvider(addresses: List[Address],
val address = addresses.map { case (host, port) => new HostAddress(host, port) }
nebulaPoolConfig.setMaxConnSize(1)
nebulaPoolConfig.setTimeout(timeout)
nebulaPoolConfig.setHandshakeKey(handshakeKey)

if (enableSSL) {
nebulaPoolConfig.setEnableSsl(enableSSL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class MetaProvider(addresses: List[Address],
enableSSL: Boolean,
sslSignType: String = null,
caSignParam: CASSLSignParams,
selfSignParam: SelfSSLSignParams,
handshakeKey:String)
selfSignParam: SelfSSLSignParams)
extends AutoCloseable
with Serializable {

Expand All @@ -51,7 +50,6 @@ class MetaProvider(addresses: List[Address],
} else {
client = new MetaClient(metaAddress, timeout, connectionRetry, executionRetry)
}
client.setHandshakeKey(handshakeKey)
client.connect()

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ trait NebulaReader {
nebulaOptions.enableMetaSSL,
nebulaOptions.sslSignType,
nebulaOptions.caSignParam,
nebulaOptions.selfSignParam,
nebulaOptions.handshakeKey
nebulaOptions.selfSignParam
)
val address: ListBuffer[HostAddress] = new ListBuffer[HostAddress]

Expand Down Expand Up @@ -100,7 +99,6 @@ trait NebulaReader {
this.storageClient = new StorageClient(address.asJava, nebulaOptions.timeout)
}

this.storageClient.setHandshakeKey(nebulaOptions.handshakeKey)
if (!storageClient.connect()) {
throw new GraphConnectException("storage connect failed.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ class GraphProviderTest extends AnyFunSuite with BeforeAndAfterAll {
graphProvider.close()
}

test("setHandshakeKey") {
val addresses: List[Address] = List(new Address("127.0.0.1", 9669))
graphProvider =
new GraphProvider(addresses, "root", "nebula", 3000, false, null, null, null, "test")

assert(graphProvider.switchSpace("test_int"))
}

test("switchSpace") {
assertThrows[RuntimeException](graphProvider.switchSpace("space_not_exist"))
assert(graphProvider.switchSpace("test_int"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ package object connector {
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)
.option(NebulaOptions.ENABLE_STORAGE_SSL, connectionConfig.getEnableStorageSSL)

if (connectionConfig.getHandshakeKey != null) {
dfReader.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableStorageSSL || connectionConfig.getEnableMetaSSL) {
dfReader.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -103,10 +99,6 @@ package object connector {
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)
.option(NebulaOptions.ENABLE_STORAGE_SSL, connectionConfig.getEnableStorageSSL)

if (connectionConfig.getHandshakeKey != null) {
dfReader.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableStorageSSL || connectionConfig.getEnableMetaSSL) {
dfReader.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -147,10 +139,6 @@ package object connector {
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)
.option(NebulaOptions.ENABLE_STORAGE_SSL, connectionConfig.getEnableStorageSSL)

if (connectionConfig.getHandshakeKey != null) {
dfReader.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableStorageSSL || connectionConfig.getEnableMetaSSL) {
dfReader.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -270,10 +258,6 @@ package object connector {
.option(NebulaOptions.ENABLE_GRAPH_SSL, connectionConfig.getEnableGraphSSL)
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)

if (connectionConfig.getHandshakeKey != null) {
dfWriter.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableGraphSSL || connectionConfig.getEnableMetaSSL) {
dfWriter.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -323,10 +307,6 @@ package object connector {
.option(NebulaOptions.ENABLE_GRAPH_SSL, connectionConfig.getEnableGraphSSL)
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)

if (connectionConfig.getHandshakeKey != null) {
dfWriter.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableGraphSSL || connectionConfig.getEnableMetaSSL) {
dfWriter.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class NebulaNgqlEdgePartitionReader extends InputPartitionReader[InternalRow] {
nebulaOptions.enableGraphSSL,
nebulaOptions.sslSignType,
nebulaOptions.caSignParam,
nebulaOptions.selfSignParam,
nebulaOptions.handshakeKey
nebulaOptions.selfSignParam
)
// add exception when session build failed
graphProvider.switchSpace(nebulaOptions.spaceName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class NebulaWriter(nebulaOptions: NebulaOptions) extends Serializable {
nebulaOptions.enableMetaSSL,
nebulaOptions.sslSignType,
nebulaOptions.caSignParam,
nebulaOptions.selfSignParam,
nebulaOptions.handshakeKey
nebulaOptions.selfSignParam
)
val graphProvider = new GraphProvider(
nebulaOptions.getGraphAddress,
Expand All @@ -38,8 +37,7 @@ class NebulaWriter(nebulaOptions: NebulaOptions) extends Serializable {
nebulaOptions.enableGraphSSL,
nebulaOptions.sslSignType,
nebulaOptions.caSignParam,
nebulaOptions.selfSignParam,
nebulaOptions.handshakeKey
nebulaOptions.selfSignParam
)
val isVidStringType = metaProvider.getVidType(nebulaOptions.spaceName) == VidType.STRING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ package object connector {
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)
.option(NebulaOptions.ENABLE_STORAGE_SSL, connectionConfig.getEnableStorageSSL)

if (connectionConfig.getHandshakeKey != null) {
dfReader.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableStorageSSL || connectionConfig.getEnableMetaSSL) {
dfReader.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -166,10 +162,6 @@ package object connector {
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)
.option(NebulaOptions.ENABLE_STORAGE_SSL, connectionConfig.getEnableStorageSSL)

if (connectionConfig.getHandshakeKey != null) {
dfReader.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableStorageSSL || connectionConfig.getEnableMetaSSL) {
dfReader.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -209,10 +201,6 @@ package object connector {
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)
.option(NebulaOptions.ENABLE_STORAGE_SSL, connectionConfig.getEnableStorageSSL)

if (connectionConfig.getHandshakeKey != null) {
dfReader.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableStorageSSL || connectionConfig.getEnableMetaSSL) {
dfReader.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -331,10 +319,6 @@ package object connector {
.option(NebulaOptions.ENABLE_GRAPH_SSL, connectionConfig.getEnableGraphSSL)
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)

if (connectionConfig.getHandshakeKey != null) {
dfWriter.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableGraphSSL || connectionConfig.getEnableMetaSSL) {
dfWriter.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -384,10 +368,6 @@ package object connector {
.option(NebulaOptions.ENABLE_GRAPH_SSL, connectionConfig.getEnableGraphSSL)
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)

if (connectionConfig.getHandshakeKey != null) {
dfWriter.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableGraphSSL || connectionConfig.getEnableMetaSSL) {
dfWriter.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ abstract class NebulaWriter(nebulaOptions: NebulaOptions, schema: StructType) ex
nebulaOptions.enableMetaSSL,
nebulaOptions.sslSignType,
nebulaOptions.caSignParam,
nebulaOptions.selfSignParam,
nebulaOptions.handshakeKey
nebulaOptions.selfSignParam
)
val graphProvider = new GraphProvider(
nebulaOptions.getGraphAddress,
Expand All @@ -44,8 +43,7 @@ abstract class NebulaWriter(nebulaOptions: NebulaOptions, schema: StructType) ex
nebulaOptions.enableGraphSSL,
nebulaOptions.sslSignType,
nebulaOptions.caSignParam,
nebulaOptions.selfSignParam,
nebulaOptions.handshakeKey
nebulaOptions.selfSignParam
)
val isVidStringType = metaProvider.getVidType(nebulaOptions.spaceName) == VidType.STRING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ package object connector {
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)
.option(NebulaOptions.ENABLE_STORAGE_SSL, connectionConfig.getEnableStorageSSL)

if (connectionConfig.getHandshakeKey != null) {
dfReader.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableStorageSSL || connectionConfig.getEnableMetaSSL) {
dfReader.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -103,10 +99,6 @@ package object connector {
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)
.option(NebulaOptions.ENABLE_STORAGE_SSL, connectionConfig.getEnableStorageSSL)

if (connectionConfig.getHandshakeKey != null) {
dfReader.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableStorageSSL || connectionConfig.getEnableMetaSSL) {
dfReader.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -226,10 +218,6 @@ package object connector {
.option(NebulaOptions.ENABLE_GRAPH_SSL, connectionConfig.getEnableGraphSSL)
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)

if (connectionConfig.getHandshakeKey != null) {
dfWriter.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableGraphSSL || connectionConfig.getEnableMetaSSL) {
dfWriter.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down Expand Up @@ -279,10 +267,6 @@ package object connector {
.option(NebulaOptions.ENABLE_GRAPH_SSL, connectionConfig.getEnableGraphSSL)
.option(NebulaOptions.ENABLE_META_SSL, connectionConfig.getEnableMetaSSL)

if (connectionConfig.getHandshakeKey != null) {
dfWriter.option(NebulaOptions.HANDSHAKE_KEY, connectionConfig.getHandshakeKey)
}

if (connectionConfig.getEnableGraphSSL || connectionConfig.getEnableMetaSSL) {
dfWriter.option(NebulaOptions.SSL_SIGN_TYPE, connectionConfig.getSignType)
SSLSignType.withName(connectionConfig.getSignType) match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class NebulaWriter(nebulaOptions: NebulaOptions) extends Serializable {
nebulaOptions.enableMetaSSL,
nebulaOptions.sslSignType,
nebulaOptions.caSignParam,
nebulaOptions.selfSignParam,
nebulaOptions.handshakeKey
nebulaOptions.selfSignParam
)
val graphProvider = new GraphProvider(
nebulaOptions.getGraphAddress,
Expand All @@ -38,8 +37,7 @@ class NebulaWriter(nebulaOptions: NebulaOptions) extends Serializable {
nebulaOptions.enableGraphSSL,
nebulaOptions.sslSignType,
nebulaOptions.caSignParam,
nebulaOptions.selfSignParam,
nebulaOptions.handshakeKey
nebulaOptions.selfSignParam
)
val isVidStringType = metaProvider.getVidType(nebulaOptions.spaceName) == VidType.STRING

Expand Down

0 comments on commit 4672a21

Please sign in to comment.