Skip to content

fix(chain_plugin): close and flush database on stop-replay-at-block exit (fixes #3710) - #3713

Open
substeem wants to merge 1 commit into
steemit:devfrom
substeem:3710-flush-db-on-stop-replay
Open

substeem wants to merge 1 commit into
steemit:devfrom
substeem:3710-flush-db-on-stop-replay

Conversation

@substeem

@substeem substeem commented Oct 8, 2026

Copy link
Copy Markdown

Description

When running steemd with --replay-blockchain --stop-replay-at-block=<N>, the node previously exited via exit(EXIT_SUCCESS) without closing the chain database. Because the database was not closed, the shared memory file was not flushed to disk cleanly, causing the replayed state up to block <N> to be lost on the next startup.

Changes

  • Explicitly call my->db.close() before calling exit(EXIT_SUCCESS) in chain_plugin::plugin_startup().
  • Add log messages confirming database closure and shared memory flush.

Closes #3710

@substeem
substeem changed the base branch from main to dev October 8, 2026 21:48
@substeem
substeem force-pushed the 3710-flush-db-on-stop-replay branch from 7b6f872 to 26be23c Compare October 8, 2026 21:49
@only-dev-time

Copy link
Copy Markdown

This is not fully tested!
I also used this for db comparison (commit 47f75cd). I noticed that an in-memory replay can lead to duplicate entries in certain situations if the database is closed before the programme exits.

Example:

comment_index:
--- Size: DB1: 4181982    | DB2: 4181982   
--- Progress finished (2090991/4181982)

#3710

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.

Option stop-replay-at-block exits the app without flushing the database

2 participants