Skip to content

Fix issue with Database class#276

Merged
ckendrick merged 5 commits into
masterfrom
database_fix
May 16, 2024
Merged

Fix issue with Database class#276
ckendrick merged 5 commits into
masterfrom
database_fix

Conversation

@ckendrick

Copy link
Copy Markdown
Collaborator

This adds a return statement to the base Database functions open() and create(). Without these, calls to endSamples() and writeSnapshot() would hang indefinitely printing newlines to screen.

This also adds a test to the CI that calls writeSnapshot() to catch this behavior in the future.

@ckendrick ckendrick added bug RFR Ready for review labels Mar 11, 2024
Comment thread unit_tests/smoke_static.cpp
@dylan-copeland

Copy link
Copy Markdown
Collaborator

@ckendrick can you please provide an example test that demonstrates the issue?

@ckendrick

Copy link
Copy Markdown
Collaborator Author

@dylan-copeland this issue should occur if you run any example from the current upstream branch during the offline phase. This should happen to any code that calls endSamples() or writeSnapshot(). Some examples I tried were
dg_advection_global_rom -offline
poisson_global_rom -offline -f 1.0 -id 0

Comment thread lib/utils/Database.cpp
Comment thread lib/utils/Database.cpp
Database::create(const std::string& file_name)
{
std::cout << "Creating file: " << file_name << std::endl;
return true;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this change is already made at #274 . I'm open to @dylan-copeland 's suggestion.

@chldkdtn

Copy link
Copy Markdown
Collaborator

@dylan-copeland would you review this PR again?

@chldkdtn

chldkdtn commented May 2, 2024

Copy link
Copy Markdown
Collaborator

@dreamer2368 do you approve this PR?

Comment thread lib/utils/Database.cpp
Comment thread lib/utils/Database.cpp
Comment thread lib/utils/HDFDatabase.cpp
Comment thread lib/utils/HDFDatabase.cpp
Comment thread lib/utils/HDFDatabaseMPIO.cpp
Comment thread lib/utils/HDFDatabaseMPIO.cpp
Comment thread lib/utils/CSVDatabase.cpp
@chldkdtn

chldkdtn commented May 9, 2024

Copy link
Copy Markdown
Collaborator

@dylan-copeland we need your review again on this PR.

// Finalize MPI and return.
MPI_Finalize();
return !status;
return 0;

@dylan-copeland dylan-copeland May 10, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like the goal of this test is just to run without failing? There is nothing checked, like in test_Matrix.cpp where EXPECT* functions are called. Is this the intention?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes this test was added to the CI only intending to be a quick check if an error occurred with endSamples()/writeSnapshot(). The issue that caused this problem has since been fixed, but the only test I could find that uses these functions is in test_HDFDatabase.cpp which is restricted to parallel HDF5 builds only.
In the future, we should provide a serial test in test_HDFDatabase.cpp and remove this test (and other outdated/unused tests).

Comment thread lib/utils/Database.cpp
@ckendrick ckendrick merged commit d7b275e into master May 16, 2024
@dylan-copeland dylan-copeland deleted the database_fix branch May 17, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug RFR Ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants