Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fdb 389 dump tools #75

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Conversation

danovaro
Copy link
Member

@danovaro danovaro commented Feb 6, 2025

fdb-dump-toc and fdb-dump-index where creating a TocHandler and passing to TocIndex ctor after a cast to TocCatalogue
The cast was failing since the object where created as TocHandler (superclass of TocCatalogue)

catalogue is no longer used in TocIndex, thus I've removed the offending cast

@danovaro danovaro changed the base branch from master to develop February 6, 2025 19:09
Copy link
Contributor

@mcakircali mcakircali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@@ -39,7 +39,7 @@ class TocEngine : public fdb5::Engine {
std::vector<eckit::URI> databases(const metkit::mars::MarsRequest& rq, const std::vector<eckit::PathName>& dirs,
const Config& config) const;

void scan_dbs(const std::string& path, std::list<std::string>& dbs) const;
void scan_dbs(const std::string& path, std::list<std::string>& dbs, bool lowercase = false) const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be removed

@@ -42,7 +42,7 @@ namespace fdb5 {

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

void TocEngine::scan_dbs(const std::string& path, std::list<std::string>& dbs) const {
void TocEngine::scan_dbs(const std::string& path, std::list<std::string>& dbs, bool lowercase) const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be moved into unnamed namespace
it's always lowercase=true, need it ?

@@ -1340,7 +1340,7 @@ std::vector<Index> TocHandler::loadIndexes(const Catalogue& catalogue, bool sort
s >> offset;
s >> type;
LOG_DEBUG(debug, LibFdb5) << "TocRecord TOC_INDEX " << path << " - " << offset << std::endl;
tocindexes[entry.seqNo] = new TocIndex(s, catalogue, entry.datap->header_.serialisationVersion_,
tocindexes[entry.seqNo] = new TocIndex(s, entry.datap->header_.serialisationVersion_,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you remove catalogue from 1- lambda, and 2- ::loadIndexes() .. also from enumerateMasked ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not this PR but can add threads.reserve(nthreads); above ?

@@ -98,7 +98,7 @@ void FDBRead::execute(const eckit::option::CmdArgs &args) {

std::unique_ptr<eckit::DataHandle> dh(handles.dataHandle());

dh->copyTo(out);
dh->saveInto(out);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have we changed copyTo into saveInto? That changes behaviour.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reverting to saveInto
with copyTo we lack the statistics

std::transform(keys.begin(), keys.end(), std::back_inserter(keystrings),
[](const Key& k) { return k.valuesToString(); });
std::set<std::string> keystrings;
for (const auto& key : keys) { keystrings.insert(key.valuesToString()); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What has motivated this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to remove duplicates (possible with very broad listing requests matching multiple rules at 1st level)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants