-
Notifications
You must be signed in to change notification settings - Fork 13
feat: add diagnostic Redis TTL bypass #546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /** | ||
| * Copyright (C) 2026 EloqData Inc. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under either of the following two licenses: | ||
| * 1. GNU Affero General Public License, version 3, as published by the Free | ||
| * Software Foundation. | ||
| * 2. GNU General Public License as published by the Free Software | ||
| * Foundation; version 2 of the License. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <gflags/gflags_declare.h> | ||
|
|
||
| #if defined(DATA_STORE_TYPE_ELOQDSS_ROCKSDB) || \ | ||
| defined(DATA_STORE_TYPE_ELOQDSS_ROCKSDB_CLOUD_S3) || \ | ||
| defined(DATA_STORE_TYPE_ELOQDSS_ROCKSDB_CLOUD_GCS) | ||
| DECLARE_bool(ignore_redis_ttl); | ||
| #endif | ||
|
|
||
| namespace EloqDS | ||
| { | ||
| /** | ||
| * Returns whether RocksDB-backed EloqDSS should preserve and expose expired | ||
| * EloqKV records for diagnostics. Non-RocksDB builds always return false. | ||
| */ | ||
| inline bool IgnoreRedisTTL() | ||
| { | ||
| #if defined(DATA_STORE_TYPE_ELOQDSS_ROCKSDB) || \ | ||
| defined(DATA_STORE_TYPE_ELOQDSS_ROCKSDB_CLOUD_S3) || \ | ||
| defined(DATA_STORE_TYPE_ELOQDSS_ROCKSDB_CLOUD_GCS) | ||
| return FLAGS_ignore_redis_ttl; | ||
| #else | ||
| return false; | ||
| #endif | ||
| } | ||
| } // namespace EloqDS |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <catch2/catch_all.hpp> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // clang-format on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include "eloq_data_store_service/ignore_redis_ttl.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include "eloq_data_store_service/rocksdb_data_store_common.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -55,10 +56,19 @@ TEST_CASE( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SECTION("expired TTL value is removed") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FLAGS_ignore_redis_ttl = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const std::string value = MakeValue(EloqDS::MSB | 42, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| REQUIRE(ShouldFilter(value, kCompactionTimestamp)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SECTION("expired TTL value is retained in diagnostic mode") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FLAGS_ignore_redis_ttl = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const std::string value = MakeValue(EloqDS::MSB | 42, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| REQUIRE_FALSE(ShouldFilter(value, kCompactionTimestamp)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FLAGS_ignore_redis_ttl = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+59
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Restore If Proposed test isolation fix+class ScopedIgnoreRedisTTLFlag
+{
+ public:
+ explicit ScopedIgnoreRedisTTLFlag(bool value)
+ : previous_value_(FLAGS_ignore_redis_ttl)
+ {
+ FLAGS_ignore_redis_ttl = value;
+ }
+
+ ~ScopedIgnoreRedisTTLFlag()
+ {
+ FLAGS_ignore_redis_ttl = previous_value_;
+ }
+
+ private:
+ bool previous_value_;
+};
+
- FLAGS_ignore_redis_ttl = false;
+ ScopedIgnoreRedisTTLFlag ttl_flag(false);
const std::string value = MakeValue(EloqDS::MSB | 42, 1);
REQUIRE(ShouldFilter(value, kCompactionTimestamp));
- FLAGS_ignore_redis_ttl = true;
+ ScopedIgnoreRedisTTLFlag ttl_flag(true);
const std::string value = MakeValue(EloqDS::MSB | 42, 1);
REQUIRE_FALSE(ShouldFilter(value, kCompactionTimestamp));
- FLAGS_ignore_redis_ttl = false;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SECTION("unexpired TTL value is retained") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const std::string value = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Document command-line precedence.
An explicit
--ignore_redis_ttlvalue overrides[store] ignore_redis_ttl. State this rule, including that--ignore_redis_ttl=falseoverrides an INI value oftrue.As per coding guidelines, document non-obvious operational constraints and explain why.
🤖 Prompt for AI Agents
Source: Coding guidelines