Skip to content
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

[Transaction] Fix topicTransactionBuffer handle null snapshot #12758

Conversation

congbobo184
Copy link
Contributor

fix #12754

Motivation

Now when delete topic, we will write a null value to Transaction buffer snapshot topic, other topic recover by this transaction buffer snapshot system topic, will produce NPE

Modifications

judge NPE logic

Verifying this change

add some test for it

@github-actions
Copy link

@congbobo184:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@congbobo184 congbobo184 added cherry-picked/branch-2.9 Archived: 2.9 is end of life and removed doc-label-missing labels Nov 11, 2021
@congbobo184 congbobo184 added this to the 2.10.0 milestone Nov 11, 2021
@github-actions
Copy link

@congbobo184:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

Copy link
Contributor

@gaoran10 gaoran10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Message<TransactionBufferSnapshot> message = reader.readNext();
TransactionBufferSnapshot transactionBufferSnapshot = message.getValue();
if (topic.getName().equals(transactionBufferSnapshot.getTopicName())) {
if (transactionBufferSnapshot != null
Copy link
Contributor

@gaoran10 gaoran10 Nov 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the key of the message to verify the message belong to this topic? This may reduce some deserialization works.

@congbobo184 congbobo184 merged commit c90c89b into apache:master Nov 12, 2021
eolivelli pushed a commit that referenced this pull request Nov 12, 2021
fix #12754
Now when delete topic, we will write a null value to Transaction buffer snapshot topic, other topic recover by this transaction buffer snapshot system topic, will produce NPE

judge NPE logic

(cherry picked from commit c90c89b)
@eolivelli
Copy link
Contributor

This patch actually fixes my issue, thank you very much !

eolivelli pushed a commit to eolivelli/pulsar that referenced this pull request Nov 29, 2021
…#12758)

fix apache#12754
### Motivation
Now when delete topic, we will write a null value to Transaction buffer snapshot topic, other topic recover by this transaction buffer snapshot system topic, will produce NPE

### Modifications
judge NPE logic
eolivelli pushed a commit to eolivelli/pulsar that referenced this pull request Mar 1, 2022
…#12758)

fix apache#12754
Now when delete topic, we will write a null value to Transaction buffer snapshot topic, other topic recover by this transaction buffer snapshot system topic, will produce NPE

judge NPE logic

(cherry picked from commit c90c89b)
eolivelli pushed a commit to eolivelli/pulsar that referenced this pull request Mar 1, 2022
…#12758)

fix apache#12754
Now when delete topic, we will write a null value to Transaction buffer snapshot topic, other topic recover by this transaction buffer snapshot system topic, will produce NPE

judge NPE logic

(cherry picked from commit c90c89b)
eolivelli pushed a commit to datastax/pulsar that referenced this pull request Mar 1, 2022
…#12758)

fix apache#12754
Now when delete topic, we will write a null value to Transaction buffer snapshot topic, other topic recover by this transaction buffer snapshot system topic, will produce NPE

judge NPE logic

(cherry picked from commit c90c89b)
eolivelli pushed a commit to datastax/pulsar that referenced this pull request Mar 1, 2022
…#12758)

fix apache#12754
Now when delete topic, we will write a null value to Transaction buffer snapshot topic, other topic recover by this transaction buffer snapshot system topic, will produce NPE

judge NPE logic

(cherry picked from commit c90c89b)
(cherry picked from commit 75cec6d)
codelipenghui pushed a commit that referenced this pull request Mar 2, 2022
#14510)

fix #12754
Now when delete topic, we will write a null value to Transaction buffer snapshot topic, other topic recover by this transaction buffer snapshot system topic, will produce NPE

(cherry picked from commit c90c89b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transactions: if you enable the TransactionCoordinator force delete topic leaves the broker in bad state
4 participants