From aedc6fc349789d49893d6943b2a724419db6c34d Mon Sep 17 00:00:00 2001 From: "A.J. Beamon" Date: Sun, 7 Aug 2022 06:45:39 -0700 Subject: [PATCH] Fix a bug in a storage wiggler unit test where some servers were added with too recent a timestamp --- fdbclient/include/fdbclient/FDBTypes.h | 2 +- fdbserver/DataDistribution.actor.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fdbclient/include/fdbclient/FDBTypes.h b/fdbclient/include/fdbclient/FDBTypes.h index 704896872b..e1ef897ff6 100644 --- a/fdbclient/include/fdbclient/FDBTypes.h +++ b/fdbclient/include/fdbclient/FDBTypes.h @@ -1465,7 +1465,7 @@ struct StorageMetadataType { bool wrongConfigured = false; StorageMetadataType() : createdTime(0) {} - StorageMetadataType(uint64_t t, KeyValueStoreType storeType = KeyValueStoreType::END, bool wrongConfigured = false) + StorageMetadataType(double t, KeyValueStoreType storeType = KeyValueStoreType::END, bool wrongConfigured = false) : createdTime(t), storeType(storeType), wrongConfigured(wrongConfigured) {} static double currentTime() { return g_network->timer(); } diff --git a/fdbserver/DataDistribution.actor.cpp b/fdbserver/DataDistribution.actor.cpp index 971d7bc9a5..efbcb7bde1 100644 --- a/fdbserver/DataDistribution.actor.cpp +++ b/fdbserver/DataDistribution.actor.cpp @@ -1395,10 +1395,11 @@ inline DDShardInfo doubleToNoLocationShardInfo(double d, bool hasDest) { TEST_CASE("/DataDistribution/StorageWiggler/Order") { StorageWiggler wiggler(nullptr); - wiggler.addServer(UID(1, 0), StorageMetadataType(1, KeyValueStoreType::SSD_BTREE_V2)); - wiggler.addServer(UID(2, 0), StorageMetadataType(2, KeyValueStoreType::MEMORY, true)); - wiggler.addServer(UID(3, 0), StorageMetadataType(3, KeyValueStoreType::SSD_ROCKSDB_V1, true)); - wiggler.addServer(UID(4, 0), StorageMetadataType(4, KeyValueStoreType::SSD_BTREE_V2)); + double startTime = now() - SERVER_KNOBS->DD_STORAGE_WIGGLE_MIN_SS_AGE_SEC - 0.4; + wiggler.addServer(UID(1, 0), StorageMetadataType(startTime, KeyValueStoreType::SSD_BTREE_V2)); + wiggler.addServer(UID(2, 0), StorageMetadataType(startTime + 0.1, KeyValueStoreType::MEMORY, true)); + wiggler.addServer(UID(3, 0), StorageMetadataType(startTime + 0.2, KeyValueStoreType::SSD_ROCKSDB_V1, true)); + wiggler.addServer(UID(4, 0), StorageMetadataType(startTime + 0.3, KeyValueStoreType::SSD_BTREE_V2)); std::vector correctOrder{ UID(2, 0), UID(3, 0), UID(1, 0), UID(4, 0) }; for (int i = 0; i < correctOrder.size(); ++i) {