merlimat commented on a change in pull request #9501:
URL: https://github.com/apache/pulsar/pull/9501#discussion_r571465395
##########
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:
This was done on purpose here. Since there is no "create()" operation
but just the `put()` with the optional expected version. A `create()` is
equivalent to a `put(Optional.of(-1))` (eg: expecting the node not to be
there). In that light it makes sense to me to stick to the BadVersion.
If the caller wants to make sure to create an entry, it just need to treat
the bad version error for what it is: the state it's not what was expected.
----------------------------------------------------------------
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:
[email protected]