CRZbulabula commented on code in PR #17735:
URL: https://github.com/apache/iotdb/pull/17735#discussion_r3279235950
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/TTLInfo.java:
##########
@@ -70,7 +70,8 @@ public TSStatus setTTL(SetTTLPlan plan) {
try {
// check ttl rule capacity
final int tTlRuleCapacity =
CommonDescriptor.getInstance().getConfig().getTTlRuleCapacity();
- if (getTTLCount() >= tTlRuleCapacity) {
+ final int newTTLRuleCount = calculateNewTTLRuleCount(plan);
+ if (newTTLRuleCount > 0 && ttlCache.getTtlCount() + newTTLRuleCount >
tTlRuleCapacity) {
Review Comment:
**容量校验逻辑修正得很到位**:`newTTLRuleCount > 0` 短路了「更新现有规则」的场景,这正好让
`testUpdateExistingTTLWhenCurrentStateIsAlreadyOversize` 中「当前已超量但只是 update」也能成功。
一个边界值得确认:当 `tTlRuleCapacity` 被运维下调到 0 时(异常配置),`newTTLRuleCount > 0`
仍会拒绝任何新建,这是期望的行为;但建议在错误消息里把 `tTlRuleCapacity` 与 `ttlCache.getTtlCount() +
newTTLRuleCount` 都打出来,便于现场排查到底是「容量被调小」还是「真的写满了」。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]