Skip to content

fix: check if db exists in update_app_envs_before_open_db when starting a replica#2374

Open
nanorth wants to merge 5 commits intoapache:masterfrom
nanorth:fix_envs
Open

fix: check if db exists in update_app_envs_before_open_db when starting a replica#2374
nanorth wants to merge 5 commits intoapache:masterfrom
nanorth:fix_envs

Conversation

@nanorth
Copy link
Copy Markdown
Contributor

@nanorth nanorth commented Feb 13, 2026

Handle the manual_compact.once.trigger_time parameter in app_envs provided by duplication. When a backup cluster creates an app via duplication, incomplete replicas may trigger manual compaction if the source app has this parameter configured. However, these replicas have not yet opened RocksDB successfully, which can lead to coredumps.

@github-actions github-actions Bot added the cpp label Feb 13, 2026
@nanorth nanorth changed the title fix: check if db exists in update_app_envs_before_open_db when starti… fix: check if db exists in update_app_envs_before_open_db when starting a replica Feb 13, 2026
Copy link
Copy Markdown

@acelyc111-bot acelyc111-bot left a comment

Choose a reason for hiding this comment

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

Review: Check db exists before manual compact

Summary: Adds a null check for _db before calling start_manual_compact_if_needed in update_app_envs_before_open_db. Prevents crash when this function is called during replica startup before the DB is opened.

What's good:

  • Targeted, minimal fix — exactly the kind of change you want for a crash fix
  • Correct placement: the other calls in the same function (update_rocksdb_iteration_threshold, update_validate_partition_hash, etc.) likely don't need the DB, but manual compaction does

Style issue:

if(_db){  // missing spaces

Should be:

if (_db) {

Verdict: ✅ Approve — Fix is correct. The style nit is minor and can be addressed in a follow-up or during merge.

Comment thread src/server/pegasus_server_impl.cpp Outdated
Comment thread src/server/pegasus_server_impl.cpp Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants