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

Initial sync time doesn't include the final commit time #3868

Open
gmart7t2 opened this issue Jul 19, 2024 · 4 comments
Open

Initial sync time doesn't include the final commit time #3868

gmart7t2 opened this issue Jul 19, 2024 · 4 comments

Comments

@gmart7t2
Copy link
Contributor

Maybe consider switching the order of these two blocks:

    if starting_index_height == 0 && self.height > 0 {
      wtx.open_table(STATISTIC_TO_COUNT)?.insert(
        Statistic::InitialSyncTime.key(),
        &u64::try_from(start.elapsed().as_micros())?,
      )?;
    }

    if uncommitted > 0 {
      self.commit(wtx, utxo_cache)?;
    }

That final commit can take a long time, and should be included in the initial sync time.

@casey
Copy link
Collaborator

casey commented Aug 12, 2024

Good find! One issue though is that after the commit, the write transaction doesn't exist, so we would have to create a new write transaction, se the statistic, and commit again. How long does the final commit usually take?

@raphjaph
Copy link
Collaborator

It can take like 30mins sometimes I think

@casey
Copy link
Collaborator

casey commented Aug 16, 2024

I think we should just double-commit if it's the first commit. I.e., if it's the first commit and we just comitted, set the statistic and re-commit. The second commit should be very quick.

@raphjaph
Copy link
Collaborator

yes, the second one is negligable

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 a pull request may close this issue.

3 participants