You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/04/27 13:34:06 UTC

[GitHub] [skywalking-banyandb-java-client] hanahmily commented on a diff in pull request #11: Truncate duration unit at days

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


##########
src/main/java/org/apache/skywalking/banyandb/v1/client/BanyanDBClient.java:
##########
@@ -373,7 +386,14 @@ private void defineIndexRules(Stream stream, List<IndexRule> indexRules) throws
 
         IndexRuleMetadataRegistry irRegistry = new IndexRuleMetadataRegistry(checkNotNull(this.channel));
         for (final IndexRule ir : indexRules) {
-            irRegistry.create(ir);
+            try {
+                irRegistry.create(ir);
+            } catch (BanyanDBException ex) {
+                if (ex.getStatus().equals(Status.Code.ALREADY_EXISTS)) {
+                    continue;
+                }

Review Comment:
   We have a series of `getXXX` to check this. 
   
   BTW, we can't avoid this exception under a concurrent creating scenario even get the resource before creating it. I tend to leave this piece as it is and add a getting operation before the creating. 



-- 
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