From 4c7dbbc57df5a93211fd7ca5047ef780ced557de Mon Sep 17 00:00:00 2001 From: Wan Kai Date: Fri, 27 Oct 2023 13:39:53 +0800 Subject: [PATCH] BanyanDBStorageClient: Add `define(Property property, PropertyStore.Strategy strategy)` API. (#11461) --- docs/en/changes/changes.md | 1 + .../plugin/banyandb/BanyanDBStorageClient.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index a30321c6144d..668a11490989 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -29,6 +29,7 @@ * Support collect ZGC memory pool metrics. * Add a component ID for Netty-http (ID=151). * Add a component ID for Fiber (ID=5021). +* BanyanDBStorageClient: Add `define(Property property, PropertyStore.Strategy strategy)` API. #### UI diff --git a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageClient.java b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageClient.java index 810cefb18106..f5f6eef63644 100644 --- a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageClient.java +++ b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageClient.java @@ -155,6 +155,9 @@ public TopNQueryResponse query(TopNQuery q) throws IOException { } } + /** + * PropertyStore.Strategy is default to {@link PropertyStore.Strategy#MERGE} + */ public void define(Property property) throws IOException { try { this.client.apply(property); @@ -165,6 +168,16 @@ public void define(Property property) throws IOException { } } + public void define(Property property, PropertyStore.Strategy strategy) throws IOException { + try { + this.client.apply(property, strategy); + this.healthChecker.health(); + } catch (BanyanDBException ex) { + healthChecker.unHealth(ex); + throw new IOException("fail to define property", ex); + } + } + public void define(Stream stream) throws IOException { try { this.client.define(stream);