fix standby forward cc request by adding missed check.#144
Conversation
WalkthroughSynchronizes in-memory counter normal_obj_sz_ with post-commit payload status after EmplaceAndCommitBufferedTxnCommand in two code paths (Emplace and UploadTxCommands). Recomputes new_status from cce, then increments or decrements normal_obj_sz_ based on prior existence and resulting Normal/non-Normal status. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller as Emplace / UploadTxCommands
participant Map as ObjectCcMap
participant Txn as TxnBuffer
participant Commit as CommitLogic
Caller->>Map: Prepare cce and command
Map->>Txn: EmplaceAndCommitBufferedTxnCommand(cmd)
Txn-->>Commit: Batch/commit
Commit-->>Map: Commit result
Note over Map: Recompute new_status from cce
alt Previously existed AND new_status != Normal
Map->>Map: normal_obj_sz_--
else Previously not exist AND new_status == Normal
Map->>Map: normal_obj_sz_++
end
Map-->>Caller: Return (post-commit, in-memory count synced)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (3 warnings)
✨ Finishing touches
🧪 Generate unit tests
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
include/cc/object_cc_map.h (2)
1749-1758: Reduce duplication: extract a tiny helper to adjust normal_obj_sz_.The same pattern appears in multiple places. A small helper reduces drift and future misses.
Apply locally at these sites and elsewhere after introducing a helper:
- if (s_obj_exist && payload_status != RecordStatus::Normal) - { - TemplateCcMap<KeyT, ValueT, false, false>::normal_obj_sz_--; - } - else if (!s_obj_exist && payload_status == RecordStatus::Normal) - { - TemplateCcMap<KeyT, ValueT, false, false>::normal_obj_sz_++; - } + AdjustNormalObjCount(s_obj_exist, payload_status)- RecordStatus new_status = cce->PayloadStatus(); - if (s_obj_exist && new_status != RecordStatus::Normal) - { - TemplateCcMap<KeyT, ValueT, false, false>::normal_obj_sz_--; - } - else if (!s_obj_exist && new_status == RecordStatus::Normal) - { - TemplateCcMap<KeyT, ValueT, false, false>::normal_obj_sz_++; - } + RecordStatus new_status = cce->PayloadStatus(); + AdjustNormalObjCount(s_obj_exist, new_status);Add this private helper in ObjectCcMap:
private: inline void AdjustNormalObjCount(bool existed_before, RecordStatus after) { if (existed_before && after != RecordStatus::Normal) { --this->normal_obj_sz_; } else if (!existed_before && after == RecordStatus::Normal) { ++this->normal_obj_sz_; } }Also applies to: 1943-1951
1765-1772: Duplicate last_dirty_commit_ts_ update.The same condition and assignment appear twice back-to-back; remove one.
- if (commit_ts > last_dirty_commit_ts_) - { - last_dirty_commit_ts_ = commit_ts; - } if (commit_ts > ccp->last_dirty_commit_ts_) { ccp->last_dirty_commit_ts_ = commit_ts; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
include/cc/object_cc_map.h(1 hunks)include/tx_record.h(0 hunks)
💤 Files with no reviewable changes (1)
- include/tx_record.h
🧰 Additional context used
🧬 Code graph analysis (1)
include/cc/object_cc_map.h (2)
include/tx_record.h (1)
RecordStatus(36-138)include/cc/template_cc_map.h (1)
normal_obj_sz_(12210-12212)
81feb08 to
61fcabd
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
include/cc/object_cc_map.h (1)
1765-1772: Remove duplicate last_dirty_commit_ts_ updateThe two consecutive if (commit_ts > last_dirty_commit_ts_) blocks are identical; keep one.
if (commit_ts > last_dirty_commit_ts_) { last_dirty_commit_ts_ = commit_ts; } - if (commit_ts > last_dirty_commit_ts_) - { - last_dirty_commit_ts_ = commit_ts; - }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
include/cc/object_cc_map.h(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
include/cc/object_cc_map.h (2)
include/tx_record.h (1)
RecordStatus(36-138)include/cc/template_cc_map.h (1)
normal_obj_sz_(12210-12212)
Here are some reminders before you submit the pull request
fixes eloqdb/tx_service#issue_id./mtr --suite=mono_main,mono_multi,mono_basicnormal object count is incorrect. Assertion 'VersionedRecord | normal_obj_sz_ == 0' failed eloqkv#156
Summary by CodeRabbit