Skip to content

Commit 53ce047

Browse files
committed
Post-rebase corrections
The corrections were made to reconcile changes made in both the main branch and in the current one. The following problems were addressed: - both branches introduced changes to the Qmeta schema (up to version 10) - a configuration of the worker's result delivery REST service changed in the main branch - class move was made in the feature branch: qdisp::MessageStore -> qmeta::MessageStore
1 parent 289039a commit 53ce047

File tree

6 files changed

+22
-27
lines changed

6 files changed

+22
-27
lines changed

src/ccontrol/UserQueryQueries.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
// Qserv headers
3636
#include "css/CssAccess.h"
3737
#include "css/CssError.h"
38-
#include "qdisp/MessageStore.h"
38+
#include "qmeta/MessageStore.h"
3939
#include "qmeta/Exceptions.h"
4040
#include "qmeta/QMetaSelect.h"
4141
#include "query/FromList.h"
@@ -68,7 +68,7 @@ UserQueryQueries::UserQueryQueries(std::shared_ptr<query::SelectStmt> const& sta
6868
: _resultDbConn(resultDbConn),
6969
_qMetaSelect(qMetaSelect),
7070
_qMetaCzarId(qMetaCzarId),
71-
_messageStore(std::make_shared<qdisp::MessageStore>()),
71+
_messageStore(std::make_shared<qmeta::MessageStore>()),
7272
_resultTableName(::g_nextResultTableId(userQueryId)),
7373
_resultDb(resultDb) {
7474
// The SQL statement should be mostly OK alredy but we need to change

src/ccontrol/UserQueryQueries.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class UserQueryQueries : public UserQuery {
8989
void discard() override;
9090

9191
// Delegate objects
92-
std::shared_ptr<qdisp::MessageStore> getMessageStore() override { return _messageStore; }
92+
std::shared_ptr<qmeta::MessageStore> getMessageStore() override { return _messageStore; }
9393

9494
/// @return Name of the result table for this query, can be empty
9595
std::string getResultTableName() const override { return _resultTableName; }
@@ -108,7 +108,7 @@ class UserQueryQueries : public UserQuery {
108108
std::shared_ptr<qmeta::QMetaSelect> _qMetaSelect;
109109
qmeta::CzarId const _qMetaCzarId; ///< Czar ID in QMeta database
110110
QueryState _qState = UNKNOWN;
111-
std::shared_ptr<qdisp::MessageStore> _messageStore;
111+
std::shared_ptr<qmeta::MessageStore> _messageStore;
112112
std::string _resultTableName;
113113
std::string _query; ///< query to execute on QMeta database
114114
std::string _orderBy;

src/qmeta/QMetaMysql.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ using namespace std;
5050
namespace {
5151

5252
// Current version of QMeta schema
53-
char const VERSION_STR[] = "10";
53+
char const VERSION_STR[] = "11";
5454

5555
LOG_LOGGER _log = LOG_GET("lsst.qserv.qmeta.QMetaMysql");
5656

src/wbase/Task.cc

-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ size_t const MB_SIZE_BYTES = 1024 * 1024;
7676

7777
namespace lsst::qserv::wbase {
7878

79-
string const Task::_fqdn = util::get_current_host_fqdn();
80-
8179
// Task::ChunkEqual functor
8280
bool Task::ChunkEqual::operator()(Task::Ptr const& x, Task::Ptr const& y) {
8381
if (!x || !y) {

src/wbase/UberJobData.cc

+11-16
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
using namespace std;
4949
using namespace nlohmann;
5050

51+
namespace fs = boost::filesystem;
52+
5153
namespace {
5254

5355
LOG_LOGGER _log = LOG_GET("lsst.qserv.wbase.UberJobData");
@@ -180,35 +182,28 @@ void UberJobData::_queueUJResponse(http::Method method_, std::vector<std::string
180182
}
181183
}
182184

183-
string UberJobData::buildUjResultFilePath(string const& resultsDirname) {
184-
if (resultsDirname.empty()) return resultsDirname;
185-
boost::filesystem::path path(resultsDirname);
185+
string UberJobData::_resultFileName() const {
186186
// UberJobs have multiple chunks which can each have different attempt numbers.
187187
// However, each CzarID + UberJobId should be unique as UberJobs are not retried.
188-
path /= to_string(getCzarId()) + "-" + to_string(getQueryId()) + "-" + to_string(getUberJobId()) + "-0" +
189-
".proto";
190-
return path.string();
188+
return to_string(getCzarId()) + "-" + to_string(getQueryId()) + "-" + to_string(getUberJobId()) + "-0" +
189+
".proto";
191190
}
192191

193-
string UberJobData::resultFilePath() {
194-
auto const workerConfig = wconfig::WorkerConfig::instance();
195-
string resultFilePath = buildUjResultFilePath(workerConfig->resultsDirname());
196-
return resultFilePath;
192+
string UberJobData::resultFilePath() const {
193+
string const resultsDirname = wconfig::WorkerConfig::instance()->resultsDirname();
194+
if (resultsDirname.empty()) return resultsDirname;
195+
return (fs::path(resultsDirname) / _resultFileName()).string();
197196
}
198197

199-
std::string UberJobData::resultFileHttpUrl() {
198+
std::string UberJobData::resultFileHttpUrl() const {
200199
auto const workerConfig = wconfig::WorkerConfig::instance();
201200
auto const resultDeliveryProtocol = workerConfig->resultDeliveryProtocol();
202-
203-
string resFilePath = resultFilePath();
204-
auto const fqdn = _foreman->getFqdn();
205201
if (resultDeliveryProtocol != wconfig::ConfigValResultDeliveryProtocol::HTTP) {
206202
throw runtime_error("wbase::Task::Task: unsupported results delivery protocol: " +
207203
wconfig::ConfigValResultDeliveryProtocol::toString(resultDeliveryProtocol));
208204
}
209205
// TODO:UJ it seems like this should just be part of the FileChannelShared???
210-
string resultFileHttpUrl = "http://" + fqdn + ":" + to_string(_resultsHttpPort) + resFilePath;
211-
return resultFileHttpUrl;
206+
return "http://" + _foreman->getFqdn() + ":" + to_string(_resultsHttpPort) + "/" + _resultFileName();
212207
}
213208

214209
void UberJobData::cancelAllTasks() {

src/wbase/UberJobData.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,10 @@ class UberJobData : public std::enable_shared_from_this<UberJobData> {
117117
/// that there is no limit to the number of rows sent back by the worker.
118118
/// Workers can only safely limit rows for queries that have the LIMIT clause without other related
119119
/// clauses like ORDER BY.
120-
int getRowLimit() { return _rowLimit; }
120+
int getRowLimit() const { return _rowLimit; }
121121

122-
std::string buildUjResultFilePath(std::string const& resultsDirname);
123-
std::string resultFilePath();
124-
std::string resultFileHttpUrl();
122+
std::string resultFilePath() const;
123+
std::string resultFileHttpUrl() const;
125124

126125
private:
127126
UberJobData(UberJobId uberJobId, std::string const& czarName, qmeta::CzarId czarId, std::string czarHost,
@@ -130,6 +129,9 @@ class UberJobData : public std::enable_shared_from_this<UberJobData> {
130129
std::string const& workerId, std::shared_ptr<wcontrol::Foreman> const& foreman,
131130
std::string const& authKey, uint16_t resultsHttpPort);
132131

132+
/// Return the name of the file that will contain the results of the query.
133+
std::string _resultFileName() const;
134+
133135
/// Queue the response to be sent to the originating czar.
134136
void _queueUJResponse(http::Method method_, std::vector<std::string> const& headers_,
135137
std::string const& url_, std::string const& requestContext_,

0 commit comments

Comments
 (0)