From c0fd93869cb7660acae4dd2f9c6d389675e224b8 Mon Sep 17 00:00:00 2001
From: sfc-gh-tclinkenbeard <trevor.clinkenbeard@snowflake.com>
Date: Thu, 15 Sep 2022 11:48:04 -0700
Subject: [PATCH] Add probe::assert::rocksDB code probe annotation

---
 fdbserver/SimulatedCluster.actor.cpp | 4 ++--
 flow/CodeProbe.cpp                   | 8 ++++++++
 flow/include/flow/CodeProbe.h        | 5 +++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/fdbserver/SimulatedCluster.actor.cpp b/fdbserver/SimulatedCluster.actor.cpp
index 513990c581..c223f22c0d 100644
--- a/fdbserver/SimulatedCluster.actor.cpp
+++ b/fdbserver/SimulatedCluster.actor.cpp
@@ -1461,7 +1461,7 @@ void SimulationConfig::setStorageEngine(const TestConfig& testConfig) {
 		break;
 	}
 	case 4: {
-		CODE_PROBE(true, "Simulated cluster using RocksDB storage engine");
+		CODE_PROBE(true, "Simulated cluster using RocksDB storage engine", probe::assert::rocksDB);
 		set_config("ssd-rocksdb-v1");
 		// Tests using the RocksDB engine are necessarily non-deterministic because of RocksDB
 		// background threads.
@@ -1471,7 +1471,7 @@ void SimulationConfig::setStorageEngine(const TestConfig& testConfig) {
 		break;
 	}
 	case 5: {
-		CODE_PROBE(true, "Simulated cluster using Sharded RocksDB storage engine");
+		CODE_PROBE(true, "Simulated cluster using Sharded RocksDB storage engine", probe::assert::rocksDB);
 		set_config("ssd-sharded-rocksdb");
 		// Tests using the RocksDB engine are necessarily non-deterministic because of RocksDB
 		// background threads.
diff --git a/flow/CodeProbe.cpp b/flow/CodeProbe.cpp
index b5c1c9d2ea..425aa8929d 100644
--- a/flow/CodeProbe.cpp
+++ b/flow/CodeProbe.cpp
@@ -288,6 +288,14 @@ bool SimOnly::operator()(ICodeProbe* self) const {
 	return g_network->isSimulated();
 }
 
+bool RocksDB::operator()(ICodeProbe* self) const {
+#ifdef SSD_ROCKSDB_EXPERIMENTAL
+	return true;
+#else
+	return false;
+#endif
+}
+
 } // namespace assert
 
 } // namespace probe
diff --git a/flow/include/flow/CodeProbe.h b/flow/include/flow/CodeProbe.h
index 4c41470238..cf0ba436f5 100644
--- a/flow/include/flow/CodeProbe.h
+++ b/flow/include/flow/CodeProbe.h
@@ -70,6 +70,10 @@ struct SimOnly {
 	constexpr static AnnotationType type = AnnotationType::Assertion;
 	bool operator()(ICodeProbe* self) const;
 };
+struct RocksDB {
+	constexpr static AnnotationType type = AnnotationType::Assertion;
+	bool operator()(ICodeProbe* self) const;
+};
 
 template <class Left, class Right>
 struct AssertOr {
@@ -111,6 +115,7 @@ constexpr std::enable_if_t<T::type == AnnotationType::Assertion, AssertNot<T>> o
 
 constexpr SimOnly simOnly;
 constexpr auto noSim = !simOnly;
+constexpr RocksDB rocksDB;
 
 } // namespace assert