Skip to content

Commit 3cf3fd2

Browse files
committed
Review changes.
1 parent eaad4a1 commit 3cf3fd2

16 files changed

Lines changed: 39 additions & 49 deletions

src/qdisp/Executive.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,7 @@ void Executive::markCompleted(JobId jobId, bool success) {
440440
if (!success && !isRowLimitComplete()) {
441441
{
442442
lock_guard<mutex> lock(_incompleteJobsMutex);
443-
auto iter = _incompleteJobs.find(jobId);
444-
if (iter == _incompleteJobs.end()) {
443+
if (_incompleteJobs.count(jobId) == 0) {
445444
string msg = "Executive::markCompleted failed to find TRACKED " + idStr +
446445
" size=" + to_string(_incompleteJobs.size());
447446
// If the user query has been cancelled, this is expected for jobs that have not yet
@@ -475,7 +474,7 @@ void Executive::markCompleted(JobId jobId, bool success) {
475474
}
476475
_unTrack(jobId);
477476
if (!success && !isRowLimitComplete()) {
478-
squash(string("markComplete error ") + errStr); // ask to squash
477+
squash("markComplete error " + errStr); // ask to squash
479478
}
480479
}
481480

@@ -841,7 +840,7 @@ void Executive::checkResultFileSize(uint64_t fileSize) {
841840
if (total > maxResultTableSizeBytes) {
842841
LOGS(_log, LOG_LVL_ERROR, "Executive: requesting squash, result file size too large " << total);
843842
util::Error err(util::ErrorCode::CZAR_RESULT_TOO_LARGE,
844-
string("Incomplete result already too large ") + to_string(total));
843+
"Incomplete result already too large " + to_string(total));
845844
_multiError.push_back(err);
846845
squash("czar, file too large");
847846
}

src/qdisp/Executive.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class Executive : public std::enable_shared_from_this<Executive> {
281281
/// The stats are pushed to qdisp::CzarStats.
282282
void _updateStats() const;
283283

284-
util::InstanceCount _icEx{"Executive"};
284+
util::InstanceCount const _icEx{"Executive"};
285285
std::atomic<bool> _empty{true};
286286
std::shared_ptr<qmeta::MessageStore> _messageStore; ///< MessageStore for logging
287287

src/qdisp/JobDescription.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ JobDescription::JobDescription(qmeta::CzarId czarId, QueryId qId, JobId jobId, R
5757
_chunkQuerySpec(chunkQuerySpec),
5858
_mock(mock) {}
5959

60-
JobDescription::~JobDescription() { LOGS(_log, LOG_LVL_TRACE, "~JobDescription()"); }
61-
6260
bool JobDescription::incrAttemptCount(std::shared_ptr<Executive> const& exec, bool increase) {
6361
if (increase) {
6462
++_attemptCount;

src/qdisp/JobDescription.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class JobDescription {
6969
JobDescription(JobDescription const&) = delete;
7070
JobDescription& operator=(JobDescription const&) = delete;
7171

72-
virtual ~JobDescription();
72+
virtual ~JobDescription() = default;
7373

7474
std::string cName(const char* fnc) { return std::string("JobDescription::") + fnc + " " + _qIdStr; }
7575

src/qdisp/JobQuery.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,15 @@ bool JobQuery::cancel(bool superfluous) {
6363
VMUTEX_NOT_HELD(_jqMtx);
6464
lock_guard lock(_jqMtx);
6565

66-
ostringstream os;
67-
os << _idStr << " cancel";
68-
LOGS(_log, LOG_LVL_DEBUG, os.str());
66+
string const context = _idStr + " cancel";
67+
LOGS(_log, LOG_LVL_DEBUG, context);
6968
auto exec = _executive.lock();
7069
if (exec == nullptr) {
7170
LOGS(_log, LOG_LVL_ERROR, " can't markComplete cancelled, executive == nullptr");
7271
return false;
7372
}
7473
if (!superfluous) {
75-
exec->addMultiError(-1, os.str(), util::ErrorCode::RESULT_IMPORT);
74+
exec->addMultiError(-1, context, util::ErrorCode::RESULT_IMPORT);
7675
}
7776
exec->markCompleted(getJobId(), false);
7877
return true;

src/rproc/InfileMerger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class InfileMerger {
170170
bool _applySqlLocal(std::string const& sql, sql::SqlResults& results, sql::SqlErrorObject& errObj);
171171
bool _sqlConnect(sql::SqlErrorObject& errObj);
172172

173-
util::InstanceCount _icIm{"InfileMerger"};
173+
util::InstanceCount const _icIm{"InfileMerger"};
174174
std::string _getQueryIdStr();
175175
void _setQueryIdStr(std::string const& qIdStr);
176176
void _fixupTargetName();

src/rproc/ProtoRowBuffer.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ ProtoRowBuffer::ProtoRowBuffer(proto::ResponseData const& res)
7777
}
7878
}
7979

80-
ProtoRowBuffer::~ProtoRowBuffer() { LOGS(_log, LOG_LVL_TRACE, "~ProtoRowBuffer()"); }
81-
8280
/// Fetch a up to a single row from from the Result message
8381
unsigned ProtoRowBuffer::fetch(char* buffer, unsigned bufLen) {
8482
unsigned fetched = 0;

src/rproc/ProtoRowBuffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ProtoRowBuffer : public mysql::RowBuffer {
3939
ProtoRowBuffer(proto::ResponseData const& res, int jobId, std::string const& jobIdColName,
4040
std::string const& jobIdSqlType, int jobIdMysqlType);
4141

42-
~ProtoRowBuffer() override;
42+
~ProtoRowBuffer() override = default;
4343

4444
unsigned fetch(char* buffer, unsigned bufLen) override;
4545
std::string dump() const override;

src/util/Error.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ struct ErrorCode {
7474
*/
7575
class Error {
7676
public:
77-
Error(int code, std::string const& msg = "", int status = ErrorCode::NONE, bool logLvLErr = true);
77+
explicit Error(int code, std::string const& msg = "", int status = ErrorCode::NONE,
78+
bool logLvLErr = true);
7879

7980
Error() = default;
8081
Error(Error const&) = default;
@@ -105,7 +106,7 @@ class Error {
105106

106107
private:
107108
int _code = ErrorCode::NONE;
108-
std::string _msg{""};
109+
std::string _msg;
109110
int _status = ErrorCode::NONE;
110111
};
111112

src/util/InstanceCount.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ LOG_LOGGER _log = LOG_GET("lsst.qserv.util.InstanceCount");
2121

2222
namespace lsst::qserv::util {
2323

24-
InstanceCountData InstanceCount::_icData;
24+
InstanceCount::InstanceCountData InstanceCount::_icData;
2525

26-
InstanceCountData::InstanceCountData() {
26+
InstanceCount::InstanceCountData::InstanceCountData() {
2727
std::cout << "InstanceCountData " << " mx=" << (void*)(&_mx) << " _inst=" << (void*)(&_instances)
2828
<< " t=" << (void*)(this) << endl;
2929
}
3030

31-
InstanceCountData::~InstanceCountData() {
31+
InstanceCount::InstanceCountData::~InstanceCountData() {
3232
cout << "~InstanceCountData " << " mx=" << (void*)(&_mx) << " _inst=" << (void*)(&_instances)
3333
<< " t=" << (void*)(this) << endl;
3434
}

0 commit comments

Comments
 (0)