refactor: Disable auto checkpoint for read-only mode#237
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Pull request overview
Refactors database shutdown behavior so that automatic checkpoint creation is skipped when the database is opened in read-only mode, avoiding unnecessary persistence work (and potential writes) on close.
Changes:
- Gate
createCheckpoint()onDBMode::READ_WRITEinNeugDB::Close(), and add a VLOG entry when checkpointing occurs. - Remove unused
_move_datahelper templates fromid_indexer.h. - Adjust
closed_stores inNeugDB::Close()(removes one redundant store; adds another at the end).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/neug_db.cc | Skip checkpoint-on-close for read-only mode; add logging; tweak closed_ updates. |
| include/neug/utils/id_indexer.h | Remove unused helper templates at end of header. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
src/server/neug_db_session.cc:108
- The term 'read-only mode' is used for both the database configuration (
DBMode::READ_ONLY) and the session access mode (AccessMode::kRead). The second message ('Read-only mode does not support...') can be confused with the DB-level message above. Consider clarifying the access-mode message (e.g., 'Access mode READ does not support write operations') to make client-facing errors unambiguous.
return neug::Status(
neug::StatusCode::ERR_INVALID_ARGUMENT,
"Database is in read-only mode; write operations are not allowed.");
}
}
if (mode == neug::AccessMode::kRead) {
if (!is_read_only(flags)) {
return neug::Status(neug::StatusCode::ERR_INVALID_ARGUMENT,
"Read-only mode does not support write operations.");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When the database is opened in read-only mode, there is no need for us to auto checkpoint on close.
Fix #239
Fix #240