From 90984467c85c2306a8d6ae94d3785b39c1dcec5c Mon Sep 17 00:00:00 2001 From: sfc-gh-tclinkenbeard Date: Tue, 8 Sep 2020 14:57:39 -0700 Subject: [PATCH 1/2] Add comments for WATCH_OVERHEAD_BYTES --- fdbserver/storageserver.actor.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index c8e7118fef..3faed41df3 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -1058,7 +1058,12 @@ ACTOR Future watchValue_impl( StorageServer* data, WatchValueRequest req ) } ++data->numWatches; - data->watchBytes += ( req.key.expectedSize() + req.value.expectedSize() + 1000 ); + + // Pessimistic estimate the number of overhead bytes used by each + // watch. Watch key references are stored in an AsyncMap, and actors + // must be kept alive until the watch is finished. + state size_t WATCH_OVERHEAD_BYTES = 1000; + data->watchBytes += (req.key.expectedSize() + req.value.expectedSize() + WATCH_OVERHEAD_BYTES); try { if(latest < minVersion) { // If the version we read is less than minVersion, then we may fail to be notified of any changes that occur up to or including minVersion @@ -1071,10 +1076,10 @@ ACTOR Future watchValue_impl( StorageServer* data, WatchValueRequest req ) } wait(watchFuture); --data->numWatches; - data->watchBytes -= ( req.key.expectedSize() + req.value.expectedSize() + 1000 ); + data->watchBytes -= (req.key.expectedSize() + req.value.expectedSize() + WATCH_OVERHEAD_BYTES); } catch( Error &e ) { --data->numWatches; - data->watchBytes -= ( req.key.expectedSize() + req.value.expectedSize() + 1000 ); + data->watchBytes -= (req.key.expectedSize() + req.value.expectedSize() + WATCH_OVERHEAD_BYTES); throw; } } catch( Error &e ) { From 2ce81a3c4440517898e9653be195b6880387e97b Mon Sep 17 00:00:00 2001 From: sfc-gh-tclinkenbeard Date: Wed, 9 Sep 2020 10:35:42 -0700 Subject: [PATCH 2/2] Make WATCH_OVERHEAD_BYTES constexpr --- fdbserver/storageserver.actor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index 3faed41df3..336381761a 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -1011,6 +1011,11 @@ ACTOR Future getValueQ( StorageServer* data, GetValueRequest req ) { return Void(); }; +// Pessimistic estimate the number of overhead bytes used by each +// watch. Watch key references are stored in an AsyncMap, and actors +// must be kept alive until the watch is finished. +static constexpr size_t WATCH_OVERHEAD_BYTES = 1000; + ACTOR Future watchValue_impl( StorageServer* data, WatchValueRequest req ) { try { ++data->counters.watchQueries; @@ -1058,11 +1063,6 @@ ACTOR Future watchValue_impl( StorageServer* data, WatchValueRequest req ) } ++data->numWatches; - - // Pessimistic estimate the number of overhead bytes used by each - // watch. Watch key references are stored in an AsyncMap, and actors - // must be kept alive until the watch is finished. - state size_t WATCH_OVERHEAD_BYTES = 1000; data->watchBytes += (req.key.expectedSize() + req.value.expectedSize() + WATCH_OVERHEAD_BYTES); try { if(latest < minVersion) {