From 2ec9cb7c06161c071b3cddfe7fa15050c5bfe6d1 Mon Sep 17 00:00:00 2001 From: Igor Gaponenko Date: Wed, 12 Jul 2023 02:34:19 +0000 Subject: [PATCH] Fixed a bug to require the director tables to be published Incremented the versin number of the REST API to 22. --- .../lsst/qserv/admin/replicationInterface.py | 2 +- src/replica/HttpDirectorIndexModule.cc | 19 +++++++++---------- src/replica/HttpMetaModule.cc | 2 +- src/www/dashboard.html | 2 +- src/www/qserv/js/Common.js | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/admin/python/lsst/qserv/admin/replicationInterface.py b/src/admin/python/lsst/qserv/admin/replicationInterface.py index 278303447..0968d1183 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 = 21 + self.repl_api_version = 22 _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 d4c000ce2..105299813 100644 --- a/src/replica/HttpDirectorIndexModule.cc +++ b/src/replica/HttpDirectorIndexModule.cc @@ -59,14 +59,16 @@ json HttpDirectorIndexModule::executeImpl(string const& subModuleName) { json HttpDirectorIndexModule::_buildDirectorIndex() { debug(__func__); - checkApiVersion(__func__, 21); + checkApiVersion(__func__, 22); auto const databaseServices = controller()->serviceProvider()->databaseServices(); auto const config = controller()->serviceProvider()->config(); string const databaseName = body().required("database"); string const directorTableName = body().required("director_table"); - bool const allowForPublished = body().optional("allow_for_published", 0) != 0; + if (body().has("allow_for_published")) { + warn("Option 'allow_for_published' is obsolete as of the version 22 of the API."); + } bool const rebuild = body().optional("rebuild", 0) != 0; if (body().has("local")) { warn("Option 'local' is obsolete as of the version 20 of the API."); @@ -74,23 +76,20 @@ json HttpDirectorIndexModule::_buildDirectorIndex() { debug(__func__, "database=" + databaseName); debug(__func__, "director_table=" + directorTableName); - debug(__func__, "allow_for_published=" + bool2str(allowForPublished)); debug(__func__, "rebuild=" + bool2str(rebuild)); auto const database = config->databaseInfo(databaseName); - if (database.isPublished and !allowForPublished) { - string const msg = "database '" + database.name + - "' is already published. Use 'allow_for_published' option to " - "override the restriction."; - throw HttpError(__func__, msg); - } auto const table = database.findTable(directorTableName); if (!table.isDirector) { string const msg = "table '" + table.name + "' is not configured as a director table in database '" + database.name + "'"; throw HttpError(__func__, msg); } - + if (!table.isPublished) { + string const msg = " the director table '" + table.name + "' of the database '" + database.name + + "' is not published."; + throw HttpError(__func__, msg); + } // Look for the optional parameter defining the uniqueness of the index's keys // assuming the current configuration of the table as the default. bool const uniquePrimaryKey = diff --git a/src/replica/HttpMetaModule.cc b/src/replica/HttpMetaModule.cc index 650140c86..ab87d794b 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 = 21; +unsigned int const HttpMetaModule::version = 22; void HttpMetaModule::process(ServiceProvider::Ptr const& serviceProvider, string const& context, qhttp::Request::Ptr const& req, qhttp::Response::Ptr const& resp, diff --git a/src/www/dashboard.html b/src/www/dashboard.html index 6e81101f7..b9c9918fd 100644 --- a/src/www/dashboard.html +++ b/src/www/dashboard.html @@ -4,7 +4,7 @@ Qserv monitoring dashboard - + diff --git a/src/www/qserv/js/Common.js b/src/www/qserv/js/Common.js index 198d7fc87..1988b1436 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 = 21; + static RestAPIVersion = 22; static query2text(query, expanded) { if (expanded) { return sqlFormatter.format(query, Common._sqlFormatterConfig);