Conversation
WalkthroughUpdates data_substrate subproject reference, changes RedisListObject destructor from defaulted to explicit declaration, and adds verbose lifecycle and operation logging with stack traces to RedisListObject and transaction dispatch code. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/redis_list_object.cpp (1)
26-74:⚠️ Potential issue | 🟡 MinorGate stacktrace logging in constructors/destructor to reduce overhead.
The
boost::stacktracecalls in the default, copy, and move constructors and destructor (lines 41, 49, 65, 73) can be costly in production. Since the codebase usesDLOG(INFO)for debug-level logging (seeredis_handler.cpp,pub_sub_manager.cpp, etc.), consider using that pattern instead:- LOG(INFO) << "RedisListObject default constructor: " << this - << boost::stacktrace::stacktrace(); + DLOG(INFO) << "RedisListObject default constructor: " << this + << boost::stacktrace::stacktrace();Also note:
CommitBlockPopreturns!list_object_.empty(), which is semantically inverted compared to otherCommit*methods (CommitLPop,CommitRPop,CommitLTrim, etc.) that returnlist_object_.empty(). This inconsistency should be reviewed for correctness.
🤖 Fix all issues with AI agents
In `@src/redis_list_object.cpp`:
- Around line 1008-1011: CommitBlockPop currently returns the inverted emptiness
flag (uses !list_object_.empty()), violating the Contract of other Commit*
methods; change CommitBlockPop to return list_object_.empty() instead of its
negation and keep the LOG message accurate (you can still log size via
list_object_.size()); update the local bool result in CommitBlockPop to reflect
list_object_.empty() so callers receive the same semantics as other Commit*
functions.
In `@src/redis_service.cpp`:
- Around line 44-45: Logs currently emit raw Redis command arguments; create a
helper (e.g., FormatArgsForLog) and use it at each logging site in
src/redis_service.cpp (including the ranges noted) to redact sensitive commands
(AUTH/HELLO AUTH and any arg that looks like a password), truncate long args
(cap arg count and per-arg length like slowlog), strip/newline-escape
log-injection characters, and switch INFO-level prints to VLOG/debug where
appropriate; update calls that currently log the raw args to pass them through
FormatArgsForLog before logging.
| bool result = !list_object_.empty(); | ||
| LOG(INFO) << "CommitBlockPop exit object=" << this | ||
| << " size=" << list_object_.size(); | ||
| return result; |
There was a problem hiding this comment.
CommitBlockPop returns inverted emptiness flag.
Other Commit* methods return list_object_.empty() (true when empty). Here it returns !list_object_.empty(), which flips the contract and can mislead callers.
🐛 Proposed fix
- bool result = !list_object_.empty();
+ bool result = list_object_.empty();
LOG(INFO) << "CommitBlockPop exit object=" << this
<< " size=" << list_object_.size();
return result;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| bool result = !list_object_.empty(); | |
| LOG(INFO) << "CommitBlockPop exit object=" << this | |
| << " size=" << list_object_.size(); | |
| return result; | |
| bool result = list_object_.empty(); | |
| LOG(INFO) << "CommitBlockPop exit object=" << this | |
| << " size=" << list_object_.size(); | |
| return result; |
🤖 Prompt for AI Agents
In `@src/redis_list_object.cpp` around lines 1008 - 1011, CommitBlockPop currently
returns the inverted emptiness flag (uses !list_object_.empty()), violating the
Contract of other Commit* methods; change CommitBlockPop to return
list_object_.empty() instead of its negation and keep the LOG message accurate
(you can still log size via list_object_.size()); update the local bool result
in CommitBlockPop to reflect list_object_.empty() so callers receive the same
semantics as other Commit* functions.
| #include <sstream> | ||
| #include <string> |
There was a problem hiding this comment.
Redact/truncate command args before INFO logging.
These logs emit raw command arguments (including potential secrets like AUTH passwords or sensitive values) and can be large; they also risk log injection via newlines. Please redact sensitive commands and truncate long args, and prefer VLOG/debug-only logging.
🔒 Example fix (redaction + truncation + VLOG)
- std::ostringstream cmd_args_stream;
- cmd_args_stream << "[";
- for (size_t i = 0; i < cmd_args.size(); ++i) {
- ...
- }
- cmd_args_stream << "]";
+ auto cmd_args_str = FormatArgsForLog(cmd_args);
- LOG(INFO) << "Entering MultiExec, txm: " << txm
- << ", cmd_args: " << cmd_args_stream.str();
+ VLOG(1) << "Entering MultiExec, txm: " << txm
+ << ", cmd_args: " << cmd_args_str;- std::ostringstream args_stream;
- args_stream << "[";
- for (size_t i = 0; i < args.size(); ++i) {
- ...
- }
- args_stream << "]";
- LOG(INFO) << "DispatchCommand single command args: "
- << args_stream.str();
+ auto args_str = FormatArgsForLog(args);
+ VLOG(1) << "DispatchCommand single command args: " << args_str;(You can model FormatArgsForLog after slowlog truncation: cap args count, cap arg length, and redact for AUTH/HELLO AUTH/etc.)
Also applies to: 1853-1882, 2149-2173, 5694-5708
🤖 Prompt for AI Agents
In `@src/redis_service.cpp` around lines 44 - 45, Logs currently emit raw Redis
command arguments; create a helper (e.g., FormatArgsForLog) and use it at each
logging site in src/redis_service.cpp (including the ranges noted) to redact
sensitive commands (AUTH/HELLO AUTH and any arg that looks like a password),
truncate long args (cap arg count and per-arg length like slowlog),
strip/newline-escape log-injection characters, and switch INFO-level prints to
VLOG/debug where appropriate; update calls that currently log the raw args to
pass them through FormatArgsForLog before logging.
This branch, along with the branch of the same name in txservice, is used for standby debug builds.
Summary by CodeRabbit