From 37d9e975e9abcac6070e59476fe12e9c92871b09 Mon Sep 17 00:00:00 2001 From: Markus Pilman Date: Wed, 3 Mar 2021 10:18:03 -0700 Subject: [PATCH] Fix multiple compiler warnings --- fdbclient/MultiVersionTransaction.actor.cpp | 2 +- fdbclient/MultiVersionTransaction.h | 1 - fdbclient/SystemData.cpp | 6 +++--- fdbserver/BackupProgress.actor.cpp | 2 +- fdbserver/BackupWorker.actor.cpp | 6 +++--- fdbserver/MasterProxyServer.actor.cpp | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/fdbclient/MultiVersionTransaction.actor.cpp b/fdbclient/MultiVersionTransaction.actor.cpp index 6a931e9cd2..695510fb75 100644 --- a/fdbclient/MultiVersionTransaction.actor.cpp +++ b/fdbclient/MultiVersionTransaction.actor.cpp @@ -697,7 +697,7 @@ void MultiVersionTransaction::reset() { // MultiVersionDatabase MultiVersionDatabase::MultiVersionDatabase(MultiVersionApi* api, int threadIdx, std::string clusterFilePath, Reference db, bool openConnectors) - : dbState(new DatabaseState()), threadIdx(threadIdx) { + : dbState(new DatabaseState()) { dbState->db = db; dbState->dbVar->set(db); diff --git a/fdbclient/MultiVersionTransaction.h b/fdbclient/MultiVersionTransaction.h index 4a3fb0a9a3..f17925eb73 100644 --- a/fdbclient/MultiVersionTransaction.h +++ b/fdbclient/MultiVersionTransaction.h @@ -369,7 +369,6 @@ private: }; const Reference dbState; - const int threadIdx; friend class MultiVersionTransaction; }; diff --git a/fdbclient/SystemData.cpp b/fdbclient/SystemData.cpp index 3b8845d0aa..f150dc0a78 100644 --- a/fdbclient/SystemData.cpp +++ b/fdbclient/SystemData.cpp @@ -55,7 +55,7 @@ const Value keyServersValue( Standalone result, const std::vecto std::vector destTag; bool foundOldLocality = false; - for (const KeyValueRef kv : result) { + for (const KeyValueRef& kv : result) { UID uid = decodeServerTagKey(kv.key); if (std::find(src.begin(), src.end(), uid) != src.end()) { srcTag.push_back( decodeServerTagValue(kv.value) ); @@ -107,7 +107,7 @@ void decodeKeyServersValue( Standalone result, const ValueRef& v src.clear(); dest.clear(); - for (const KeyValueRef kv : result) { + for (const KeyValueRef& kv : result) { Tag tag = decodeServerTagValue(kv.value); if (std::find(srcTag.begin(), srcTag.end(), tag) != srcTag.end()) { src.push_back( decodeServerTagKey(kv.key) ); @@ -120,7 +120,7 @@ void decodeKeyServersValue( Standalone result, const ValueRef& v std::sort(dest.begin(), dest.end()); if(missingIsError && (src.size() != srcTag.size() || dest.size() != destTag.size())) { TraceEvent(SevError, "AttemptedToDecodeMissingTag"); - for (const KeyValueRef kv : result) { + for (const KeyValueRef& kv : result) { Tag tag = decodeServerTagValue(kv.value); UID serverID = decodeServerTagKey(kv.key); TraceEvent("TagUIDMap").detail("Tag", tag.toString()).detail("UID", serverID.toString()); diff --git a/fdbserver/BackupProgress.actor.cpp b/fdbserver/BackupProgress.actor.cpp index 3f1d564c16..f496ec0558 100644 --- a/fdbserver/BackupProgress.actor.cpp +++ b/fdbserver/BackupProgress.actor.cpp @@ -121,7 +121,7 @@ std::map, std::map> BackupProgr } } - for (const Tag tag : tags) { // tags without progress data + for (const Tag& tag : tags) { // tags without progress data tagVersions.insert({ tag, adjustedBeginVersion }); TraceEvent("BackupVersionRange", dbgid) .detail("OldEpoch", epoch) diff --git a/fdbserver/BackupWorker.actor.cpp b/fdbserver/BackupWorker.actor.cpp index bf71892934..cf18776d48 100644 --- a/fdbserver/BackupWorker.actor.cpp +++ b/fdbserver/BackupWorker.actor.cpp @@ -504,7 +504,7 @@ ACTOR Future setBackupKeys(BackupData* self, std::map savedL state std::vector>> prevVersions; state std::vector versionConfigs; state std::vector>> allWorkersReady; - for (const auto [uid, version] : savedLogVersions) { + for (const auto& [uid, version] : savedLogVersions) { versionConfigs.emplace_back(uid); prevVersions.push_back(versionConfigs.back().latestBackupWorkerSavedVersion().get(tr)); allWorkersReady.push_back(versionConfigs.back().allWorkerStarted().get(tr)); @@ -569,7 +569,7 @@ ACTOR Future monitorBackupProgress(BackupData* self) { if (self->recruitedEpoch == self->oldestBackupEpoch) { // update update progress so far if previous epochs are done Version v = std::numeric_limits::max(); - for (const auto [tag, version] : tagVersions) { + for (const auto& [tag, version] : tagVersions) { v = std::min(v, version); } savedLogVersions.emplace(uid, v); @@ -781,7 +781,7 @@ ACTOR Future saveMutationsToFile(BackupData* self, Version popVersion, int .detail("TagId", self->tag.id) .detail("File", file->getFileName()); } - for (const UID uid : activeUids) { + for (const UID& uid : activeUids) { self->backups[uid].lastSavedVersion = popVersion + 1; } diff --git a/fdbserver/MasterProxyServer.actor.cpp b/fdbserver/MasterProxyServer.actor.cpp index d3c69651df..2c42eb1283 100644 --- a/fdbserver/MasterProxyServer.actor.cpp +++ b/fdbserver/MasterProxyServer.actor.cpp @@ -2294,7 +2294,7 @@ ACTOR Future masterProxyServerCore( state KeyRange txnKeys = allKeys; Standalone UIDtoTagMap = commitData.txnStateStore->readRange( serverTagKeys ).get(); state std::map tag_uid; - for (const KeyValueRef kv : UIDtoTagMap) { + for (const KeyValueRef& kv : UIDtoTagMap) { tag_uid[decodeServerTagValue(kv.value)] = decodeServerTagKey(kv.key); } loop {