Merge remote-tracking branch 'origin/main' into arena-get-size-boolean-param

This commit is contained in:
sfc-gh-tclinkenbeard 2022-03-16 22:53:30 -07:00
commit 44b0e05538
3 changed files with 51 additions and 11 deletions

View File

@ -2223,6 +2223,25 @@ ACTOR Future<Void> storageCacheServer(StorageServerInterface ssi,
when(ReplyPromise<KeyValueStoreType> reply = waitNext(ssi.getKeyValueStoreType.getFuture())) {
ASSERT(false);
}
when(GetMappedKeyValuesRequest req = waitNext(ssi.getMappedKeyValues.getFuture())) { ASSERT(false); }
when(WaitMetricsRequest req = waitNext(ssi.waitMetrics.getFuture())) { ASSERT(false); }
when(SplitMetricsRequest req = waitNext(ssi.splitMetrics.getFuture())) { ASSERT(false); }
when(GetStorageMetricsRequest req = waitNext(ssi.getStorageMetrics.getFuture())) { ASSERT(false); }
when(ReadHotSubRangeRequest req = waitNext(ssi.getReadHotRanges.getFuture())) { ASSERT(false); }
when(SplitRangeRequest req = waitNext(ssi.getRangeSplitPoints.getFuture())) { ASSERT(false); }
when(GetKeyValuesStreamRequest req = waitNext(ssi.getKeyValuesStream.getFuture())) { ASSERT(false); }
when(ChangeFeedStreamRequest req = waitNext(ssi.changeFeedStream.getFuture())) { ASSERT(false); }
when(OverlappingChangeFeedsRequest req = waitNext(ssi.overlappingChangeFeeds.getFuture())) {
// Simulate endpoint not found so that the requester will try another endpoint
// This is a workaround to the fact that storage servers do not have an easy way to enforce this
// request goes only to other storage servers, and in simulation we manage to trigger this behavior
req.reply.sendError(broken_promise());
}
when(ChangeFeedPopRequest req = waitNext(ssi.changeFeedPop.getFuture())) { ASSERT(false); }
when(ChangeFeedVersionUpdateRequest req = waitNext(ssi.changeFeedVersionUpdate.getFuture())) {
ASSERT(false);
}
when(wait(actors.getResult())) {}
}
}

View File

@ -678,6 +678,7 @@ TEST_CASE("/flow/Arena/DefaultBoostHash") {
TEST_CASE("/flow/Arena/Size") {
Arena a;
int fastSize, slowSize;
// Size estimates are accurate unless dependencies are added to an Arena via another Arena
// handle which points to a non-root node.
@ -685,10 +686,14 @@ TEST_CASE("/flow/Arena/Size") {
// Note that the ASSERT argument order matters, the estimate must be calculated first as
// the full accurate calculation will update the estimate
makeString(40, a);
ASSERT_EQ(a.getSize(FastInaccurateEstimate::True), a.getSize());
fastSize = a.getSize(FastInaccurateEstimate::True);
slowSize = a.getSize();
ASSERT_EQ(fastSize, slowSize);
makeString(700, a);
ASSERT_EQ(a.getSize(FastInaccurateEstimate::True), a.getSize());
fastSize = a.getSize(FastInaccurateEstimate::True);
slowSize = a.getSize();
ASSERT_EQ(fastSize, slowSize);
// Copy a at a point where it points to a large block with room for block references
Arena b = a;
@ -699,35 +704,51 @@ TEST_CASE("/flow/Arena/Size") {
makeString(1000, a);
makeString(1000, a);
ASSERT_EQ(a.getSize(FastInaccurateEstimate::True), a.getSize());
fastSize = a.getSize(FastInaccurateEstimate::True);
slowSize = a.getSize();
ASSERT_EQ(fastSize, slowSize);
Standalone<StringRef> s = makeString(500);
a.dependsOn(s.arena());
ASSERT_EQ(a.getSize(FastInaccurateEstimate::True), a.getSize());
fastSize = a.getSize(FastInaccurateEstimate::True);
slowSize = a.getSize();
ASSERT_EQ(fastSize, slowSize);
Standalone<StringRef> s2 = makeString(500);
a.dependsOn(s2.arena());
ASSERT_EQ(a.getSize(FastInaccurateEstimate::True), a.getSize());
fastSize = a.getSize(FastInaccurateEstimate::True);
slowSize = a.getSize();
ASSERT_EQ(fastSize, slowSize);
// Add a dependency to b, which will fit in b's root and update b's size estimate
Standalone<StringRef> s3 = makeString(100);
b.dependsOn(s3.arena());
ASSERT_EQ(b.getSize(FastInaccurateEstimate::True), b.getSize());
fastSize = b.getSize(FastInaccurateEstimate::True);
slowSize = b.getSize();
ASSERT_EQ(fastSize, slowSize);
// But now a's size estimate is out of date because the new reference in b's root is still
// in a's tree
ASSERT_LT(a.getSize(FastInaccurateEstimate::True), a.getSize());
fastSize = a.getSize(FastInaccurateEstimate::True);
slowSize = a.getSize();
ASSERT_LT(fastSize, slowSize);
// Now that a full size calc has been done on a, the estimate is up to date.
ASSERT_EQ(a.getSize(FastInaccurateEstimate::True), a.getSize());
fastSize = a.getSize(FastInaccurateEstimate::True);
slowSize = a.getSize();
ASSERT_EQ(fastSize, slowSize);
// Add a dependency to c, which will NOT fit in c's root, so it will be added to a new
// root for c and that root will not be in a's tree so a's size and estimate remain
// unchanged and the same. The size and estimate of c will also match.
Standalone<StringRef> s4 = makeString(100);
c.dependsOn(s4.arena());
ASSERT_EQ(c.getSize(FastInaccurateEstimate::True), c.getSize());
ASSERT_EQ(a.getSize(FastInaccurateEstimate::True), a.getSize());
fastSize = c.getSize(FastInaccurateEstimate::True);
slowSize = c.getSize();
ASSERT_EQ(fastSize, slowSize);
fastSize = a.getSize(FastInaccurateEstimate::True);
slowSize = a.getSize();
ASSERT_EQ(fastSize, slowSize);
return Void();
}

View File

@ -12,5 +12,5 @@ testTitle = 'Cycle'
testName = 'Cycle'
transactionsPerSecond = 2500.0
testDuration = 10.0
expectedRate = 0.80
expectedRate = 0.01
keyPrefix = 'foo/'