8000 small code cleanup (#15474) · strogo/arangodb@1ab6895 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ab6895

Browse files
authored
small code cleanup (arangodb#15474)
1 parent 09f39f0 commit 1ab6895

14 files changed

+27
-58
lines changed

arangod/Agency/AddFollower.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,7 @@ bool AddFollower::start(bool&) {
271271
} catch (std::exception const& e) {
272272
// Just in case, this is never going to happen, since when _jb is
273273
// set, then the current job is stored under ToDo.
274-
LOG_TOPIC("15c37", WARN, Logger::SUPERVISION)
275-
<< e.what() << ": " << __FILE__ << ":" << __LINE__;
274+
LOG_TOPIC("15c37", WARN, Logger::SUPERVISION) << e.what();
276275
return false;
277276
}
278277
}

arangod/Agency/Agent.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "Basics/ConditionLocker.h"
3636
#include "Basics/ReadLocker.h"
3737
#include "Basics/ScopeGuard.h"
38+
#include "Basics/StaticStrings.h"
3839
#include "Basics/StringUtils.h"
3940
#include "Basics/WriteLocker.h"
4041
#include "Basics/application-exit.h"
@@ -557,8 +558,7 @@ priv_rpc_ret_t Agent::recvAppendEntriesRPC(term_t term,
557558
}
558559
} catch (std::exception const& e) {
559560
< 8000 span class="pl-c1">LOG_TOPIC("bedb8", DEBUG, Logger::AGENCY)
560-
<< "Exception during log append: " << __FILE__ << __LINE__ << " "
561-
<< e.what();
561+
<< "Exception during log append: " << e.what();
562562
}
563563

564564
{
@@ -2077,12 +2077,11 @@ void Agent::setPersistedState(VPackSlice compaction) {
20772077
CONDITION_LOCKER(guard, _waitForCV);
20782078
_readDB = compaction;
20792079
_commitIndex = arangodb::basics::StringUtils::uint64(
2080-
compaction.get("_key").copyString());
2080+
compaction.get(StaticStrings::KeyString).copyString());
20812081
_local_index = _commitIndex.load(std::memory_order_relaxed);
20822082
_waitForCV.broadcast();
20832083
} catch (std::exception const& e) {
2084-
LOG_TOPIC("70844", ERR, Logger::AGENCY)
2085-
<< e.what() << " " << __FILE__ << __LINE__;
2084+
LOG_TOPIC("70844", ERR, Logger::AGENCY) << e.what();
20862085
}
20872086
}
20882087

@@ -2182,8 +2181,7 @@ query_t Agent::gossip(VPackSlice slice, bool isCallback, size_t version) {
21822181
try {
21832182
_config.eraseGossipPeer(endpoint);
21842183
} catch (std::exception const& e) {
2185-
LOG_TOPIC("58f08", ERR, Logger::AGENCY)
2186-
<< __FILE__ << ":" << __LINE__ << " " << e.what();
2184+
LOG_TOPIC("58f08", ERR, Logger::AGENCY) << e.what();
21872185
}
21882186
}
21892187

arangod/Agency/CleanOutServer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,7 @@ bool CleanOutServer::start(bool& aborts) {
304304
} catch (std::exception const& e) {
305305
// Just in case, this is never going to happen, since when _jb is
306306
// set, then the current job is stored under ToDo.
307-
LOG_TOPIC( 9E88 "7b79a", WARN, Logger::SUPERVISION)
308-
<< e.what() << ": " << __FILE__ << ":" << __LINE__;
307+
LOG_TOPIC("7b79a", WARN, Logger::SUPERVISION) << e.what();
309308
return false;
310309
}
311310
}

arangod/Agency/MoveShard.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,7 @@ bool MoveShard::start(bool&) {
393393
} catch (std::exception const& e) {
394394
// Just in case, this is never going to happen, since when _jb is
395395
// set, then the current job is stored under ToDo.
396-
LOG_TOPIC("34af0", WARN, Logger::SUPERVISION)
397-
<< e.what() << ": " << __FILE__ << ":" << __LINE__;
396+
LOG_TOPIC("34af0", WARN, Logger::SUPERVISION) << e.what();
398397
return false;
399398
}
400399
}

arangod/Agency/Node.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -966,8 +966,7 @@ void Node::toBuilder(Builder& builder, bool showHidden) const {
966966
}
967967

968968
} catch (std::exception const& e) {
969-
LOG_TOPIC("44d99", ERR, Logger::AGENCY)
970-
<< e.what() << " " << __FILE__ << __LINE__;
969+
LOG_TOPIC("44d99", ERR, Logger::AGENCY) << e.what();
971970
}
972971
}
973972

arangod/Agency/RemoveFollower.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,7 @@ bool RemoveFollower::start(bool&) {
380380
} catch (std::exception const& e) {
381381
// Just in case, this is never going to happen, since when _jb is
382382
// set, then the current job is stored under ToDo.
383-
LOG_TOPIC("95927", WARN, Logger::SUPERVISION)
384-
<< e.what() << ": " << __FILE__ << ":" << __LINE__;
383+
LOG_TOPIC("95927", WARN, Logger::SUPERVISION) << e.what();
385384
return false;
386385
}
387386
}

