You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "hanahmily (via GitHub)" <gi...@apache.org> on 2023/08/31 23:24:36 UTC

[GitHub] [skywalking-banyandb-java-client] hanahmily commented on a diff in pull request #46: Add mod revision check to write requests(measure/stream)

hanahmily commented on code in PR #46:
URL: https://github.com/apache/skywalking-banyandb-java-client/pull/46#discussion_r1312379494


##########
src/main/java/org/apache/skywalking/banyandb/v1/client/MeasureBulkWriteProcessor.java:
##########
@@ -33,30 +39,50 @@
 @ThreadSafe
 public class MeasureBulkWriteProcessor extends AbstractBulkWriteProcessor<BanyandbMeasure.WriteRequest,
         MeasureServiceGrpc.MeasureServiceStub> {
+    private final BanyanDBClient client;
+
     /**
      * Create the processor.
      *
-     * @param measureServiceStub stub for gRPC call.
+     * @param client             the client
      * @param maxBulkSize        the max bulk size for the flush operation
      * @param flushInterval      if given maxBulkSize is not reached in this period, the flush would be trigger
      *                           automatically. Unit is second.
      * @param concurrency        the number of concurrency would run for the flush max.
      */
     protected MeasureBulkWriteProcessor(
-            final MeasureServiceGrpc.MeasureServiceStub measureServiceStub,
+            final BanyanDBClient client,
             final int maxBulkSize,
             final int flushInterval,
             final int concurrency) {
-        super(measureServiceStub, "MeasureBulkWriteProcessor", maxBulkSize, flushInterval, concurrency);
+        super(client.getMeasureServiceStub(), "MeasureBulkWriteProcessor", maxBulkSize, flushInterval, concurrency);
+        this.client = client;
     }
 
     @Override
     protected StreamObserver<BanyandbMeasure.WriteRequest> buildStreamObserver(MeasureServiceGrpc.MeasureServiceStub stub,
                                                                                CompletableFuture<Void> batch) {
         return stub.write(new StreamObserver<BanyandbMeasure.WriteResponse>() {
+            private final Set<String> schemaExpired = new HashSet<>();
+
             @Override
             public void onNext(BanyandbMeasure.WriteResponse writeResponse) {
-
+                switch (writeResponse.getStatus()) {
+                case STATUS_EXPIRED_REVISION:

Review Comment:
   I prefer to handle them. BanyanDB batch writing services log these errors instead of returning them to the clients. In this round, I would like the Java client to return these errors through `CompletableFuture`. OAP module will have a chance to log them. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org