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

Add config to lazily recover cursors when recovering a managed ledger. #7858

Merged
merged 3 commits into from
Sep 9, 2020

Conversation

MarvinCai
Copy link
Contributor

Fixes #7404

Motivation

Currently, we have to wait until all cursors to be recovered before completing opening a managed ledger. This results in very long recovery time for the managed ledger. Pulsar is a messaging/streaming system. Write availability is critical to a lot of core business applications. We need to make it always writable. Hence we should decouple loading cursors from loading managed ledger. This ensures producers can move forward immediately once the data ledgers are ready.

Modifications

Add config to lazily recover cursors when recovering a managed ledger.
Will initial cursor recovery and put it into uninitializedCursors map.
This can speed up managed ledger recovery and write availability,
but with the caveat that when topic is recovered we're not sure if all old cursor can be recovered or not.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change added tests and can be verified as follows:

  • Added unit test to verify ledger is ready before cursor fully recovered

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)

Documentation

  • Does this pull request introduce a new feature? (yes)
  • If yes, how is the feature documented? ( docs / JavaDocs )

@MarvinCai
Copy link
Contributor Author

/pulsarbot run-failure-checks

@sijie sijie added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Aug 24, 2020
@sijie sijie added this to the 2.7.0 milestone Aug 24, 2020
Update document about lazyCursorRecovery config and fix test case, wait time for ledger recovery should be 5s instead of 50s.
@MarvinCai
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@MarvinCai
Copy link
Contributor Author

/pulsarbot run-failure-checks

@MarvinCai
Copy link
Contributor Author

/pulsarbot rerun unit-tests

1 similar comment
@MarvinCai
Copy link
Contributor Author

/pulsarbot rerun unit-tests

@jiazhai jiazhai merged commit 22b8923 into apache:master Sep 9, 2020
lbenc135 pushed a commit to lbenc135/pulsar that referenced this pull request Oct 3, 2020
apache#7858)

Fixes apache#7404

### Motivation
Currently, we have to wait until all cursors to be recovered before completing opening a managed ledger. This results in very long recovery time for the managed ledger. Pulsar is a messaging/streaming system. Write availability is critical to a lot of core business applications. We need to make it always writable. Hence we should decouple loading cursors from loading managed ledger. This ensures producers can move forward immediately once the data ledgers are ready.

### Modifications
Add config to lazily recover cursors when recovering a managed ledger.
Will initial cursor recovery and put it into uninitializedCursors map.
This can speed up managed ledger recovery and write availability,
but with the caveat that when topic is recovered we're not sure if all old cursor can be recovered or not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[managed ledger] Load cursors lazily
4 participants