Skip to content

Standby debug build.#426

Draft
MrGuin wants to merge 2 commits intoeloqdata:mainfrom
MrGuin:standby_debug
Draft

Standby debug build.#426
MrGuin wants to merge 2 commits intoeloqdata:mainfrom
MrGuin:standby_debug

Conversation

@MrGuin
Copy link
Collaborator

@MrGuin MrGuin commented Feb 6, 2026

This branch, along with the branch of the same name in txservice, is used for standby debug builds.

Summary by CodeRabbit

  • Chores
    • Enhanced diagnostic logging for Redis list operations, transaction handling, and command dispatch
    • Added stack trace information to improve debugging and troubleshooting capabilities
    • Updated subproject reference

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Walkthrough

Updates 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

Cohort / File(s) Summary
Subproject Reference
data_substrate
Subproject reference updated from f08f56d27fd80f97cd45df73228dcc6782545128 to dbf9caeffc80103517ec35ef4c0a16a45afff89a.
Destructor Declaration
include/redis_list_object.h
RedisListObject public destructor changed from defaulted (= default) to explicit declaration (override;), requiring explicit definition elsewhere.
Logging & Lifecycle Management
src/redis_list_object.cpp
Added explicit destructor definition with logging; introduced boost::stacktrace.hpp include and INFO-level lifecycle logs for constructors/destructor; added verbose logging with object addresses and sizes in various commit operations (LInsert, LSet, RPush, LPush, LPop, RPop, LMove, LTrim, LRem, BlockPop).
Transaction & Dispatch Logging
src/redis_service.cpp
Added sstream include and enhanced logging with human-readable nested command argument serialization; augmented MultiExec and DispatchCommand logging to capture transaction lifecycle (entry, error, success); expanded ExecuteTxRequest logging for auto-commit transaction outcomes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested labels

trigger-ci

Suggested reviewers

  • liunyl
  • thweetkomputer

Poem

🐰 A destructor now stands, explicit and clear,
With stacktraces woven through logs without fear,
Each operation now whispers its tale,
From Redis lists to transactions that sail,
Diagnostics and traces—our logging prevail! 📜✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Standby debug build' is vague and generic, using non-descriptive terms that don't clearly convey what changes are being made or why. Use a more descriptive title that explains the main changes, such as 'Add verbose logging and stack traces to RedisListObject lifecycle' or similar to clarify the purpose of these modifications.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MrGuin MrGuin marked this pull request as draft February 6, 2026 08:34
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 | 🟡 Minor

Gate stacktrace logging in constructors/destructor to reduce overhead.

The boost::stacktrace calls in the default, copy, and move constructors and destructor (lines 41, 49, 65, 73) can be costly in production. Since the codebase uses DLOG(INFO) for debug-level logging (see redis_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: CommitBlockPop returns !list_object_.empty(), which is semantically inverted compared to other Commit* methods (CommitLPop, CommitRPop, CommitLTrim, etc.) that return list_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.

Comment on lines +1008 to +1011
bool result = !list_object_.empty();
LOG(INFO) << "CommitBlockPop exit object=" << this
<< " size=" << list_object_.size();
return result;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
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.

Comment on lines +44 to 45
#include <sstream>
#include <string>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

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.

1 participant