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

make ledger rollover check task internal #8946

Merged

Conversation

hangc0276
Copy link
Contributor

Fix #7195

Changes

  1. add a schedulerTask to rollover the ledger in ManagedLedgerImpl instead of BrokerService
  2. add the test.

@hangc0276
Copy link
Contributor Author

@wuzhanpeng Please help take a look, thanks.

@@ -3300,6 +3305,13 @@ private void scheduleTimeoutTask() {
checkReadTimeout();
}), timeoutSec, timeoutSec, TimeUnit.SECONDS);
}

if (config.getMaximumRolloverTimeMs() > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to separate the timing task of checking that current ledger is full from scheduleTimeoutTask and put it in the ledger initialize method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I move it into individual method.

@sijie sijie added this to the 2.8.0 milestone Dec 14, 2020
@hangc0276
Copy link
Contributor Author

/pulsarbot run-failure-checks

3 similar comments
@hangc0276
Copy link
Contributor Author

/pulsarbot run-failure-checks

@hangc0276
Copy link
Contributor Author

/pulsarbot run-failure-checks

@hangc0276
Copy link
Contributor Author

/pulsarbot run-failure-checks

/**
* Roll current ledger if it is full
*/
void rollCurrentLedgerIfFull();
Copy link
Member

Choose a reason for hiding this comment

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

@hangc0276 we shouldn't remove a method from an interface directly. we should keep the method and mark it as deprecated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, i move it back.

@hangc0276 hangc0276 requested a review from sijie December 24, 2020 01:35
@hangc0276
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@hangc0276
Copy link
Contributor Author

/pulsarbot run-failure-checks

@hangc0276 hangc0276 force-pushed the make_ledger_rollover_check_task_internal branch from 9fe915a to 534326d Compare January 7, 2021 05:20
@hangc0276
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@hangc0276
Copy link
Contributor Author

/pulsarbot run-failure-checks

@hangc0276
Copy link
Contributor Author

/pulsarbot run-failure-checks

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

LGTM

@sijie sijie merged commit b4ef76e into apache:master Jan 7, 2021
merlimat pushed a commit to merlimat/pulsar that referenced this pull request Apr 6, 2021
Fix apache#7195 

### Changes
1. add a schedulerTask to rollover the ledger in `ManagedLedgerImpl` instead of `BrokerService`
2. add the test.
eolivelli pushed a commit to datastax/pulsar that referenced this pull request May 20, 2021
Fix apache#7195

1. add a schedulerTask to rollover the ledger in `ManagedLedgerImpl` instead of `BrokerService`
2. add the test.

(cherry picked from commit b4ef76e)
codelipenghui pushed a commit that referenced this pull request Jul 9, 2021
The PR #11116 couldn't be cherry-picked to `branch-2.7`, because there are too many conflicts.

In PR #8946 the ledger rollover task had been moved from `BrokerService` to `ManagedLedgerImpl`, and this PR is based on it.

### Motivation

Currently, the ledger rollover scheduled task will execute before reach the ledger maximum rollover time, this will cause the ledger doesn't roll over in time.

### Modifications

Only make the ledger rollover scheduled task after the ledger created successfully.
If the scheduled task was executed when there is no entry in the current ledger, the scheduled task will not be re-executed, and if there is new entry is added the ledger will rollover.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make ledger rollover check task internal
4 participants