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 transaction log recover sequenceId problem. #10224

Conversation

congbobo184
Copy link
Contributor

Motivation

now recover transaction log can't get the correct sequenceID. cursor will ack the lastConfirmEntry.

implement

  1. change recover the sequenceID by getting lastConfirmEntry.
  2. when the ledger have been deleted, store the max sequenceID in managedLedger properties.

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)

@@ -50,4 +50,5 @@ message TransactionMetadataEntry {
optional uint64 timeout_ms = 8;
optional uint64 start_time = 9;
optional uint64 last_modification_time = 10;
optional uint64 max_sequence_id = 11;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it better to use max_local_txn_id

congbo added 3 commits April 18, 2021 23:55
…_problem

# Conflicts:
#	pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionMetadataStore.java
@@ -586,6 +588,48 @@ public void asyncReadEntries(int numberOfEntriesToRead, long maxSizeBytes, ReadE
ledger.asyncReadEntries(op);
}

public CompletableFuture<Entry> readLastConfirmEntry() {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use getLastPosition() method of the ManagedLedger directly.

@@ -586,6 +588,47 @@ public void asyncReadEntries(int numberOfEntriesToRead, long maxSizeBytes, ReadE
ledger.asyncReadEntries(op);
}

public CompletableFuture<Entry> readSpecifyPositionByPosition(PositionImpl position) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have a method asyncReadEntry in the ManagedLedgerImpl, it's better to use the current implementation directly.

congbo added 4 commits April 22, 2021 23:48
…_problem

# Conflicts:
#	pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionLogImpl.java
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.

4 participants