arangod/Agency/ResignLeadership.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,7 @@ bool ResignLeadership::start(bool& aborts) {
298298
} catch (std::exception const& e) {
299299
// Just in case, this is never going to happen, since when _jb is
300300
// set, then the current job is stored under ToDo.
301-
LOG_TOPIC("deadc", WARN, Logger::SUPERVISION)
302-
<< e.what() << ": " << __FILE__ << ":" << __LINE__;
301+
LOG_TOPIC("deadc", WARN, Logger::SUPERVISION) << e.what();
303302
return false;
304303
}
305304
}

arangod/Agency/State.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,7 @@ size_t State::removeConflicts(VPackSlice transactions, bool gotSnapshot) {
576576
}
577577
}
578578
} catch (std::exception const& e) {
579-
LOG_TOPIC("9e1df", DEBUG, Logger::AGENCY)
580-
<< e.what() << " " << __FILE__ << __LINE__;
579+
LOG_TOPIC("9e1df", DEBUG, Logger::AGENCY) << e.what();
581580
}
582581

583582
return ndups;
@@ -960,8 +959,7 @@ bool State::loadLastCompactedSnapshot(Store& store, index_t& index,
960959
index = extractIndexFromKey(ii);
961960
term = ii.get("term").getNumber<uint64_t>();
962961
} catch (std::exception const& e) {
963-
LOG_TOPIC("8ef2a", ERR, Logger::AGENCY)
964-
<< e.what() << " " << __FILE__ << __LINE__;
962+
LOG_TOPIC("8ef2a", ERR, Logger::AGENCY) << e.what();
965963
return false;
966964
}
967965
}
@@ -1006,8 +1004,7 @@ index_t State::loadCompacted() {
10061004
_nextCompactionAfter = _cur + _agent->config().compactionStepSize();
10071005
} catch (std::exception const& e) {
10081006
_cur = 0;
1009-
LOG_TOPIC("bc330", ERR, Logger::AGENCY)
1010-
<< e.what() << " " << __FILE__ << __LINE__;
1007+
LOG_TOPIC("bc330", ERR, Logger::AGENCY) << e.what();
10111008
}
10121009
}
10131010

arangod/Agency/Store.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ std::vector<apply_ret_t> Store::applyTransactions(
180180
}
181181

182182
} catch (std::exception const& e) { // Catch any errors
183-
LOG_TOPIC("8264b", ERR, Logger::AGENCY)
184-
<< __FILE__ << ":" << __LINE__ << " " << e.what();
183+
LOG_TOPIC("8264b", ERR, Logger::AGENCY) << e.what();
185184
success.push_back(UNKNOWN_ERROR);
186185
}
187186

arangod/Agency/Supervision.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,8 +1147,7 @@ void Supervision::run() {
11471147
LOG_TOPIC("675fc", TRACE, Logger::SUPERVISION)
11481148
<< "Finished doChecks";
11491149
} catch (std::exception const& e) {
1150-
LOG_TOPIC("e0869", ERR, Logger::SUPERVISION)
1151-
<< e.what() << " " << __FILE__ << " " << __LINE__;
1150+
LOG_TOPIC("e0869", ERR, Logger::SUPERVISION) << e.what();
11521151
} catch (...) {
11531152
LOG_TOPIC("ac4c4", ERR, Logger::SUPERVISION)
11541153
<< "Supervision::doChecks() generated an uncaught "
@@ -2387,7 +2386,7 @@ void Supervision::restoreBrokenAnalyzersRevision(
23872386

23882387
void Supervision::resourceCreatorLost(
23892388
std::shared_ptr<Node> const& resource,
2390-
std::function<void(const ResourceCreatorLostEvent&)> const& action) {
2389+
std::function<void(ResourceCreatorLostEvent const&)> const& action) {
23912390
// check if the coordinator exists and its reboot is the same as specified
23922391
auto rebootID = resource->hasAsUInt(StaticStrings::AttrCoordinatorRebootId);
23932392
auto coordinatorID = resource->hasAsString(StaticStrings::AttrCoordinator);
@@ -2414,7 +2413,7 @@ void Supervision::resourceCreatorLost(
24142413

24152414
void Supervision::ifResourceCreatorLost(
24162415
std::shared_ptr<Node> const& resource,
2417-
std::function<void(const ResourceCreatorLostEvent&)> const& action) {
2416+
std::function<void(ResourceCreatorLostEvent const&)> const& action) {
24182417
// check if isBuilding is set and it is true
24192418
auto isBuilding = resource->hasAsBool(StaticStrings::AttrIsBuilding);
24202419
if (isBuilding && isBuilding.value()) {
@@ -3040,8 +3039,7 @@ void Supervision::getUniqueIds() {
30403039
_jobId = _jobIdMax - n;
30413040
} catch (std::exception const& e) {
30423041
LOG_TOPIC("4da4b", ERR, Logger::SUPERVISION)
3043-
<< "Failed to acquire job IDs from agency: " << e.what() << __FILE__
3044-
<< " " << __LINE__;
3042+
<< "Failed to acquire job IDs from agency: " << e.what();
30453043
}
30463044
}
30473045
}

0 commit comments

Comments
 (0)
0