Skip to content

Commit eaad4a1

Browse files
committed
Cleanup and removed some unneeded code.
1 parent e3d26af commit eaad4a1

65 files changed

Lines changed: 316 additions & 409 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

admin/tools/docker/base/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ RUN dnf install -y 'dnf-command(config-manager)' \
5252
protobuf-devel \
5353
python3.12 \
5454
python3.12-devel \
55+
jemalloc \
5556
tree \
5657
vim \
5758
zip \

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ find_package(Protobuf REQUIRED)
2121
find_package(pybind11 REQUIRED)
2222
find_package(Threads REQUIRED)
2323
find_package(XRootD REQUIRED)
24-
find_package(httplib REQUIRED)
24+
#&&& find_package(httplib REQUIRED)
2525
find_package(aws-c-auth REQUIRED)
2626
find_package(aws-c-cal REQUIRED)
2727
find_package(aws-c-common REQUIRED)

src/cconfig/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ target_sources(cconfig PRIVATE
44
CzarConfig.cc
55
)
66

7-
target_include_directories(cconfig PRIVATE
8-
${XROOTD_INCLUDE_DIRS}
9-
)
107

118
target_link_libraries(cconfig PUBLIC
129
log
13-
XrdSsiLib
10+
)
11+
12+
install(
13+
TARGETS cconfig
1414
)
1515

