Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/en/setup/backend/storages/banyandb.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ bydb.version=x.y
# BanyanDB API version is the version number of the BanyanDB query APIs
# OAP server has bundled implementation of BanyanDB Java client.
# Please check BanyanDB documentation for the API version compatibility.
# https://skywalking.apache.org/docs/skywalking-banyandb/next/installation/versions
# Each `bydb.api.version` could have multiple compatible release version(`bydb.version`).
bydb.api.version=x.y
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ bydb.version=0.8
# BanyanDB API version is the version number of the BanyanDB query APIs
# OAP server has bundled implementation of BanyanDB Java client.
# Please check BanyanDB documentation for the API version compatibility.
# https://skywalking.apache.org/docs/skywalking-banyandb/next/installation/versions
# Each `bydb.api.version` could have multiple compatible release version(`bydb.version`).
bydb.api.version=0.8
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
import io.grpc.Status;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.banyandb.common.v1.BanyandbCommon;
import org.apache.skywalking.banyandb.common.v1.BanyandbCommon.Group;
Expand Down Expand Up @@ -75,6 +77,22 @@ public BanyanDBStorageClient(BanyanDBStorageConfig config) {
@Override
public void connect() throws Exception {
this.client.connect();
final Properties properties = new Properties();
try (final InputStream resourceAsStream
= BanyanDBStorageClient.class.getClassLoader()
.getResourceAsStream(
"bydb.dependencies.properties")) {
if (resourceAsStream == null) {
throw new IllegalStateException("bydb.dependencies.properties not found");
}
properties.load(resourceAsStream);
}
final String expectedApiVersion = properties.getProperty("bydb.api.version");
if (!Arrays.stream(COMPATIBLE_SERVER_API_VERSIONS).anyMatch(v -> v.equals(expectedApiVersion))) {
throw new IllegalStateException("Inconsistent versions between bydb.dependencies.properties and codes(" +
String.join(", ", COMPATIBLE_SERVER_API_VERSIONS) + ").");
}

BanyandbCommon.APIVersion apiVersion;
try {
apiVersion = this.client.getAPIVersion();
Expand Down
Loading