Skip to content

Commit

Permalink
Fixes after merging latest develop.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolau-manubens committed May 14, 2024
1 parent 95f1bbb commit c0f7406
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 52 deletions.
12 changes: 6 additions & 6 deletions src/fdb5/daos/DaosStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ bool DaosStore::uriExists(const eckit::URI& uri) const {

}

std::vector<eckit::URI> DaosStore::storeUnitURIs() const {
std::vector<eckit::URI> DaosStore::collocatedDataURIs() const {

std::vector<eckit::URI> store_unit_uris;
std::vector<eckit::URI> collocated_data_uris;

fdb5::DaosName db_cont{pool_, db_str_};

if (!db_cont.exists()) return store_unit_uris;
if (!db_cont.exists()) return collocated_data_uris;

for (const auto& oid : db_cont.listOIDs()) {

Expand All @@ -76,11 +76,11 @@ std::vector<eckit::URI> DaosStore::storeUnitURIs() const {

if (oid.otype() == DAOS_OT_KV_HASHED) continue;

store_unit_uris.push_back(fdb5::DaosArrayName(pool_, db_str_, oid).URI());
collocated_data_uris.push_back(fdb5::DaosArrayName(pool_, db_str_, oid).URI());

}

return store_unit_uris;
return collocated_data_uris;

}

Expand Down Expand Up @@ -135,7 +135,7 @@ std::unique_ptr<FieldLocation> DaosStore::archive(const Key &key, const void *da
/// - write (daos_array_write) -- always performed
h->write(data, length);

return std::make_unique<DaosFieldLocation>(n.URI(), 0, length, fdb5::Key());
return std::make_unique<DaosFieldLocation>(n.URI(), 0, length, fdb5::Key(nullptr, true));

/// @note: performed RPCs:
/// - close (daos_array_close here) -- always performed
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/daos/DaosStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DaosStore : public Store, public DaosCommon {
eckit::URI uri() const override;
bool uriBelongs(const eckit::URI&) const override;
bool uriExists(const eckit::URI&) const override;
std::vector<eckit::URI> storeUnitURIs() const override;
std::vector<eckit::URI> collocatedDataURIs() const override;
std::set<eckit::URI> asCollocatedDataURIs(const std::vector<eckit::URI>&) const override;

bool open() override { return true; }
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/daos/DaosWipeVisitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void DaosWipeVisitor::calculateResidualURIs() {
deleteStoreURIs.insert(storeURIs_.begin(), storeURIs_.end());

std::vector<eckit::URI> allStoreURIsVector;
for (const auto& u : store_.storeUnitURIs()) {
for (const auto& u : store_.collocatedDataURIs()) {
allStoreURIsVector.push_back(u);
}
std::set<eckit::URI> allStoreURIs(allStoreURIsVector.begin(), allStoreURIsVector.end());
Expand Down
3 changes: 2 additions & 1 deletion src/fdb5/database/Catalogue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ void Catalogue::visitEntries(EntryVisitor& visitor, const Store& store, bool sor
}
}

visitor.catalogueComplete(*this);
}

visitor.catalogueComplete(*this);

}

bool Catalogue::enabled(const ControlIdentifier& controlIdentifier) const {
Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/database/Key.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ namespace fdb5 {

//----------------------------------------------------------------------------------------------------------------------

Key::Key(const std::shared_ptr<TypesRegistry> reg) :
Key::Key(const std::shared_ptr<TypesRegistry> reg, bool canonical) :
keys_(),
registry_(reg), canonical_(false) {}
registry_(reg), canonical_(canonical) {}

Key::Key(const std::string &s, const Rule *rule) :
keys_(),
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/database/Key.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Key {

public: // methods

explicit Key(const std::shared_ptr<TypesRegistry> reg = nullptr);
explicit Key(const std::shared_ptr<TypesRegistry> reg = nullptr, bool canonical = false);
explicit Key(eckit::Stream &, const std::shared_ptr<TypesRegistry> reg = nullptr);
explicit Key(const std::string &keys, const Rule* rule);
explicit Key(const eckit::StringDict &keys, const std::shared_ptr<TypesRegistry> reg=nullptr);
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/database/Store.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Store {
virtual eckit::URI uri() const = 0;
virtual bool uriBelongs(const eckit::URI&) const = 0;
virtual bool uriExists(const eckit::URI& uri) const = 0;
virtual std::vector<eckit::URI> storeUnitURIs() const = 0;
virtual std::vector<eckit::URI> collocatedDataURIs() const = 0;
virtual std::set<eckit::URI> asCollocatedDataURIs(const std::vector<eckit::URI>&) const = 0;

protected: // members
Expand Down
6 changes: 3 additions & 3 deletions src/fdb5/toc/TocStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool TocStore::uriExists(const eckit::URI& uri) const {

}

std::vector<eckit::URI> TocStore::storeUnitURIs() const {
std::vector<eckit::URI> TocStore::collocatedDataURIs() const {

std::vector<eckit::PathName> files;
std::vector<eckit::PathName> dirs;
Expand Down Expand Up @@ -119,7 +119,7 @@ std::unique_ptr<FieldLocation> TocStore::archive(const Key &key, const void *dat

ASSERT(len == length);

return std::unique_ptr<TocFieldLocation>(new TocFieldLocation(dataPath, position, length, Key()));
return std::unique_ptr<TocFieldLocation>(new TocFieldLocation(dataPath, position, length, Key(nullptr, true)));
}

void TocStore::flush() {
Expand Down Expand Up @@ -289,7 +289,7 @@ void TocStore::moveTo(const Key& key, const Config& config, const eckit::URI& de
for (const eckit::PathName& root: StoreRootManager(config).canMoveToRoots(key)) {
if (root.sameAs(destPath)) {
eckit::PathName src_db = directory_;
eckit::PathName dest_db = destPath;
eckit::PathName dest_db = destPath / key.valuesToString();

dest_db.mkdir();
DIR* dirp = ::opendir(src_db.asString().c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/toc/TocStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TocStore : public Store, public TocCommon {
eckit::URI uri() const override;
bool uriBelongs(const eckit::URI&) const override;
bool uriExists(const eckit::URI&) const override;
std::vector<eckit::URI> storeUnitURIs() const override;
std::vector<eckit::URI> collocatedDataURIs() const override;
std::set<eckit::URI> asCollocatedDataURIs(const std::vector<eckit::URI>&) const override;

bool open() override { return true; }
Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/toc/TocWipeVisitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ void TocWipeVisitor::calculateResidualPaths() {

if (store_.type() == "file") return;

std::vector<eckit::URI> allStoreUnitURIs(store_.storeUnitURIs());
std::vector<eckit::URI> allCollocatedDataURIs(store_.collocatedDataURIs());
std::vector<eckit::PathName> allDataPathsVector;
for (const auto& u : allStoreUnitURIs) {
for (const auto& u : allCollocatedDataURIs) {
allDataPathsVector.push_back(eckit::PathName(u.path()));
}

Expand Down
41 changes: 21 additions & 20 deletions tests/fdb/daos/test_daos_catalogue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,19 @@ CASE("DaosCatalogue tests") {
};

fdb5::Config config{YAMLConfiguration(config_str)};
fdb5::Schema schema{schema_file()};

/// @note: a=11,b=22 instead of a=1,b=2 to avoid collision with potential parallel runs of store tests using a=1,b=2
fdb5::Key request_key{"a=11,b=22,c=3,d=4,e=5,f=6"};
fdb5::Key db_key{"a=11,b=22"};
fdb5::Key index_key{"c=3,d=4"};
fdb5::Key field_key{"e=5,f=6"};
fdb5::Key request_key({{"a", "11"}, {"b", "22"}, {"c", "3"}, {"d", "4"}, {"e", "5"}, {"f", "6"}});
fdb5::Key db_key({{"a", "11"}, {"b", "22"}}, schema.registry());
fdb5::Key index_key({{"c", "3"}, {"d", "4"}}, schema.registry());
fdb5::Key field_key({{"e", "5"}, {"f", "6"}}, schema.registry());

// archive

/// DaosManager is configured with client config from the file
std::unique_ptr<fdb5::FieldLocation> loc(new fdb5::DaosFieldLocation(
eckit::URI{"daos", "test_uri"}, eckit::Offset(0), eckit::Length(1), fdb5::Key()
eckit::URI{"daos", "test_uri"}, eckit::Offset(0), eckit::Length(1), fdb5::Key(nullptr, true)
));

{
Expand Down Expand Up @@ -296,10 +297,10 @@ CASE("DaosCatalogue tests") {

// request

fdb5::Key request_key{"a=11,b=22,c=3,d=4,e=5,f=6"};
fdb5::Key db_key{"a=11,b=22"};
fdb5::Key index_key{"c=3,d=4"};
fdb5::Key field_key{"e=5,f=6"};
fdb5::Key request_key({{"a", "11"}, {"b", "22"}, {"c", "3"}, {"d", "4"}, {"e", "5"}, {"f", "6"}});
fdb5::Key db_key({{"a", "11"}, {"b", "22"}});
fdb5::Key index_key({{"c", "3"}, {"d", "4"}});
fdb5::Key field_key({{"e", "5"}, {"f", "6"}});

// store data

Expand Down Expand Up @@ -387,10 +388,10 @@ CASE("DaosCatalogue tests") {

// request

fdb5::Key request_key{"a=11,b=22,c=3,d=4,e=5,f=6"};
fdb5::Key db_key{"a=11,b=22"};
fdb5::Key index_key{"c=3,d=4"};
fdb5::Key field_key{"e=5,f=6"};
fdb5::Key request_key({{"a", "11"}, {"b", "22"}, {"c", "3"}, {"d", "4"}, {"e", "5"}, {"f", "6"}});
fdb5::Key db_key({{"a", "11"}, {"b", "22"}});
fdb5::Key index_key({{"c", "3"}, {"d", "4"}});
fdb5::Key field_key({{"e", "5"}, {"f", "6"}});

// store data

Expand Down Expand Up @@ -496,9 +497,9 @@ CASE("DaosCatalogue tests") {

// request

fdb5::Key request_key{"a=11,b=22,c=3,d=4,e=5,f=6"};
fdb5::Key index_key{"a=11,b=22,c=3,d=4"};
fdb5::Key db_key{"a=11,b=22"};
fdb5::Key request_key({{"a", "11"}, {"b", "22"}, {"c", "3"}, {"d", "4"}, {"e", "5"}, {"f", "6"}});
fdb5::Key db_key({{"a", "11"}, {"b", "22"}});
fdb5::Key index_key({{"a", "11"}, {"b", "22"}, {"c", "3"}, {"d", "4"}});

fdb5::FDBToolRequest full_req{
request_key.request("retrieve"),
Expand Down Expand Up @@ -711,10 +712,10 @@ CASE("DaosCatalogue tests") {

// request

fdb5::Key request_key{"a=11,b=22,d=4,f=6"};
fdb5::Key request_key2{"a=11,b=22,d=4,e=5,f=6"};
fdb5::Key index_key{"a=11,b=22,d=4"};
fdb5::Key db_key{"a=11,b=22"};
fdb5::Key request_key({{"a", "11"}, {"b", "22"}, {"d", "4"}, {"f", "6"}});
fdb5::Key request_key2({{"a", "11"}, {"b", "22"}, {"d", "4"}, {"e", "5"}, {"f", "6"}});
fdb5::Key db_key({{"a", "11"}, {"b", "22"}});
fdb5::Key index_key({{"a", "11"}, {"b", "22"}, {"d", "4"}});

fdb5::FDBToolRequest full_req{
request_key.request("retrieve"),
Expand Down
26 changes: 13 additions & 13 deletions tests/fdb/daos/test_daos_store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ CASE("DaosStore tests") {

fdb5::Schema schema{schema_file()};

fdb5::Key request_key{"a=1,b=2,c=3,d=4,e=5,f=6"};
fdb5::Key db_key{"a=1,b=2"};
fdb5::Key index_key{"c=3,d=4"};
fdb5::Key request_key({{"a", "1"}, {"b", "2"}, {"c", "3"}, {"d", "4"}, {"e", "5"}, {"f", "6"}});
fdb5::Key db_key({{"a", "1"}, {"b", "2"}}, schema.registry());
fdb5::Key index_key({{"c", "3"}, {"d", "4"}});

char data[] = "test";

Expand Down Expand Up @@ -246,10 +246,10 @@ CASE("DaosStore tests") {

// request

fdb5::Key request_key{"a=1,b=2,c=3,d=4,e=5,f=6"};
fdb5::Key db_key{"a=1,b=2"};
fdb5::Key index_key{"c=3,d=4"};
fdb5::Key field_key{"e=5,f=6"};
fdb5::Key request_key({{"a", "1"}, {"b", "2"}, {"c", "3"}, {"d", "4"}, {"e", "5"}, {"f", "6"}});
fdb5::Key db_key({{"a", "1"}, {"b", "2"}}, schema.registry());
fdb5::Key index_key({{"c", "3"}, {"d", "4"}}, schema.registry());
fdb5::Key field_key({{"e", "5"}, {"f", "6"}}, schema.registry());

// store data

Expand Down Expand Up @@ -347,9 +347,9 @@ CASE("DaosStore tests") {

// request

fdb5::Key request_key{"a=1,b=2,c=3,d=4,e=5,f=6"};
fdb5::Key index_key{"a=1,b=2,c=3,d=4"};
fdb5::Key db_key{"a=1,b=2"};
fdb5::Key request_key({{"a", "1"}, {"b", "2"}, {"c", "3"}, {"d", "4"}, {"e", "5"}, {"f", "6"}});
fdb5::Key db_key({{"a", "1"}, {"b", "2"}});
fdb5::Key index_key({{"a", "1"}, {"b", "2"}, {"c", "3"}, {"d", "4"}});

fdb5::FDBToolRequest full_req{
request_key.request("retrieve"),
Expand Down Expand Up @@ -499,9 +499,9 @@ CASE("DaosStore tests") {

// request

fdb5::Key request_key{"a=1,b=2,c=3,d=4,e=5,f=6"};
fdb5::Key index_key{"a=1,b=2,c=3,d=4"};
fdb5::Key db_key{"a=1,b=2"};
fdb5::Key request_key({{"a", "1"}, {"b", "2"}, {"c", "3"}, {"d", "4"}, {"e", "5"}, {"f", "6"}});
fdb5::Key db_key({{"a", "1"}, {"b", "2"}});
fdb5::Key index_key({{"a", "1"}, {"b", "2"}, {"c", "3"}, {"d", "4"}});

fdb5::FDBToolRequest full_req{
request_key.request("retrieve"),
Expand Down

0 comments on commit c0f7406

Please sign in to comment.