You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2025/08/13 02:01:45 UTC

(skywalking-banyandb-java-client) branch main updated: Bump up proto for replicas config and TLS option simplification (#90)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb-java-client.git


The following commit(s) were added to refs/heads/main by this push:
     new 24c354e  Bump up proto for replicas config and TLS option simplification (#90)
24c354e is described below

commit 24c354edc24ea55b2f85fb1c98c064f935b27f2a
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Wed Aug 13 10:01:40 2025 +0800

    Bump up proto for replicas config and TLS option simplification (#90)
---
 CHANGES.md                                          |  2 ++
 .../skywalking/banyandb/v1/client/Options.java      |  8 --------
 .../client/grpc/channel/DefaultChannelFactory.java  | 21 +--------------------
 src/main/proto/banyandb/v1/banyandb-common.proto    | 11 +++++++++++
 4 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index c5cb6fe..e368bba 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -10,6 +10,8 @@ Release Notes.
 * Bump up the API to support sharding_key.
 * Bump up the API to support version 0.9.
 * Support stage query on TopN.
+* Add replicas configuration to the API: introduce `replicas` in LifecycleStage and ResourceOpts to support high availability.
+* Simplify TLS options: remove unsupported mTLS client certificate settings from Options and DefaultChannelFactory; trust CA is still supported.
 * Support auth with username and password.
 
 0.8.0
diff --git a/src/main/java/org/apache/skywalking/banyandb/v1/client/Options.java b/src/main/java/org/apache/skywalking/banyandb/v1/client/Options.java
index 9be150a..5355168 100644
--- a/src/main/java/org/apache/skywalking/banyandb/v1/client/Options.java
+++ b/src/main/java/org/apache/skywalking/banyandb/v1/client/Options.java
@@ -55,14 +55,6 @@ public class Options {
      * SSL: Trusted CA Path
      */
     private String sslTrustCAPath = "";
-    /**
-     * SSL: Cert Chain Path, BanyanDB server not support mTLS yet
-     */
-    private String sslCertChainPath = "";
-    /**
-     * SSL: Cert Key Path, BanyanDB server not support mTLS yet
-     */
-    private String sslKeyPath = "";
     /**
      * Basic Auth: username of BanyanDB server
      */
diff --git a/src/main/java/org/apache/skywalking/banyandb/v1/client/grpc/channel/DefaultChannelFactory.java b/src/main/java/org/apache/skywalking/banyandb/v1/client/grpc/channel/DefaultChannelFactory.java
index 6a38fb0..7102126 100644
--- a/src/main/java/org/apache/skywalking/banyandb/v1/client/grpc/channel/DefaultChannelFactory.java
+++ b/src/main/java/org/apache/skywalking/banyandb/v1/client/grpc/channel/DefaultChannelFactory.java
@@ -18,7 +18,6 @@
 
 package org.apache.skywalking.banyandb.v1.client.grpc.channel;
 
-import com.google.common.base.Strings;
 import io.grpc.ManagedChannel;
 import io.grpc.netty.GrpcSslContexts;
 import io.grpc.netty.NegotiationType;
@@ -28,11 +27,9 @@ import io.netty.util.internal.PlatformDependent;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.skywalking.banyandb.v1.client.Options;
-import org.apache.skywalking.banyandb.v1.client.util.PrivateKeyUtil;
+
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.net.URI;
@@ -56,22 +53,6 @@ public class DefaultChannelFactory implements ChannelFactory {
             SslContextBuilder builder = GrpcSslContexts.forClient();
 
             if (isCAFileExist) {
-                String certPath = options.getSslCertChainPath();
-                String keyPath = options.getSslKeyPath();
-                if (!Strings.isNullOrEmpty(certPath) && Strings.isNullOrEmpty(keyPath)) {
-                    File keyFile = new File(keyPath);
-                    File certFile = new File(certPath);
-
-                    if (certFile.isFile() && keyFile.isFile()) {
-                        try (InputStream cert = new FileInputStream(certFile);
-                             InputStream key = PrivateKeyUtil.loadDecryptionKey(keyFile.getAbsolutePath())) {
-                            builder.keyManager(cert, key);
-                        }
-                    } else if (!certFile.isFile() || !keyFile.isFile()) {
-                        log.warn("Failed to enable mTLS caused by cert or key cannot be found.");
-                    }
-                }
-
                 builder.trustManager(caFile);
             }
             managedChannelBuilder.negotiationType(NegotiationType.TLS).sslContext(builder.build());
diff --git a/src/main/proto/banyandb/v1/banyandb-common.proto b/src/main/proto/banyandb/v1/banyandb-common.proto
index fbe412a..c667176 100644
--- a/src/main/proto/banyandb/v1/banyandb-common.proto
+++ b/src/main/proto/banyandb/v1/banyandb-common.proto
@@ -81,6 +81,12 @@ message LifecycleStage {
 
   // Indicates whether segments that are no longer live should be closed.
   bool close = 6;
+
+  // replicas is the number of replicas for this stage.
+  // This is an optional field and defaults to 0.
+  // A value of 0 means no replicas, while a value of 1 means one primary shard and one replica.
+  // Higher values indicate more replicas.
+  uint32 replicas = 7;
 }
 
 message ResourceOpts {
@@ -94,6 +100,11 @@ message ResourceOpts {
   repeated LifecycleStage stages = 4;
   // default_stages is the name of the default stage
   repeated string default_stages = 5;
+  // replicas is the number of replicas. This is used to ensure high availability and fault tolerance.
+  // This is an optional field and defaults to 0.
+  // A value of 0 means no replicas, while a value of 1 means one primary shard and one replica.
+  // Higher values indicate more replicas.
+  uint32 replicas = 6;
 }
 
 // Group is an internal object for Group management