Skip to content

Commit 24c354e

Browse files
authored
Bump up proto for replicas config and TLS option simplification (#90)
1 parent fd696e8 commit 24c354e

File tree

4 files changed

+14
-28
lines changed

4 files changed

+14
-28
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Release Notes.
1010
* Bump up the API to support sharding_key.
1111
* Bump up the API to support version 0.9.
1212
* Support stage query on TopN.
13+
* Add replicas configuration to the API: introduce `replicas` in LifecycleStage and ResourceOpts to support high availability.
14+
* Simplify TLS options: remove unsupported mTLS client certificate settings from Options and DefaultChannelFactory; trust CA is still supported.
1315
* Support auth with username and password.
1416

1517
0.8.0

src/main/java/org/apache/skywalking/banyandb/v1/client/Options.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ public class Options {
5555
* SSL: Trusted CA Path
5656
*/
5757
private String sslTrustCAPath = "";
58-
/**
59-
* SSL: Cert Chain Path, BanyanDB server not support mTLS yet
60-
*/
61-
private String sslCertChainPath = "";
62-
/**
63-
* SSL: Cert Key Path, BanyanDB server not support mTLS yet
64-
*/
65-
private String sslKeyPath = "";
6658
/**
6759
* Basic Auth: username of BanyanDB server
6860
*/

src/main/java/org/apache/skywalking/banyandb/v1/client/grpc/channel/DefaultChannelFactory.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
package org.apache.skywalking.banyandb.v1.client.grpc.channel;
2020

21-
import com.google.common.base.Strings;
2221
import io.grpc.ManagedChannel;
2322
import io.grpc.netty.GrpcSslContexts;
2423
import io.grpc.netty.NegotiationType;
@@ -28,11 +27,9 @@
2827
import lombok.RequiredArgsConstructor;
2928
import lombok.extern.slf4j.Slf4j;
3029
import org.apache.skywalking.banyandb.v1.client.Options;
31-
import org.apache.skywalking.banyandb.v1.client.util.PrivateKeyUtil;
30+
3231
import java.io.File;
33-
import java.io.FileInputStream;
3432
import java.io.IOException;
35-
import java.io.InputStream;
3633
import java.net.InetSocketAddress;
3734
import java.net.SocketAddress;
3835
import java.net.URI;
@@ -56,22 +53,6 @@ public ManagedChannel create() throws IOException {
5653
SslContextBuilder builder = GrpcSslContexts.forClient();
5754

5855
if (isCAFileExist) {
59-
String certPath = options.getSslCertChainPath();
60-
String keyPath = options.getSslKeyPath();
61-
if (!Strings.isNullOrEmpty(certPath) && Strings.isNullOrEmpty(keyPath)) {
62-
File keyFile = new File(keyPath);
63-
File certFile = new File(certPath);
64-
65-
if (certFile.isFile() && keyFile.isFile()) {
66-
try (InputStream cert = new FileInputStream(certFile);
67-
InputStream key = PrivateKeyUtil.loadDecryptionKey(keyFile.getAbsolutePath())) {
68-
builder.keyManager(cert, key);
69-
}
70-
} else if (!certFile.isFile() || !keyFile.isFile()) {
71-
log.warn("Failed to enable mTLS caused by cert or key cannot be found.");
72-
}
73-
}
74-
7556
builder.trustManager(caFile);
7657
}
7758
managedChannelBuilder.negotiationType(NegotiationType.TLS).sslContext(builder.build());

src/main/proto/banyandb/v1/banyandb-common.proto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ message LifecycleStage {
8181

8282
// Indicates whether segments that are no longer live should be closed.
8383
bool close = 6;
84+
85+
// replicas is the number of replicas for this stage.
86+
// This is an optional field and defaults to 0.
87+
// A value of 0 means no replicas, while a value of 1 means one primary shard and one replica.
88+
// Higher values indicate more replicas.
89+
uint32 replicas = 7;
8490
}
8591

8692
message ResourceOpts {
@@ -94,6 +100,11 @@ message ResourceOpts {
94100
repeated LifecycleStage stages = 4;
95101
// default_stages is the name of the default stage
96102
repeated string default_stages = 5;
103+
// replicas is the number of replicas. This is used to ensure high availability and fault tolerance.
104+
// This is an optional field and defaults to 0.
105+
// A value of 0 means no replicas, while a value of 1 means one primary shard and one replica.
106+
// Higher values indicate more replicas.
107+
uint32 replicas = 6;
97108
}
98109

99110
// Group is an internal object for Group management

0 commit comments

Comments
 (0)