From fbe0972adea0df36bd0bb7bcb98b93165b441287 Mon Sep 17 00:00:00 2001 From: Igor Gaponenko Date: Mon, 19 Jun 2023 16:45:03 -0700 Subject: [PATCH] Eliminated the "local" index construction option from the REST API 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. --- .../python/lsst/qserv/admin/replicationInterface.py | 2 +- src/replica/HttpDirectorIndexModule.cc | 5 +++-- src/replica/HttpIngestModule.cc | 7 +++---- src/replica/HttpMetaModule.cc | 2 +- src/replica/HttpModule.cc | 12 ------------ src/replica/HttpModule.h | 13 ------------- src/www/qserv/js/Common.js | 2 +- 7 files changed, 9 insertions(+), 34 deletions(-) diff --git a/src/admin/python/lsst/qserv/admin/replicationInterface.py b/src/admin/python/lsst/qserv/admin/replicationInterface.py index 7593be258d..1a87ffbc6a 100644 --- a/src/admin/python/lsst/qserv/admin/replicationInterface.py +++ b/src/admin/python/lsst/qserv/admin/replicationInterface.py @@ -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: diff --git a/src/replica/HttpDirectorIndexModule.cc b/src/replica/HttpDirectorIndexModule.cc index 6e78bfe8b7..d8e82097da 100644 --- a/src/replica/HttpDirectorIndexModule.cc +++ b/src/replica/HttpDirectorIndexModule.cc @@ -68,13 +68,14 @@ json HttpDirectorIndexModule::_buildDirectorIndex() { string const directorTableName = body().optional("director_table", string()); bool const allowForPublished = body().optional("allow_for_published", 0) != 0; bool const rebuild = body().optional("rebuild", 0) != 0; - bool const localFile = body().optional("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) { diff --git a/src/replica/HttpIngestModule.cc b/src/replica/HttpIngestModule.cc index fbc4027472..315f5a034a 100644 --- a/src/replica/HttpIngestModule.cc +++ b/src/replica/HttpIngestModule.cc @@ -198,14 +198,15 @@ json HttpIngestModule::_addDatabase() { auto const numSubStripes = body().required("num_sub_stripes"); auto const overlap = body().required("overlap"); auto const enableAutoBuildDirectorIndex = body().optional("auto_build_secondary_index", 1); - auto const enableLocalLoadDirectorIndex = body().optional("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"); @@ -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()); diff --git a/src/replica/HttpMetaModule.cc b/src/replica/HttpMetaModule.cc index 18983cf76e..64b7aa263c 100644 --- a/src/replica/HttpMetaModule.cc +++ b/src/replica/HttpMetaModule.cc @@ -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, diff --git a/src/replica/HttpModule.cc b/src/replica/HttpModule.cc index 312c61a1f7..8234778a93 100644 --- a/src/replica/HttpModule.cc +++ b/src/replica/HttpModule.cc @@ -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(); diff --git a/src/replica/HttpModule.h b/src/replica/HttpModule.h index 2e28509261..10c089eaaf 100644 --- a/src/replica/HttpModule.h +++ b/src/replica/HttpModule.h @@ -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 diff --git a/src/www/qserv/js/Common.js b/src/www/qserv/js/Common.js index 531d9dd521..1ec3f9eccc 100644 --- a/src/www/qserv/js/Common.js +++ b/src/www/qserv/js/Common.js @@ -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);