You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/11 21:30:47 UTC

[GitHub] [pulsar] rdhabalia commented on a change in pull request #9501: [pulsar-metadata] return alreadyExist error-code when node exists

rdhabalia commented on a change in pull request #9501:
URL: https://github.com/apache/pulsar/pull/9501#discussion_r574840078



##########
File path: pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java
##########
@@ -213,7 +214,7 @@ public ZKMetadataStore(ZooKeeper zkc) {
                                     future.complete(new Stat(name, 0, 0, 0));
                                 } else if (code == Code.NODEEXISTS) {
                                     // We're emulating a request to create node, so the version is invalid
-                                    future.completeExceptionally(getException(Code.BADVERSION, path));
+                                    future.completeExceptionally(getException(Code.NODEEXISTS, path));

Review comment:
       we can handle `BADVERSION` as `NODEEXISTS` at caller side. but my only concern was what exact benefit we can get  by returning different error-code. because actual error (in this case AlreadyExist) can help better in handling failure rather than deriving from `BADVERSION` . I will try to change handling at caller side but I think we might have usecases in future to explicitly know specific error to handle the failure.




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

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