apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.27k stars 3.59k forks source link

[Bug] SnapshotSegmentAbortedTxnProcessorImpl contains thread safety issues #22116

Open lhotari opened 9 months ago

lhotari commented 9 months ago

Search before asking

Version

master

Minimal reproduce step

There are several thread safety issues in SnapshotSegmentAbortedTxnProcessorImpl class. examples: https://github.com/apache/pulsar/blob/529e1ab80998143cfe793c018429e9d2bbee5473/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/SnapshotSegmentAbortedTxnProcessorImpl.java#L374-L376 https://github.com/apache/pulsar/blob/529e1ab80998143cfe793c018429e9d2bbee5473/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/SnapshotSegmentAbortedTxnProcessorImpl.java#L383 https://github.com/apache/pulsar/blob/529e1ab80998143cfe793c018429e9d2bbee5473/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/SnapshotSegmentAbortedTxnProcessorImpl.java#L744

What did you expect to see?

Multi-threading code should be thread safe.

What did you see instead?

Non thread-safe code.

Anything else?

No response

Are you willing to submit a PR?

lhotari commented 9 months ago

related to #21304 and #22119

nikam14 commented 7 months ago

@lhotari can you review above mentioned PR.