diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index c8e7118fef..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,7 +1063,7 @@ ACTOR Future watchValue_impl( StorageServer* data, WatchValueRequest req ) } ++data->numWatches; - data->watchBytes += ( req.key.expectedSize() + req.value.expectedSize() + 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 ) {