You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "heesung-sn (via GitHub)" <gi...@apache.org> on 2024/08/17 02:17:37 UTC
[I] [Bug] Metadata Read Inconsistency [pulsar]
heesung-sn opened a new issue, #23186:
URL: https://github.com/apache/pulsar/issues/23186
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Read release policy
- [X] I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
### Version
pulsar:3.3.0
### Minimal reproduce step
```java
public class Data{
String id;
Action action;
}
enum Action{
A,
B
}
public class TestMetadata extends BaseResources<Data>{
public static final String PATH = "/my-test-zk-path/data";
public TestMetadata(MetadataStore configurationStore, int operationTimeoutSec) {
super(configurationStore, Data.class, operationTimeoutSec);
}
public CompletableFuture<Void> createAsync(Data data) {
return createAsync(joinPath(PATH, data.id()), data);
}
public CompletableFuture<Data> readAsync(String id) {
CompletableFuture<Data> future = new CompletableFuture();
getAsync(joinPath(PATH, id)).thenAccept(data -> {
if (!data.isPresent()) {
future.completeExceptionally(new MetadataStoreException.NotFoundException("Not found"));
} else {
log.info("reading id:{}, job:{}", id, data.get());
future.complete(data.get());
}
});
return future;
}
public CompletableFuture<Void> updateActionAsync(String id, Data.Action action) {
CompletableFuture future = new CompletableFuture();
readAsync(id)
.thenCompose(__ -> setAsync(joinPath(PATH, sourceBrokerId), (old) -> {
log.info("updating action. id:{}, old:{} to action:{}", id, old, action);
old.setAction(action);
return old;
}))
.thenCompose(__ -> readAsync(sourceBrokerId))
.whenComplete((job, ex) -> {
// somehow this shows the latest value that was written correctly.
log.info("updated action. id:{}, job:{}", id, job);
if (ex != null) {
if (!future.isCompletedExceptionally()) {
future.completeExceptionally(FutureUtil.unwrapCompletionException(ex));
}
} else {
future.complete(null);
}
});
return future;
}
}
Given above the test classes above, run the following test.
TestMetadata metadata = new TestMetadata(pulsar.getLocalMetadataStore(),
pulsar.getConfiguration().getMetadataStoreOperationTimeoutSeconds());
Data data = new Data("1", A);
1. metadata.createAsync(data).join();
3. metadata.updateActionAsync("1", B).join();
4. metadata.updateActionAsync("1", A).join();
// keep trying to verify the data.action is set to A. But it continue to show the old value, B.
5. metadata.readAsync("1").join() => data : {"1", B}
...
30. metadata.readAsync("1").join() => data : {"1", B}
```
### What did you expect to see?
The metadata is expected to read the last value that was written.
### What did you see instead?
The metadata returned the old value for read op.
### Anything else?
_No response_
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
--
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: commits-unsubscribe@pulsar.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Inconsistent Metadata Read [pulsar]
Posted by "heesung-sn (via GitHub)" <gi...@apache.org>.
heesung-sn closed issue #23186: [Bug] Inconsistent Metadata Read
URL: https://github.com/apache/pulsar/issues/23186
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Inconsistent Metadata Read [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on issue #23186:
URL: https://github.com/apache/pulsar/issues/23186#issuecomment-2294707320
Please check to see if #18518 provides a way to resolve this.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Inconsistent Metadata Read [pulsar]
Posted by "heesung-sn (via GitHub)" <gi...@apache.org>.
heesung-sn commented on issue #23186:
URL: https://github.com/apache/pulsar/issues/23186#issuecomment-2295470973
Closing this issue. I cannot reproduce this anymore.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org