From e027afdeeb62db7b872e91cefcb37f71964ede40 Mon Sep 17 00:00:00 2001 From: Anqi Date: Fri, 12 Jan 2024 15:54:07 +0800 Subject: [PATCH] remove version key (#98) --- .../connection/NebulaClientOptions.java | 18 ++----------- .../NebulaGraphConnectionProvider.java | 1 - .../NebulaMetaConnectionProvider.java | 1 - .../NebulaStorageConnectionProvider.java | 1 - .../NebulaGraphConnectionProviderTest.java | 27 ------------------- 5 files changed, 2 insertions(+), 46 deletions(-) diff --git a/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaClientOptions.java b/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaClientOptions.java index 797cd4d..637f75a 100644 --- a/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaClientOptions.java +++ b/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaClientOptions.java @@ -40,14 +40,12 @@ public class NebulaClientOptions implements Serializable { private final SelfSignParams selfSignParams; - private final String handshakeKey; - private NebulaClientOptions(String metaAddress, String graphAddress, String username, String password, int timeout, int connectRetry, boolean enableGraphSSL, boolean enableMetaSSL, boolean enableStorageSSL, SSLSignType sslSignType, CASignParams caSignParams, - SelfSignParams selfSignParams, String handshakeKey) { + SelfSignParams selfSignParams) { this.metaAddress = metaAddress; this.graphAddress = graphAddress; this.username = username; @@ -60,7 +58,6 @@ private NebulaClientOptions(String metaAddress, String graphAddress, String user this.sslSignType = sslSignType; this.caSignParams = caSignParams; this.selfSignParams = selfSignParams; - this.handshakeKey = handshakeKey; } public List getMetaAddress() { @@ -120,10 +117,6 @@ public SelfSignParams getSelfSignParam() { return selfSignParams; } - public String getHandshakeKey() { - return handshakeKey; - } - /** * Builder for {@link NebulaClientOptions} */ @@ -142,7 +135,6 @@ public static class NebulaClientOptionsBuilder { private SSLSignType sslSignType = null; private CASignParams caSignParams = null; private SelfSignParams selfSignParams = null; - private String handshakeKey = null; public NebulaClientOptionsBuilder setMetaAddress(String metaAddress) { this.metaAddress = metaAddress; @@ -207,11 +199,6 @@ public NebulaClientOptionsBuilder setSelfSignParam(String crtFilePath, String ke return this; } - public NebulaClientOptionsBuilder setHandshakeKey(String handshakeKey) { - this.handshakeKey = handshakeKey; - return this; - } - public NebulaClientOptions build() { if (metaAddress == null || metaAddress.trim().isEmpty()) { throw new IllegalArgumentException("meta address can not be empty."); @@ -258,8 +245,7 @@ public NebulaClientOptions build() { enableStorageSSL, sslSignType, caSignParams, - selfSignParams, - handshakeKey); + selfSignParams); } } } diff --git a/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaGraphConnectionProvider.java b/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaGraphConnectionProvider.java index e7f54b4..af1a9d0 100644 --- a/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaGraphConnectionProvider.java +++ b/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaGraphConnectionProvider.java @@ -44,7 +44,6 @@ public NebulaPool getNebulaPool() throws UnknownHostException { Collections.shuffle(addresses); NebulaPoolConfig poolConfig = new NebulaPoolConfig(); poolConfig.setTimeout(nebulaClientOptions.getTimeout()); - poolConfig.setHandshakeKey(nebulaClientOptions.getHandshakeKey()); if (nebulaClientOptions.isEnableGraphSSL()) { poolConfig.setEnableSsl(true); switch (nebulaClientOptions.getSSLSignType()) { diff --git a/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaMetaConnectionProvider.java b/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaMetaConnectionProvider.java index 55921fb..8347e90 100644 --- a/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaMetaConnectionProvider.java +++ b/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaMetaConnectionProvider.java @@ -65,7 +65,6 @@ public MetaClient getMetaClient() throws TException, ClientServerIncompatibleExc metaClient = new MetaClient(addresses, timeout, retry, retry); } - metaClient.setHandshakeKey(nebulaClientOptions.getHandshakeKey()); metaClient.connect(); return metaClient; } diff --git a/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaStorageConnectionProvider.java b/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaStorageConnectionProvider.java index 0337ea8..3273693 100644 --- a/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaStorageConnectionProvider.java +++ b/connector/src/main/java/org.apache.flink/connector/nebula/connection/NebulaStorageConnectionProvider.java @@ -56,7 +56,6 @@ public StorageClient getStorageClient() throws Exception { storageClient = new StorageClient(addresses, timeout); } - storageClient.setHandshakeKey(nebulaClientOptions.getHandshakeKey()); if (!storageClient.connect()) { throw new Exception("failed to connect storaged."); } diff --git a/connector/src/test/java/org/apache/flink/connector/nebula/connection/NebulaGraphConnectionProviderTest.java b/connector/src/test/java/org/apache/flink/connector/nebula/connection/NebulaGraphConnectionProviderTest.java index 481c9e0..c86162d 100644 --- a/connector/src/test/java/org/apache/flink/connector/nebula/connection/NebulaGraphConnectionProviderTest.java +++ b/connector/src/test/java/org/apache/flink/connector/nebula/connection/NebulaGraphConnectionProviderTest.java @@ -40,7 +40,6 @@ public void getNebulaPool() { .setPassword("nebula") .setConnectRetry(1) .setTimeout(1000) - .setHandshakeKey("test") .build(); NebulaGraphConnectionProvider graphConnectionProvider = new NebulaGraphConnectionProvider(nebulaClientOptions); @@ -53,32 +52,6 @@ public void getNebulaPool() { } } - @Test - public void getNebulaPoolWithWrongVersion() { - NebulaClientOptions nebulaClientOptions = - new NebulaClientOptions.NebulaClientOptionsBuilder() - .setGraphAddress("127.0.0.1:9669") - .setMetaAddress("127.0.0.1:9559") - .setUsername("root") - .setPassword("nebula") - .setConnectRetry(1) - .setTimeout(1000) - .setHandshakeKey("INVALID_VERSION") - .build(); - NebulaGraphConnectionProvider graphConnectionProvider = - new NebulaGraphConnectionProvider(nebulaClientOptions); - try { - NebulaPool nebulaPool = graphConnectionProvider.getNebulaPool(); - nebulaPool.getSession("root", "nebula", true); - } catch (Exception e) { - LOG.info("get session failed", e); - if (e.getMessage().contains("NebulaPool init failed.")) { - assert true; - } else { - assert false; - } - } - } /** * nebula server does not enable ssl, the connection cannot be established correctly.