-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve][txn] Take first snapshot before persisting the first transactional message #21406
Merged
liangyepianzhou
merged 19 commits into
apache:master
from
liangyepianzhou:firstsnapshot
Aug 29, 2024
Merged
[improve][txn] Take first snapshot before persisting the first transactional message #21406
liangyepianzhou
merged 19 commits into
apache:master
from
liangyepianzhou:firstsnapshot
Aug 29, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
liangyepianzhou
requested review from
codelipenghui,
poorbarcode and
congbobo184
October 20, 2023 08:38
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
...er/src/test/java/org/apache/pulsar/broker/transaction/buffer/TopicTransactionBufferTest.java
Outdated
Show resolved
Hide resolved
poorbarcode
reviewed
Oct 20, 2023
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Show resolved
Hide resolved
Demogorgon314
approved these changes
Oct 24, 2023
codelipenghui
previously requested changes
Oct 27, 2023
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/TransactionBuffer.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
codelipenghui
added
category/performance
Performance issues fix or improvements
area/transaction
type/enhancement
The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
labels
Oct 27, 2023
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
...er/src/test/java/org/apache/pulsar/broker/transaction/buffer/TopicTransactionBufferTest.java
Outdated
Show resolved
Hide resolved
liangyepianzhou
force-pushed
the
firstsnapshot
branch
from
November 7, 2023 02:21
6b952d8
to
7df380b
Compare
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Show resolved
Hide resolved
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
liangyepianzhou
force-pushed
the
firstsnapshot
branch
from
November 16, 2023 05:22
53ef26d
to
94efb1e
Compare
1. `testWriteSnapshotWhenFirstTxnMessageSend` mainly test what we want to do. -- Take first snapshot when sending first transaction message. 2. `testMessagePublishInOrder` and `testRefCountWhenAppendBufferToTxn` test the message publish as expected. -- in order and no memory leak.
liangyepianzhou
force-pushed
the
firstsnapshot
branch
from
November 16, 2023 14:37
94efb1e
to
134472e
Compare
Add cases for sending second transaction message adn send transaction message failed.
...er/src/test/java/org/apache/pulsar/broker/transaction/buffer/TopicTransactionBufferTest.java
Outdated
Show resolved
Hide resolved
...c/test/java/org/apache/pulsar/broker/transaction/buffer/utils/TransactionBufferTestImpl.java
Show resolved
Hide resolved
thetumbled
approved these changes
Jul 30, 2024
...er/src/test/java/org/apache/pulsar/broker/transaction/buffer/TopicTransactionBufferTest.java
Outdated
Show resolved
Hide resolved
15 tasks
...er/src/test/java/org/apache/pulsar/broker/transaction/buffer/TopicTransactionBufferTest.java
Show resolved
Hide resolved
This reverts commit 9cc657f.
poorbarcode
reviewed
Aug 7, 2024
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/TransactionBuffer.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
Show resolved
Hide resolved
2. visibleForTesting
2 tasks
poorbarcode
reviewed
Aug 21, 2024
...er/src/test/java/org/apache/pulsar/broker/transaction/buffer/TopicTransactionBufferTest.java
Outdated
Show resolved
Hide resolved
@codelipenghui @poorbarcode This PR has been here for too long. Would you mind taking another look? |
liangyepianzhou
dismissed
codelipenghui’s stale review
August 28, 2024 06:10
The comments are addressed.
/pulsarbot rerun-failure-checks |
grssam
pushed a commit
to grssam/pulsar
that referenced
this pull request
Sep 4, 2024
…ctional message (apache#21406) ### Motivation The decision to write a snapshot before the first transaction message instead of before building the producer, is based on the fact that only the act of writing transactional messages signifies the use of the transaction buffer. Furthermore, it is only appropriate to schedule snapshot updates after this point. Otherwise, it will add a lot of unnecessary IO read and write operations and increase the delay of topic load. --- **Scenario** * 1000 topics under namespace1. * Client1 enables transaction and sends transaction messages to topic 1. * Client1 sends normal messages to topic 2~500. * Client2 disables transaction and sends messages to topic 501~1000. **Internal Behavior** * Topic 1~500 will start the 500 task to write snapshots into the same system topic, e.g., system topic 1. * All the topics (1~1000) will read this system topic 1 when topic loading. ### Modifications This Pull Request aims to resolve the unnecessary write operation. Starting to write snapshots when sending first transaction messages instead of building producer.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/transaction
category/performance
Performance issues fix or improvements
doc-not-needed
Your PR changes do not impact docs
type/enhancement
The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The decision to write a snapshot before the first transaction message instead of before building the producer, is based on the fact that only the act of writing transactional messages signifies the use of the transaction buffer. Furthermore, it is only appropriate to schedule snapshot updates after this point.
Otherwise, it will add a lot of unnecessary IO read and write operations and increase the delay of topic load.
Scenario
Internal Behavior
Modifications
This Pull Request aims to resolve the unnecessary write operation. Starting to write snapshots when sending first transaction messages instead of building producer.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: