Skip to content

Commit 4bda00a

Browse files
dlambrigDan Lambright
andauthored
use unique pointer (#11408)
Co-authored-by: Dan Lambright <[email protected]>
1 parent c97f8dd commit 4bda00a

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

fdbserver/GrvProxyServer.actor.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ struct GrvProxyData {
199199
Optional<LatencyBandConfig> latencyBandConfig;
200200
double lastStartCommit;
201201
double lastCommitLatency;
202-
LatencySample* versionVectorSizeOnGRVReply = nullptr;
202+
std::unique_ptr<LatencySample> versionVectorSizeOnGRVReply;
203203
int updateCommitRequests;
204204
NotifiedDouble lastCommitTime;
205205

@@ -238,10 +238,11 @@ struct GrvProxyData {
238238
version(0), minKnownCommittedVersion(invalidVersion),
239239
tagThrottler(CLIENT_KNOBS->PROXY_MAX_TAG_THROTTLE_DURATION) {
240240
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR) {
241-
versionVectorSizeOnGRVReply = new LatencySample("VersionVectorSizeOnGRVReply",
242-
dbgid,
243-
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
244-
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
241+
versionVectorSizeOnGRVReply =
242+
std::make_unique<LatencySample>("VersionVectorSizeOnGRVReply",
243+
dbgid,
244+
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
245+
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
245246
}
246247
}
247248
};

fdbserver/include/fdbserver/MasterData.actor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ struct SWIFT_CXX_REF_MASTERDATA MasterData : NonCopyable, ReferenceCounted<Maste
127127
CounterValue reportLiveCommittedVersionRequests;
128128
// This counter gives an estimate of the number of non-empty peeks that storage servers
129129
// should do from tlogs (in the worst case, ignoring blocking peek timeouts).
130-
LatencySample* versionVectorTagUpdates = nullptr;
130+
std::unique_ptr<LatencySample> versionVectorTagUpdates;
131131
CounterValue waitForPrevCommitRequests;
132132
CounterValue nonWaitForPrevCommitRequests;
133-
LatencySample* versionVectorSizeOnCVReply = nullptr;
134-
LatencySample* waitForPrevLatencies = nullptr;
133+
std::unique_ptr<LatencySample> versionVectorSizeOnCVReply;
134+
std::unique_ptr<LatencySample> waitForPrevLatencies;
135135

136136
PromiseStream<Future<Void>> addActor;
137137

fdbserver/masterserver.actor.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,18 @@ MasterData::MasterData(Reference<AsyncVar<ServerDBInfo> const> const& dbInfo,
273273
locality = tagLocalityInvalid;
274274

275275
if (SERVER_KNOBS->ENABLE_VERSION_VECTOR) {
276-
versionVectorTagUpdates = new LatencySample("VersionVectorTagUpdates",
277-
dbgid,
278-
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
279-
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
280-
versionVectorSizeOnCVReply = new LatencySample("VersionVectorSizeOnCVReply",
281-
dbgid,
282-
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
283-
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
284-
waitForPrevLatencies = new LatencySample("WaitForPrevLatencies",
285-
dbgid,
286-
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
287-
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
276+
versionVectorTagUpdates = std::make_unique<LatencySample>("VersionVectorTagUpdates",
277+
dbgid,
278+
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
279+
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
280+
versionVectorSizeOnCVReply = std::make_unique<LatencySample>("VersionVectorSizeOnCVReply",
281+
dbgid,
282+
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
283+
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
284+
waitForPrevLatencies = std::make_unique<LatencySample>("WaitForPrevLatencies",
285+
dbgid,
286+
SERVER_KNOBS->LATENCY_METRICS_LOGGING_INTERVAL,
287+
SERVER_KNOBS->LATENCY_SKETCH_ACCURACY);
288288
}
289289

290290
#ifdef WITH_SWIFT

0 commit comments

Comments
 (0)