-
Notifications
You must be signed in to change notification settings - Fork 552
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
Check that the data dir exists #15821
Check that the data dir exists #15821
Conversation
On hold since there is a complication with the rp test fixture which seems to be often used with a non-existent data dir (and yet we don't fail on the pid file creation I guess because the fixture disables that). |
528ba13
9471c82
to
528ba13
Compare
If you start up Redpanda point to a data dir that doesn't exist, the error is fairly obscure: a std::system_error mentioning failed to open but no indication of _what_ we were trying to open. This has tripped up several people, including externally so let's just fix it. We apply a check that the directory exists immediately before creating the pidfile, which is the place that will fail first in practice if the directory does not exist. Pidfiles are enabled by default, but are disabled in some places, e.g., our fixture tests: if we *don't* create a pidfile we do not require the directory to exist, it will be created automatically, so we don't check existence in that case.
528ba13
to
1e86350
Compare
It seems like at the introduction of pifiles ~4 years ago the Redpanda behavior flipped from creating the data dir if it didn't exist, to failing if it didn't exist, perhaps by accident as we do the pidfile creation very early (as we should) which happens to be before the place we create the directories. At least, that's how the code looks currently: if no pidfile is specified we explicitly create the data dir (and any required path components leading up to it) later on in initialization (and the fixture tests I mention rely on this behavior). So arguably there might be a "bug" here since it's already the well-established behavior by now that we fail to start up with pidfile + missing data dir, I'm just going to keep it that way, but I move the data dir check into the |
ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/43778#018d0e02-d23f-4159-aa93-b672d85d337c |
If you start up Redpanda point to a data dir that doesn't exist, the error is fairly obscure: a std::system_error mentioning failed to open but no indication of what we were trying to open.
This has tripped up several people, including externally (and yours truly) so let's just fix it.
Backports Required
Release Notes
Improvements