Skip to content

Commit

Permalink
Eliminated the "local" index construction option from the REST API
Browse files Browse the repository at this point in the history
Any attempts to specify the removed options are now reported
as warnings back to callers of the nodified services. The underlying
REST framework was extended to return multiple warnings to
the callers.

Also, incremented the version number of the REST API to 20.
  • Loading branch information
iagaponenko committed Jun 20, 2023
1 parent 6dfcd02 commit fbe0972
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/admin/python/lsst/qserv/admin/replicationInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def __init__(
self.repl_ctrl = urlparse(repl_ctrl_uri)
self.auth_key = auth_key
self.admin_auth_key = admin_auth_key
self.repl_api_version = 19
self.repl_api_version = 20
_log.debug(f"ReplicationInterface %s", self.repl_ctrl)

def version(self) -> str:
Expand Down
5 changes: 3 additions & 2 deletions src/replica/HttpDirectorIndexModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ json HttpDirectorIndexModule::_buildDirectorIndex() {
string const directorTableName = body().optional<string>("director_table", string());
bool const allowForPublished = body().optional<int>("allow_for_published", 0) != 0;
bool const rebuild = body().optional<int>("rebuild", 0) != 0;
bool const localFile = body().optional<int>("local", 0) != 0;
if (body().has("local")) {
warn("Option 'local' is obsolete as of the version 20 of the API.");
}

debug(__func__, "database=" + databaseName);
debug(__func__, "director_table=" + directorTableName);
debug(__func__, "allow_for_published=" + bool2str(allowForPublished));
debug(__func__, "rebuild=" + bool2str(rebuild));
debug(__func__, "local=" + bool2str(localFile));

auto const database = config->databaseInfo(databaseName);
if (database.isPublished and not allowForPublished) {
Expand Down
7 changes: 3 additions & 4 deletions src/replica/HttpIngestModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,15 @@ json HttpIngestModule::_addDatabase() {
auto const numSubStripes = body().required<unsigned int>("num_sub_stripes");
auto const overlap = body().required<double>("overlap");
auto const enableAutoBuildDirectorIndex = body().optional<unsigned int>("auto_build_secondary_index", 1);
auto const enableLocalLoadDirectorIndex = body().optional<unsigned int>("local_load_secondary_index", 0);
if (body().has("local_load_secondary_index")) {
warn("Option 'local_load_secondary_index' is obsolete as of the version 20 of the API.");
}

debug(__func__, "database=" + databaseName);
debug(__func__, "num_stripes=" + to_string(numStripes));
debug(__func__, "num_sub_stripes=" + to_string(numSubStripes));
debug(__func__, "overlap=" + to_string(overlap));
debug(__func__, "auto_build_secondary_index=" + to_string(enableAutoBuildDirectorIndex ? 1 : 0));
debug(__func__, "local_load_secondary_index=" + to_string(enableLocalLoadDirectorIndex ? 1 : 0));

if (overlap < 0) throw HttpError(__func__, "overlap can't have a negative value");

Expand Down Expand Up @@ -263,8 +264,6 @@ json HttpIngestModule::_addDatabase() {
// the index.
databaseServices->saveIngestParam(database.name, "secondary-index", "auto-build",
to_string(enableAutoBuildDirectorIndex ? 1 : 0));
databaseServices->saveIngestParam(database.name, "secondary-index", "local-load",
to_string(enableLocalLoadDirectorIndex ? 1 : 0));

// Tell workers to reload their configurations
error = reconfigureWorkers(database, allWorkers, workerReconfigTimeoutSec());
Expand Down
2 changes: 1 addition & 1 deletion src/replica/HttpMetaModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using json = nlohmann::json;

namespace lsst::qserv::replica {

unsigned int const HttpMetaModule::version = 19;
unsigned int const HttpMetaModule::version = 20;

void HttpMetaModule::process(ServiceProvider::Ptr const& serviceProvider, string const& context,
qhttp::Request::Ptr const& req, qhttp::Response::Ptr const& resp,
Expand Down
12 changes: 0 additions & 12 deletions src/replica/HttpModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,6 @@ bool HttpModule::autoBuildDirectorIndex(string const& databaseName) const {
return false;
}

bool HttpModule::localLoadDirectorIndex(string const& database) const {
auto const databaseServices = controller()->serviceProvider()->databaseServices();
try {
DatabaseIngestParam const paramInfo =
databaseServices->ingestParam(database, "secondary-index", "local-load");
return paramInfo.value != "0";
} catch (DatabaseServicesNotFound const& ex) {
info(__func__, "the director index local-load mode was not specified");
}
return false;
}

DatabaseInfo HttpModule::getDatabaseInfo(string const& func, bool throwIfPublished) const {
debug(func);
auto const databaseServices = controller()->serviceProvider()->databaseServices();
Expand Down
13 changes: 0 additions & 13 deletions src/replica/HttpModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,6 @@ class HttpModule : public EventLogger, public HttpModuleBase {
*/
bool autoBuildDirectorIndex(std::string const& database) const;

/**
* Fetch a mode of loading contributions into the "director" index as requested by
* a catalog ingest workflow and recorded at the database creation time. A value of
* the parameter is recorded in a database.
*
* @param database The name of a database for which a value of the parameter
* is requested.
* @return 'true' if the index was requested to be loaded using MySQL protocol
* "LOAD DATA LOCAL INFILE" instead of just "LOAD DATA INFILE". See MySQL
* documentation for further explanation of the protocol.
*/
bool localLoadDirectorIndex(std::string const& database) const;

/**
* Get database info for a database that was specified in a request, either explicitly
* in attribute "database" or implicitly in attribute "transation_id". The method may
Expand Down
2 changes: 1 addition & 1 deletion src/www/qserv/js/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ define([

function(sqlFormatter) {
class Common {
static RestAPIVersion = 19;
static RestAPIVersion = 20;
static query2text(query, expanded) {
if (expanded) {
return sqlFormatter.format(query, Common._sqlFormatterConfig);
Expand Down

0 comments on commit fbe0972

Please sign in to comment.