Skip to content

Commit

Permalink
Fixed a bug to require the director tables to be published
Browse files Browse the repository at this point in the history
Incremented the versin number of the REST API to 22.
  • Loading branch information
iagaponenko committed Jul 12, 2023
1 parent eddace0 commit 2ec9cb7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 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 = 21
self.repl_api_version = 22
_log.debug(f"ReplicationInterface %s", self.repl_ctrl)

def version(self) -> str:
Expand Down
19 changes: 9 additions & 10 deletions src/replica/HttpDirectorIndexModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,38 +59,37 @@ 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<string>("database");
string const directorTableName = body().required<string>("director_table");
bool const allowForPublished = body().optional<int>("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<int>("rebuild", 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));

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 =
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 = 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,
Expand Down
2 changes: 1 addition & 1 deletion src/www/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Qserv monitoring dashboard</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script data-main="qserv/js/QservMonitoringDashboard.js?bust=65" src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
<script data-main="qserv/js/QservMonitoringDashboard.js?bust=66" src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
</head>
<body></body>
</html>
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 = 21;
static RestAPIVersion = 22;
static query2text(query, expanded) {
if (expanded) {
return sqlFormatter.format(query, Common._sqlFormatterConfig);
Expand Down

0 comments on commit 2ec9cb7

Please sign in to comment.