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

Backport to v0.114.x , IndexerService::apply_init_tip should stop after received exit signal. #4346

Merged
merged 5 commits into from
Feb 18, 2024

Conversation

eval-exec
Copy link
Collaborator

@eval-exec eval-exec commented Feb 8, 2024

Backport #4345 #4348

What problem does this PR solve?

Issue Number: close #4311

Problem Summary:

In the apply_init_tip function, there is a loop that should take into account the exit signal:

loop {
if let Err(e) = self.secondary_db.try_catch_up_with_primary() {
error!("secondary_db try_catch_up_with_primary error {}", e);
}
if let Some(header) = self.secondary_db.get_block_header(&init_tip_hash.pack()) {
let init_tip_number = header.number();
let mut batch = self.store.batch().expect("create batch should be OK");
batch
.put_kv(
Key::Header(init_tip_number, &init_tip_hash.pack(), true),
vec![],
)
.expect("insert init tip header should be OK");
batch.commit().expect("commit batch should be OK");
break;
}
sleep(Duration::from_secs(1));

Additionally, once initial_syncing is finished and CKB receives an exit signal, there is no need to spawn the new_block_watcher polling job.

What's Changed:

Related changes

  • handle exit signal in apply_init_tip

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code ci-runs-only: [ quick_checks,linters ]

Side effects

  • None

Release note

Title Only: Include only the PR title in the release note.

@eval-exec eval-exec requested a review from a team as a code owner February 8, 2024 11:15
@eval-exec eval-exec changed the title Backport to v0.114.x IndexerService::apply_init_tip should stop after received exit signal. Backport to v0.114.x , IndexerService::apply_init_tip should stop after received exit signal. Feb 8, 2024
@eval-exec eval-exec requested a review from doitian February 8, 2024 11:15
quake
quake previously approved these changes Feb 8, 2024
@doitian
Copy link
Member

doitian commented Feb 18, 2024

Please rebase

@eval-exec eval-exec force-pushed the exec/rc/v0.114.x-4345 branch from 0443e1c to ecd687e Compare February 18, 2024 02:42
@doitian doitian merged commit 708f2b2 into nervosnetwork:rc/v0.114.x Feb 18, 2024
31 checks passed
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.

3 participants