-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Make vttestserver compatible with persistent data directories #7718
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice improvement to vttestserver
.
We have a unit test and an integration test (vttest_sample
) for this package.
vttest_sample
runs in docker on CI. Can you add some tests to cover the new functionality?
https://github.com/vitessio/vitess/blob/master/go/test/endtoend/vtcombo/vttest_sample_test.go
31a8237
to
2642859
Compare
I discovered an issue while integrating the new container into our development environment. The LocalCluster instance actually calls
This becomes problematic across reboots of the test container if the SQL migrations destroy tables – which is the case in the typical output of a Rails application's "schema dump" tool. Something like:
What would the Vitess team want this workflow to look like? I see two options:
|
Which one is easier for you as a user? I suspect it is the first one. |
2642859
to
d2ec4a8
Compare
Signed-off-by: Hormoz K <hkheradm@gmail.com>
Signed-off-by: Hormoz K <hkheradm@gmail.com>
d2ec4a8
to
08cdfe1
Compare
Correct suspicion indeed 😄 I have addressed all your feedback, tidied up the code, added the migration short-circuit, and wrote some tests. Would you please have a look at the latest commits? I found the e2e test in |
I'll re-review, but tests are failing
|
The endtoend test runs in docker, so it verifies that things work as expected in a docker environment. |
Signed-off-by: Hormoz K <hkheradm@gmail.com>
c51680c
to
fa98b7a
Compare
Signed-off-by: Hormoz K <hkheradm@gmail.com>
@deepthi this should be ready for review I think, I fixed the failing test and added the e2e test. The failing test is flaky on master as well, it seems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -251,6 +251,13 @@ docker_local: | |||
docker_mini: | |||
${call build_docker_image,docker/mini/Dockerfile,vitess/mini} | |||
|
|||
DOCKER_VTTESTSERVER_SUFFIX = mysql57 mysql80 | |||
DOCKER_VTTESTSERVER_TARGETS = $(addprefix docker_vttestserver_,$(DOCKER_VTTESTSERVER_SUFFIX)) | |||
$(DOCKER_VTTESTSERVER_TARGETS): docker_vttestserver_%: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a neat trick
func startPersistentCluster(dir string, flags ...string) (vttest.LocalCluster, error) { | ||
flags = append(flags, []string{ | ||
"-persistent_mode", | ||
// FIXME: if port is not provided, data_dir is not respected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FIXME
can be removed now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still a bug unfortunately. -data_dir=
needs to always be passed along with -port=
or it won't be respected 😬
It's not really something that concerns us day-to-day but I may give it an hour or two today to make a PR for it anyway, if it's a simple fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose we move forward without this fix in this PR and tackle this work separately. I can open an issue.
Edit: opened an issue
Description
This is an attempt at making the
vttestserver
container honour a persisted data directory.There were a few changes required to get here and I'm happy to split into multiple PRs:
vttestserver
binary did not correctly handle interruption signals. As such, thedefer cluster.TearDown()
was not run ingo/cmd/vttestserver/main.go
. I have added a signal handler to correctly run deferred functions.mysqlctl
binary was previously always run with theinit
subcommand. We now check if the directory provided in-data_dir
argument already exists, and if so, we use themysqlctl start
command instead!-keep_data
flag tovttestserver
binary. This will guard all existing invocations from the new codepath and keeps things backwards compatible.Related Issue(s)
Fixes #7717
Checklist
Deployment Notes
Impacted Areas in Vitess
Components that this PR will affect: