fix tombstone collectable test (#4755)

Summary:
the original test does not give enough time difference between tombstone write time and the expire time point, which make test flaky.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4755

Reviewed By: maysamyabandeh

Differential Revision: D13369681

Pulled By: wpc

fbshipit-source-id: 22576f354c63cd0b39d8b35c3913303707503ea9
This commit is contained in:
Pengchao Wang 2018-12-07 10:11:37 -08:00 committed by Facebook Github Bot
parent b878f93c70
commit c41c60be13

View File

@ -125,13 +125,14 @@ TEST(ExpiringColumnTest, ExpiringColumn) {
TEST(TombstoneTest, TombstoneCollectable) { TEST(TombstoneTest, TombstoneCollectable) {
int32_t now = (int32_t)time(nullptr); int32_t now = (int32_t)time(nullptr);
int32_t gc_grace_seconds = 16440; int32_t gc_grace_seconds = 16440;
int32_t time_delta_seconds = 10;
EXPECT_TRUE(Tombstone(ColumnTypeMask::DELETION_MASK, 0, EXPECT_TRUE(Tombstone(ColumnTypeMask::DELETION_MASK, 0,
now - gc_grace_seconds, now - gc_grace_seconds - time_delta_seconds,
ToMicroSeconds(now - gc_grace_seconds)) ToMicroSeconds(now - gc_grace_seconds - time_delta_seconds))
.Collectable(gc_grace_seconds)); .Collectable(gc_grace_seconds));
EXPECT_FALSE(Tombstone(ColumnTypeMask::DELETION_MASK, 0, EXPECT_FALSE(Tombstone(ColumnTypeMask::DELETION_MASK, 0,
now - gc_grace_seconds + 1, now - gc_grace_seconds + time_delta_seconds,
ToMicroSeconds(now - gc_grace_seconds + 1)) ToMicroSeconds(now - gc_grace_seconds + time_delta_seconds))
.Collectable(gc_grace_seconds)); .Collectable(gc_grace_seconds));
} }