1616
install(

src/cconfig/CzarConfig.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <stdexcept>
2929

3030
// Third party headers
31-
#include "XrdSsi/XrdSsiLogger.hh"
3231

3332
// LSST headers
3433
#include "lsst/log/Log.h"
@@ -42,20 +41,6 @@ namespace {
4241

4342
LOG_LOGGER _log = LOG_GET("lsst.qserv.cconfig.CzarConfig");
4443

45-
void QservLogger(struct timeval const& mtime, unsigned long tID, const char* msg, int mlen) {
46-
static log4cxx::spi::LocationInfo xrdLoc(
47-
"client", log4cxx::spi::LocationInfo::calcShortFileName("client"), "<xrdssi>", 0);
48-
static LOG_LOGGER myLog = LOG_GET("lsst.qserv.xrdssi.msgs");
49-
50-
if (myLog.isInfoEnabled()) {
51-
while (mlen && msg[mlen - 1] == '\n') --mlen; // strip all trailing newlines
52-
std::string theMsg(msg, mlen);
53-
lsst::log::Log::MDC("LWP", std::to_string(tID));
54-
myLog.logMsg(log4cxx::Level::getInfo(), xrdLoc, theMsg);
55-
}
56-
}
57-
58-
bool dummy = XrdSsiLogger::SetMCB(QservLogger, XrdSsiLogger::mcbClient);
5944
} // namespace
6045

6146
namespace lsst::qserv::cconfig {

src/ccontrol/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ add_dependencies(ccontrol proto)
33

44
target_include_directories(ccontrol PRIVATE
55
${ANTLR4_INCLUDE_DIR}
6-
${XROOTD_INCLUDE_DIRS}
76
)
87

98
target_sources(ccontrol PRIVATE
@@ -29,11 +28,15 @@ target_sources(ccontrol PRIVATE
2928
target_link_libraries(ccontrol PUBLIC
3029
boost_regex
3130
cconfig
31+
css
3232
log
3333
parser
34-
replica
34+
proto
3535
sphgeom
36-
XrdCl
36+
)
37+
38+
install(
39+
TARGETS ccontrol
3740
)
3841

3942
install(
@@ -67,3 +70,6 @@ ccontrol_tests(
6770
testCControl
6871
testUserQueryType
6972
)
73+
74+
# set_tests_properties(testCControl PROPERTIES WILL_FAIL 1)
75+

src/ccontrol/MergingHandler.cc

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
// Third-party headers
3535
#include "curl/curl.h"
36-
#include "XrdCl/XrdClFile.hh"
3736

3837
// LSST headers
3938
#include "lsst/log/Log.h"
@@ -274,18 +273,14 @@ shared_ptr<http::ClientConnPool> const& MergingHandler::_getHttpConnPool() {
274273
return _httpConnPool;
275274
}
276275

277-
/*&&&
278-
MergingHandler::MergingHandler(std::shared_ptr<rproc::InfileMerger> merger, std::string const& tableName)
279-
: _infileMerger{merger}, _tableNameOld{tableName} {}
280-
*/
281-
MergingHandler::MergingHandler(std::shared_ptr<rproc::InfileMerger> merger)
282-
: _infileMerger{merger} {}
276+
MergingHandler::MergingHandler(std::shared_ptr<rproc::InfileMerger> const& merger,
277+
std::shared_ptr<qdisp::Executive> const& exec)
278+
: _infileMerger(merger), _executive(exec) {}
283279

284-
285-
MergingHandler::~MergingHandler() { LOGS(_log, LOG_LVL_TRACE, __func__ ); }
280+
MergingHandler::~MergingHandler() { LOGS(_log, LOG_LVL_TRACE, __func__); }
286281

287282
void MergingHandler::errorFlush(std::string const& msg, int code) {
288-
_setError(code, msg);
283+
_setError(code, msg, util::ErrorCode::RESULT_IMPORT);
289284
// Might want more info from result service.
290285
// Do something about the error. FIXME.
291286
LOGS(_log, LOG_LVL_ERROR, "Error receiving result.");
@@ -311,29 +306,17 @@ bool MergingHandler::_mergeHttp(shared_ptr<qdisp::UberJob> const& uberJob,
311306
if (!success) {
312307
LOGS(_log, LOG_LVL_WARN, __func__ << " failed");
313308
util::Error const& err = _infileMerger->getError();
314-
_setError(ccontrol::MSG_RESULT_ERROR, err.getMsg());
309+
_setError(ccontrol::MSG_RESULT_ERROR, err.getMsg(), util::ErrorCode::RESULT_IMPORT);
315310
}
316311
return success;
317312
}
318313

319-
bool MergingHandler::_mergeHttp(shared_ptr<qdisp::UberJob> const& uberJob,
320-
proto::ResponseData const& responseData) {
321-
if (_flushed) {
322-
throw util::Bug(ERR_LOC, "already flushed");
323-
}
324-
bool const success = _infileMerger->mergeHttp(uberJob, responseData);
325-
if (!success) {
326-
LOGS(_log, LOG_LVL_WARN, __func__ << " failed");
327-
util::Error const& err = _infileMerger->getError();
328-
_setError(ccontrol::MSG_RESULT_ERROR, err.getMsg());
329-
}
330-
return success;
331-
}
332314

333-
void MergingHandler::_setError(int code, std::string const& msg) {
315+
void MergingHandler::_setError(int code, std::string const& msg, int errorState) {
334316
LOGS(_log, LOG_LVL_DEBUG, "_setError: code: " << code << ", message: " << msg);
335-
std::lock_guard<std::mutex> lock(_errorMutex);
336-
_error = Error(code, msg);
317+
auto exec = _executive.lock();
318+
if (exec == nullptr) return;
319+
exec->addMultiError(code, msg, errorState);
337320
}
338321

339322
tuple<bool, bool> MergingHandler::flushHttp(string const& fileUrl, uint64_t expectedRows,
@@ -383,10 +366,9 @@ tuple<bool, bool> MergingHandler::flushHttp(string const& fileUrl, uint64_t expe
383366
return {success, shouldCancel};
384367
}
385368

386-
void MergingHandler::flushHttpError(int errorCode, std::string const& errorMsg, int status) {
369+
void MergingHandler::flushHttpError(int errorCode, std::string const& errorMsg, int errState) {
387370
if (!_errorSet.exchange(true)) {
388-
_error = util::Error(errorCode, errorMsg, util::ErrorCode::MYSQLEXEC);
389-
_setError(ccontrol::MSG_RESULT_ERROR, _error.getMsg());
371+
_setError(errorCode, errorMsg, errState);
390372
}
391373
}
392374

src/ccontrol/MergingHandler.h

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
// Qserv headers
3232
#include "qdisp/ResponseHandler.h"
3333

34-
#include "mysql/LocalInfile.h" //&&&
35-
3634
// Forward declarations
3735

3836
namespace lsst::qserv::http {
@@ -45,6 +43,7 @@ class ResponseSummary;
4543
} // namespace lsst::qserv::proto
4644

4745
namespace lsst::qserv::qdisp {
46+
class Executive;
4847
class JobQuery;
4948
class UberJob;
5049
} // namespace lsst::qserv::qdisp
@@ -64,23 +63,22 @@ namespace lsst::qserv::ccontrol {
6463
/// Do to the way the code works, MerginHandler is effectively single threaded.
6564
/// The worker can only send the data for this job back over a single channel
6665
/// and it can only send one transmit on that channel at a time.
67-
class MergingHandler : public qdisp::ResponseHandler { mysql::InstanceMCount icmim{"MergingHandler&&&"};
66+
class MergingHandler : public qdisp::ResponseHandler {
6867
public:
6968
typedef std::shared_ptr<MergingHandler> Ptr;
7069
virtual ~MergingHandler();
7170

7271
/// @param merger downstream merge acceptor
73-
/// @param tableName target table for incoming data
74-
//&&&MergingHandler(std::shared_ptr<rproc::InfileMerger> merger, std::string const& tableName);
75-
MergingHandler(std::shared_ptr<rproc::InfileMerger> merger);
72+
MergingHandler(std::shared_ptr<rproc::InfileMerger> const& merger,
73+
std::shared_ptr<qdisp::Executive> const& exec);
7674

7775
/// @see ResponseHandler::flushHttp
7876
/// @see MerginHandler::_mergeHttp
7977
std::tuple<bool, bool> flushHttp(std::string const& fileUrl, uint64_t expectedRows,
8078
uint64_t& resultRows) override;
8179

8280
/// @see ResponseHandler::flushHttpError
83-
void flushHttpError(int errorCode, std::string const& errorMsg, int status) override;
81+
void flushHttpError(int errorCode, std::string const& errorMsg, int errState) override;
8482

8583
/// @see ResponseHandler::flushHttp
8684
/// @see MerginHandler::_mergeHttp
@@ -96,18 +94,15 @@ class MergingHandler : public qdisp::ResponseHandler { mysql::InstanceMCount ic
9694
/// Print a string representation of the receiver to an ostream
9795
std::ostream& print(std::ostream& os) const override;
9896

99-
/// @return an error code and description
100-
Error getError() const override {
101-
std::lock_guard<std::mutex> lock(_errorMutex);
102-
return _error;
103-
}
97+
/// Prepare to scrub the results from jobId-attempt from the result table.
98+
void prepScrubResults(int jobId, int attempt) override;
10499

105100
private:
106101
/// Call InfileMerger to do the work of merging this data to the result.
107102
bool _mergeHttp(std::shared_ptr<qdisp::UberJob> const& uberJob, proto::ResponseData const& responseData);
108103

109104
/// Set error code and string.
110-
void _setError(int code, std::string const& msg);
105+
void _setError(int code, std::string const& msg, int errorState);
111106

112107
// All instances of the HTTP client class are members of the same pool. This allows
113108
// connection reuse and a significant reduction of the kernel memory pressure.
@@ -118,12 +113,11 @@ class MergingHandler : public qdisp::ResponseHandler { mysql::InstanceMCount ic
118113
static std::mutex _httpConnPoolMutex;
119114

120115
std::shared_ptr<rproc::InfileMerger> _infileMerger; ///< Merging delegate
121-
//&&&std::string _tableNameOld; ///< Target table name
122-
Error _error; ///< Error description
123116
std::atomic<bool> _errorSet{false}; ///< Set to true when an error is set.
124-
mutable std::mutex _errorMutex; ///< Protect readers from partial updates
125117
bool _flushed{false}; ///< flushed to InfileMerger?
126118
std::string _wName{"~"}; ///< worker name
119+
120+
std::weak_ptr<qdisp::Executive> _executive; ///< Weak pointer to the executive for errors.
127121
};
128122

129123
} // namespace lsst::qserv::ccontrol

src/ccontrol/UserQuery.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
#include "global/intTypes.h"
4242
#include "qmeta/types.h"
4343

44-
#include "util/InstanceCount.h" //&&&
45-
4644
// Forward decl
4745
namespace lsst::qserv::qmeta {
4846
class MessageStore;
@@ -52,7 +50,7 @@ namespace lsst::qserv::ccontrol {
5250

5351
/// UserQuery : interface for user query data. Not thread-safe, although
5452
/// its delegates are thread-safe as appropriate.
55-
class UserQuery { util::InstanceCount ic{"UserQuery&&&"};
53+
class UserQuery {
5654
public:
5755
typedef std::shared_ptr<UserQuery> Ptr;
5856

src/ccontrol/UserQuerySelect.cc

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ void UserQuerySelect::submit() {
268268
string dbName("");
269269
bool dbNameSet = false;
270270

271-
auto mergingHandler = std::make_shared<MergingHandler>(_infileMerger);
272271
for (auto i = _qSession->cQueryBegin(), e = _qSession->cQueryEnd(); i != e && !exec->getCancelled();
273272
++i) {
274273
auto& chunkSpec = *i;
@@ -286,7 +285,6 @@ void UserQuerySelect::submit() {
286285
cs = _qSession->buildChunkQuerySpec(queryTemplates, chunkSpec, fillInChunkIdTag);
287286
chunks.push_back(cs->chunkId);
288287
}
289-
std::string chunkResultName = _ttn->make(cs->chunkId);
290288

291289
// This should only need to be set once as all jobs should have the same database name.
292290
if (cs->db != dbName) {
@@ -301,14 +299,8 @@ void UserQuerySelect::submit() {
301299

302300
ResourceUnit ru;
303301
ru.setAsDbChunk(cs->db, cs->chunkId);
304-
/* &&&
305-
qdisp::JobDescription::Ptr jobDesc = qdisp::JobDescription::create(
306-
_qMetaCzarId, exec->getId(), sequence, ru,
307-
std::make_shared<MergingHandler>(_infileMerger, chunkResultName), cs, chunkResultName);
308-
*/
309-
qdisp::JobDescription::Ptr jobDesc = qdisp::JobDescription::create(
310-
_qMetaCzarId, exec->getId(), sequence, ru,
311-
mergingHandler, cs, chunkResultName);
302+
qdisp::JobDescription::Ptr jobDesc =
303+
qdisp::JobDescription::create(_qMetaCzarId, exec->getId(), sequence, ru, cs);
312304
auto job = exec->add(jobDesc);
313305
++sequence;
314306
}
@@ -479,8 +471,7 @@ void UserQuerySelect::buildAndSendUberJobs() {
479471
if (wInfUJ->uberJobPtr == nullptr) {
480472
auto ujId = _uberJobIdSeq++; // keep ujId consistent
481473
string uberResultName = _ttn->make(ujId);
482-
//&&&auto respHandler = make_shared<ccontrol::MergingHandler>(_infileMerger, uberResultName);
483-
auto respHandler = make_shared<ccontrol::MergingHandler>(_infileMerger);
474+
auto respHandler = make_shared<ccontrol::MergingHandler>(_infileMerger, exec);
484475
auto uJob = qdisp::UberJob::create(exec, respHandler, exec->getId(), ujId, _qMetaCzarId,
485476
targetWorker);
486477
uJob->setWorkerContactInfo(wInfUJ->wInf);
@@ -508,7 +499,8 @@ void UserQuerySelect::buildAndSendUberJobs() {
508499
}
509500

510501
if (attemptCountIncreased > 0) {
511-
LOGS(_log, LOG_LVL_WARN, funcN << " increased attempt count for " << attemptCountIncreased << " Jobs");
502+
LOGS(_log, LOG_LVL_WARN,
503+
funcN << " increased attempt count for " << attemptCountIncreased << " Jobs");
512504
}
513505

514506
// Queue unqued UberJobs, these have less than the max number of jobs.

src/ccontrol/UserQuerySelect.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
#include "qmeta/types.h"
4848
#include "qproc/ChunkSpec.h"
4949

50-
#include "util/InstanceCount.h" //&&&
51-
5250
// Forward declarations
5351
namespace lsst::qserv::qdisp {
5452
class Executive;
@@ -85,7 +83,7 @@ namespace lsst::qserv::ccontrol {
8583
class TmpTableName;
8684

8785
/// UserQuerySelect : implementation of the UserQuery for regular SELECT statements.
88-
class UserQuerySelect : public UserQuery { util::InstanceCount ic{"UserQuerySelect&&&"};
86+
class UserQuerySelect : public UserQuery {
8987
public:
9088
UserQuerySelect(std::shared_ptr<qproc::QuerySession> const& qs,
9189
std::shared_ptr<qmeta::MessageStore> const& messageStore,
@@ -102,7 +100,7 @@ class UserQuerySelect : public UserQuery { util::InstanceCount ic{"UserQuerySel
102100
UserQuerySelect(UserQuerySelect const&) = delete;
103101
UserQuerySelect& operator=(UserQuerySelect const&) = delete;
104102

105-
//&&& ~UserQuerySelect() override = default;
103+
~UserQuerySelect() override = default;
106104

107105
/**
108106
* @param resultLocation: Result location, if empty use result table with unique

0 commit comments

Comments
 (0)