Skip to content

[Transaction] Fix transaction problem when sub delete.#11305

Closed
congbobo184 wants to merge 2 commits into
apache:masterfrom
congbobo184:congbobo184_fix_transaction_problem_when_sub_delete
Closed

[Transaction] Fix transaction problem when sub delete.#11305
congbobo184 wants to merge 2 commits into
apache:masterfrom
congbobo184:congbobo184_fix_transaction_problem_when_sub_delete

Conversation

@congbobo184

Copy link
Copy Markdown
Contributor

Motivation

now, when sub has been deleted the end txn sub will fail.

implement

when the sub has been deleted the end txn sub op will success.

Verifying this change

Add the tests for it

Does this pull request potentially affect one of the following parts:
If yes was chosen, please highlight the changes

Dependencies (does it add or upgrade a dependency): (no)
The public API: (no)
The schema: (no)
The default values of configurations: (no)
The wire protocol: (no)
The rest endpoints: (no)
The admin cli options: (no)
Anything that affects deployment: (no)

@congbobo184 congbobo184 self-assigned this Jul 13, 2021
@congbobo184 congbobo184 added cherry-picked/branch-2.8 Archived: 2.8 is end of life doc-not-needed Your PR changes do not impact docs labels Jul 13, 2021

@eolivelli eolivelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't understand why we are modifying the tests this way.
can you please explain ?

ServerError.ServiceNotReady,
"Topic " + optionalTopic.get().getName()
+ " subscription " + subName + " is not exist."));
log.warn("Topic {} subscription {} is not exist.", optionalTopic.get().getName(), subName);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we can use this opportunity to fix the typo and use this message: Topic {} subscription {} does not exist

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok

tbClient.abortTxnOnSubscription(topic + "_abort_sub", "test", 1L, 1L, -1L).get();
tbClient.commitTxnOnSubscription(topic + "_commit_sub", "test", 1L, 1L, -1L).get();

Awaitility.await().until(() -> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do we have to use this loop ?
in this test the command is supposed to work well
which kind of error may happen ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

waiting pending ack init.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we explicitly wait for that initialisation ?

I have a question about how users are supposed to deal with this problem.
I know that TransactionBufferClient is an internal API.
but when we think about the user of "Transaction#commit" (and abort)...
does the PulsarClient wait automatically for this initialisation to complete or will Transaction#commit fail ?

}

@Test
public void testTransactionBufferOpFail() throws InterruptedException, ExecutionException {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why are we dropping this test ?

@eolivelli

Copy link
Copy Markdown
Contributor

This patch looks like #11304

@codelipenghui codelipenghui added release/2.8.1 and removed cherry-picked/branch-2.8 Archived: 2.8 is end of life labels Jul 13, 2021
@Anonymitaet

Copy link
Copy Markdown
Member

@congbobo184 many thanks for your doc label!

@hangc0276

Copy link
Copy Markdown
Contributor

@congbobo184 Would you please address the comments by eolivelli ?

@congbobo184

Copy link
Copy Markdown
Contributor Author

#11304 have solve this. so close this pr.

@congbobo184 congbobo184 closed this Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs release/2.8.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants