Skip to content

Commit daefd65

Browse files
committed
Margo 0.18.0 removed deprecated calls to margo_get_pool_by_index, breaking provDB compilation. This has now been fixed by detecting at configure time whether the old call is supported and using the new call if not
provdb_admin now uses the commandLineArg interface for dealing with the module name so that it appears automatically in the help information
1 parent 459e2b1 commit daefd65

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

app/provdb_admin.cpp

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,19 @@ struct ProvdbArgs{
153153
db_use_aggregator(false), db_batch_size(64), db_bypass_unqlite(true), db_mercury_auth_key(""){}
154154
};
155155

156-
157-
156+
//Assumes global margo_id has been set!
157+
tl::pool getPool(uint32_t pool_idx){
158+
#ifdef USE_MARGO_DEPRECATED_GET_POOL_BY_INDEX
159+
ABT_pool p;
160+
assert(margo_get_pool_by_index(margo_id, pool_idx, &p) == 0);
161+
return tl::pool(p);
162+
#else
163+
margo_pool_info p;
164+
assert(margo_find_pool_by_index(margo_id, pool_idx, &p) == 0);
165+
return tl::pool(p.pool);
166+
#endif
167+
}
168+
158169
int main(int argc, char** argv) {
159170
{
160171
//Parse environment variables
@@ -169,6 +180,10 @@ int main(int argc, char** argv) {
169180
//Using an empty string will cause it to default to Mochi's default ip/port
170181
ProvdbArgs args;
171182
commandLineParser parser;
183+
184+
std::string module;
185+
186+
parser.addMandatoryArg(module, "Specify the module name");
172187
addMandatoryCommandLineArg(parser, args, ip, "Specify the ip address and port in the format \"${ip}:${port}\". Using an empty string will cause it to default to Mochi's default ip/port.");
173188
addOptionalCommandLineArg(parser, args, engine, "Specify the Thallium/Margo engine type (default \"ofi+tcp\")");
174189
addOptionalCommandLineArg(parser, args, autoshutdown, "If enabled the provenance DB server will automatically shutdown when all of the clients have disconnected (default true)");
@@ -185,14 +200,12 @@ int main(int argc, char** argv) {
185200
addOptionalCommandLineArg(parser, args, db_bypass_unqlite, "Use Sonata's bypass method for faster unqlite stores (default true)");
186201
addOptionalCommandLineArgMultiValue(parser, args, server_instance, "Provide the index of the server instance and the total number of instances (if using more than 1) in the format \"$instance $ninstances\" (default \"0 1\")", server_instance, ninstances);
187202

188-
if(argc < 2 || argc-2 < parser.nMandatoryArgs() || (argc == 3 && std::string(argv[2]) == "-help")){
203+
if(argc < 1 || argc-1 < parser.nMandatoryArgs() || (argc == 2 && std::string(argv[1]) == "-help")){
189204
parser.help(std::cout);
190205
return 0;
191206
}
192207

193-
std::string module = argv[1];
194-
195-
parser.parseCmdLineArgs(argc-1, argv+1);
208+
parser.parseCmdLineArgs(argc, argv);
196209

197210
//Check arguments
198211
if(args.nshards < 1) throw std::runtime_error("Must have at least 1 database shard");
@@ -305,20 +318,14 @@ int main(int argc, char** argv) {
305318
margo_args.json_config = new_config.c_str();
306319
margo_id = margo_init_ext(eng_opt.c_str(), MARGO_SERVER_MODE, &margo_args);
307320

321+
322+
308323
//Get the thallium pools to pass to the providers
309324
tl::pool glob_pool;
310-
if(instance_do_global_db){
311-
ABT_pool p;
312-
assert(margo_get_pool_by_index(margo_id, glob_pool_idx, &p) == 0);
313-
glob_pool = tl::pool(p);
314-
}
325+
if(instance_do_global_db) glob_pool = getPool(glob_pool_idx);
315326

316327
std::vector<tl::pool> shard_pools(nshard_instance);
317-
for(int s=0;s<nshard_instance;s++){
318-
ABT_pool p;
319-
assert(margo_get_pool_by_index(margo_id, s+shard_pool_offset, &p) == 0);
320-
shard_pools[s] = tl::pool(p);
321-
}
328+
for(int s=0;s<nshard_instance;s++) shard_pools[s] = getPool(s+shard_pool_offset);
322329

323330
tl::engine engine(margo_id);
324331

configure.ac

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,23 @@ AM_CONDITIONAL(ENABLE_PROVDB, test "$enable_provenancedb" != "no")
192192
if test "$enable_provenancedb" != "no"; then
193193
AC_MSG_NOTICE([Provenance DB will be built])
194194
AC_DEFINE([ENABLE_PROVDB], [1], [Enable the provenance database])
195+
196+
#In Margo 0.18.0 they deprecated calls to margo_get_pool_by_index
197+
AC_COMPILE_IFELSE(
198+
[
199+
AC_LANG_PROGRAM(
200+
[[ #include<margo.h>
201+
]], [[ ABT_pool p; margo_get_pool_by_index(0,0,&p);
202+
]]
203+
)
204+
], [use_deprecated_margo_call=yes], [use_deprecated_margo_call=no]
205+
)
206+
if test "x${use_deprecated_margo_call}" = "xyes"; then
207+
AC_MSG_NOTICE([Allowing deprecated margo_get_pool_by_index calls])
208+
AC_DEFINE([USE_MARGO_DEPRECATED_GET_POOL_BY_INDEX], [1], [Allow calls to margo_get_pool_by_index])
209+
else
210+
AC_MSG_NOTICE([Disallowing deprecated margo_get_pool_by_index calls])
211+
fi
195212
fi
196213

197214

0 commit comments

Comments
 (0)