Fixed TTL problems#17735
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #17735 +/- ##
============================================
+ Coverage 40.55% 40.62% +0.07%
Complexity 2574 2574
============================================
Files 5179 5179
Lines 349896 350085 +189
Branches 44727 44765 +38
============================================
+ Hits 141890 142217 +327
+ Misses 208006 207868 -138 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
CRZbulabula
left a comment
There was a problem hiding this comment.
Both the capacity-accounting and the rollback-on-DataNode-failure fixes look correct. Comments below are organized by code location and focus on the timing of state capture in SetTTLProcedure, the cost of the consensus read used to capture it, and a handful of readability/test improvements.
|



Description
This PR fixes two correctness issues in ConfigNode TTL handling.
SetTTLProceduredid not rollback TTL state when ConfigNode metadata had been updated but DataNode TTL cacheupdate failed.
Details
1. Fix TTL rule capacity accounting
TTLInfonow checks the number of newly introduced TTL rules instead of simply checking the current total rule count.This also fixes the database TTL case: setting TTL on a database effectively writes both the database path and its
**wildcard path, so capacity validation now accounts for both entries.As a result:
2. Add rollback for
SetTTLProcedureSetTTLProcedurenow captures the previous TTL state before writing the new value to ConfigNode.If the procedure fails while updating DataNode TTL cache, it will rollback:
For database TTL, the rollback also restores the wildcard TTL entry (
db.**) separately.The rollback state is serialized with the procedure so that recovery/replay can still restore the previous TTL state
correctly.
Tests
Added/updated tests for:
This PR has:
for an unfamiliar reader.
for code coverage.
Key changed/added classes (or packages if there are too many classes) in this PR