Fix flaky CassandraFunctionalTest...ExpiredColumnsToTombstone (#9226)
Summary: You could easily reproduce the failure by injecting sleep(11) before `store.Flush()`. Fixed by setting TTL time to approximately test timeout time. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9226 Test Plan: manual Reviewed By: akankshamahajan15 Differential Revision: D32698105 Pulled By: pdillinger fbshipit-source-id: 40529af9d9f2389585988b7c81dffb120e2795a2
This commit is contained in:
parent
2a67d475f1
commit
735fe61e8f
@ -182,16 +182,22 @@ TEST_F(CassandraFunctionalTest, SimpleMergeTest) {
|
|||||||
ToMicroSeconds(now + 11));
|
ToMicroSeconds(now + 11));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr int64_t kTestTimeoutSecs = 600;
|
||||||
|
|
||||||
TEST_F(CassandraFunctionalTest,
|
TEST_F(CassandraFunctionalTest,
|
||||||
CompactionShouldConvertExpiredColumnsToTombstone) {
|
CompactionShouldConvertExpiredColumnsToTombstone) {
|
||||||
CassandraStore store(OpenDb());
|
CassandraStore store(OpenDb());
|
||||||
int64_t now= time(nullptr);
|
int64_t now= time(nullptr);
|
||||||
|
|
||||||
store.Append("k1", CreateTestRowValue({
|
store.Append(
|
||||||
CreateTestColumnSpec(kExpiringColumn, 0, ToMicroSeconds(now - kTtl - 20)), //expired
|
"k1",
|
||||||
CreateTestColumnSpec(kExpiringColumn, 1, ToMicroSeconds(now - kTtl + 10)), // not expired
|
CreateTestRowValue(
|
||||||
CreateTestColumnSpec(kTombstone, 3, ToMicroSeconds(now))
|
{CreateTestColumnSpec(kExpiringColumn, 0,
|
||||||
}));
|
ToMicroSeconds(now - kTtl - 20)), // expired
|
||||||
|
CreateTestColumnSpec(
|
||||||
|
kExpiringColumn, 1,
|
||||||
|
ToMicroSeconds(now - kTtl + kTestTimeoutSecs)), // not expired
|
||||||
|
CreateTestColumnSpec(kTombstone, 3, ToMicroSeconds(now))}));
|
||||||
|
|
||||||
ASSERT_OK(store.Flush());
|
ASSERT_OK(store.Flush());
|
||||||
|
|
||||||
@ -210,7 +216,7 @@ TEST_F(CassandraFunctionalTest,
|
|||||||
VerifyRowValueColumns(merged.get_columns(), 0, kTombstone, 0,
|
VerifyRowValueColumns(merged.get_columns(), 0, kTombstone, 0,
|
||||||
ToMicroSeconds(now - 10));
|
ToMicroSeconds(now - 10));
|
||||||
VerifyRowValueColumns(merged.get_columns(), 1, kExpiringColumn, 1,
|
VerifyRowValueColumns(merged.get_columns(), 1, kExpiringColumn, 1,
|
||||||
ToMicroSeconds(now - kTtl + 10));
|
ToMicroSeconds(now - kTtl + kTestTimeoutSecs));
|
||||||
VerifyRowValueColumns(merged.get_columns(), 2, kColumn, 2,
|
VerifyRowValueColumns(merged.get_columns(), 2, kColumn, 2,
|
||||||
ToMicroSeconds(now));
|
ToMicroSeconds(now));
|
||||||
VerifyRowValueColumns(merged.get_columns(), 3, kTombstone, 3,
|
VerifyRowValueColumns(merged.get_columns(), 3, kTombstone, 3,
|
||||||
|
Loading…
Reference in New Issue
Block a user