MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / check_usenames

Function check_usenames

tools/comdb2ar/util.cpp:358–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358bool check_usenames(const std::string& dbname, const std::string& dbdir, bool nonames) {
359 int rc;
360 struct stat st;
361 bool found_usenames = false;
362 bool found_nonames = false;
363
364 rc = stat((dbdir + "/" + dbname + ".txn").c_str(), &st);
365 if (rc == 0 && S_ISDIR(st.st_mode)) {
366 rc = stat((dbdir + "/" + dbname + ".txn/checkpoint").c_str(), &st);
367 if (rc == 0 && S_ISREG(st.st_mode))
368 found_usenames = true;
369 }
370
371 rc = stat((dbdir + "/" + "logs").c_str(), &st);
372 if (rc == 0 && S_ISDIR(st.st_mode)) {
373 rc = stat((dbdir + "/" + "logs/checkpoint").c_str(), &st);
374 if (rc == 0 && S_ISREG(st.st_mode))
375 found_nonames = true;
376 }
377
378 /* bias by parse_lrl_file told us, but use the other if we can find it */
379 if (nonames && found_nonames == false && found_usenames == true)
380 nonames = false;
381
382 if (nonames == false && found_usenames == false && found_nonames == true)
383 nonames = true;
384
385 return nonames;
386}

Callers 3

serialise_databaseFunction · 0.85
create_partialsFunction · 0.85
restore_partialsFunction · 0.85

Calls 1

statClass · 0.70

Tested by

no test coverage detected