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

More Fine Grained Control for Loading Native JDBC Lib #1154

Open
belugabehr opened this issue Aug 7, 2024 · 6 comments
Open

More Fine Grained Control for Loading Native JDBC Lib #1154

belugabehr opened this issue Aug 7, 2024 · 6 comments

Comments

@belugabehr
Copy link

Is your feature request related to a problem? Please describe.
Follow-up to #1140.

For the greatest amount of deployment safety, I have configured my application to use a static copy of sqlitejdbc.so via -Dorg.sqlite.lib.path that gets deployed alongside the application. There are however some issues with this approach:

  1. The cleanup routine gets run every time, even though the JDBC native lib will never be present there - this adds startup time that is variable as it depends on the number of items that happen to be at /tmp at any given time
  2. Logging is not sufficient and therefore if the org.sqlite.lib.path option is misconfigured, it is not easy to identify. That is to say, if the JDBC native lib is missing, or if the lib.path is incorrect, then it silently fails and falls-back to loading from the JAR resources (and using /tmp) and there is no indication that this has happened.

Describe the solution you'd like
Make the default to load from JAR resources, but allow users to explicitly specify (e.g., -Dorg.sqlite.lib.location ) where the native JDBC lib should be loaded from. If it cannot be loaded, the behavior should be to fail-fast, not fall-back.

Added logging (at least DEBUG, maybe INFO) where the Native JDBC lib file is loaded from.

@gotson
Copy link
Collaborator

gotson commented Aug 12, 2024

If it cannot be loaded, the behavior should be to fail-fast, not fall-back.

Can you explain why you would not want fallback ?

Added logging (at least DEBUG, maybe INFO) where the Native JDBC lib file is loaded from.

PR welcome

@belugabehr
Copy link
Author

Can you explain why you would not want fallback ?

Sure! Basically, if I misconfigure my application, I would rather it fail-fast than to fall-back. I very much want it to use the static copy of the JDBC native library I have deployed alongside my app. If it falls-back, then the fact that it is misconfigured is hidden from me and everything looks like it is working as expected.

@gotson
Copy link
Collaborator

gotson commented Aug 21, 2024

IMHO if you set both -Dorg.sqlite.lib.path and -Dorg.sqlite.lib.name, then we should not fallback, and disable cleanup. That would be a breaking change though.

Or we need a new option to disable cleanup, and disable fallback.

@belugabehr
Copy link
Author

Or we need a new option to disable cleanup, and disable fallback.

Ya, as I understand the cleanup/lock-file aspect of it, it was added to workaround a windows issue. This is really the thing that has been causing me heartburn in my production environment. Maybe we can enable these features only in Windows environment, otherwise, in Linux environments, just drop the file into /tmp, load it, delete it.

Would that be acceptable?

@gotson
Copy link
Collaborator

gotson commented Aug 21, 2024

I feel like having a dedicated property to disable cleanup would be the way to go. It would be non-breaking, and can be opt-in.

@gotson
Copy link
Collaborator

gotson commented Aug 26, 2024

To reduce the cleanup time you could use org.sqlite.tmpdir

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

No branches or pull requests

2 participants