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

Set DB_CLOSE_DELAY for Raptor H2 #12777

Merged
merged 1 commit into from
Jun 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import static io.airlift.configuration.ConditionalModule.conditionalModule;
import static io.airlift.configuration.ConfigBinder.configBinder;
import static java.lang.String.format;

public class DatabaseMetadataModule
extends AbstractConfigurationAwareModule
Expand Down Expand Up @@ -85,7 +86,7 @@ public void configure(Binder binder)
@ForMetadata
public static ConnectionFactory createConnectionFactory(H2DatabaseConfig config)
{
String url = "jdbc:h2:" + config.getFilename();
String url = format("jdbc:h2:%s;DB_CLOSE_DELAY=-1", config.getFilename());
Copy link
Member

Choose a reason for hiding this comment

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

Worth documenting why DB_CLOSE_DELAY matters?

Copy link
Member

Choose a reason for hiding this comment

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

per h2 docs, DB_CLOSE_DELAY=-1 will keep database around for longer (which is probably desireable in the tests)
i expect this will address some H2 related failures that i observed in my stress test #12730
will this also prevent OOM? why?
intuitively DB_CLOSE_DELAY=-1 increases memory usage, not decreases.

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 have no idea. It's been there forever.

return () -> DriverManager.getConnection(url);
}

Expand Down