Make vttestserver compatible with persistent data directories#7718
Make vttestserver compatible with persistent data directories#7718deepthi merged 4 commits intovitessio:masterfrom
Conversation
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 |
|
|
||
| DOCKER_VTTESTSERVER_SUFFIX = mysql57 mysql80 | ||
| DOCKER_VTTESTSERVER_TARGETS = $(addprefix docker_vttestserver_,$(DOCKER_VTTESTSERVER_SUFFIX)) | ||
| $(DOCKER_VTTESTSERVER_TARGETS): docker_vttestserver_%: |
| 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.
The FIXME can be removed now?
There was a problem hiding this comment.
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.
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
vttestservercontainer honour a persisted data directory.There were a few changes required to get here and I'm happy to split into multiple PRs:
vttestserverbinary 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.mysqlctlbinary was previously always run with theinitsubcommand. We now check if the directory provided in-data_dirargument already exists, and if so, we use themysqlctl startcommand instead!-keep_dataflag tovttestserverbinary. 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: