Skip to content

Commit 0d94d6e

Browse files
Calle Wilundtgrabiec
authored andcommitted
sstableloader: Handle dead liveness info (ttl == expired)
Refs scylla-enterprise#920 Liveness can (apparently) be already marked dead -> invalid ttl value. We cannot (I think) just skip the row since according to docs it serves a purpose still. We can however mark it as immedetiatly expiring (next second) and assume this will make the end result be the same even when imported (and compacted). Message-Id: <20190618152218.11389-1-calle@scylladb.com>
1 parent 1c6019a commit 0d94d6e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/java/com/scylladb/tools/SSTableToCQL.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,13 @@ private void writeUsingTTL(StringBuilder buf, Map<String, Object> params) {
607607
ensureWhitespace(buf);
608608

609609
int adjustedTTL = ttl;
610+
611+
// if the row is in fact not actually live, i.e. already explicitly
612+
// marked dead by ttl == expired, set it to a minimal value
613+
// so we can hope it expires again as soon as possible.
614+
if (adjustedTTL == LivenessInfo.EXPIRED_LIVENESS_TTL) {
615+
adjustedTTL = 1;
616+
}
610617

611618
if (timestamp == invalidTimestamp) {
612619
buf.append("USING ");
@@ -619,7 +626,7 @@ private void writeUsingTTL(StringBuilder buf, Map<String, Object> params) {
619626
if (exp < now) {
620627
adjustedTTL = 1; // 0 -> no ttl. 1 should disappear fast enoug
621628
} else {
622-
adjustedTTL = (int)Math.min(ttl, exp - now);
629+
adjustedTTL = (int)Math.min(adjustedTTL, exp - now);
623630
}
624631
}
625632
buf.append(" TTL :" + TTL_VAR_NAME);

0 commit comments

Comments
 (0)