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

Added cluster setup using go processes #5346

Merged
merged 19 commits into from
Nov 23, 2019

Conversation

arindamnayak
Copy link
Contributor

Signed-off-by: Arindam Nayak [email protected]

Added cluster setup using go processes (vttablet, vtctld, vtgate etc.. processes).
Added clustertest to verify if cluster setup is working.
Migrated 2 of go/vt/vtgate/endtoend/ test to use the new cluster setup.

@arindamnayak arindamnayak force-pushed the cluster_for_test branch 3 times, most recently from 9eda3b1 to d294d2a Compare October 25, 2019 07:17
Signed-off-by: Arindam Nayak <[email protected]>
dev.env Outdated Show resolved Hide resolved
@deepthi
Copy link
Member

deepthi commented Oct 28, 2019

We should be able to run the tests in local environment, not just in docker.

* transaction mode and vschema test cases

Signed-off-by: Ajeet jain <[email protected]>

* review comments implemented

Signed-off-by: Ajeet jain <[email protected]>
@arindamnayak arindamnayak force-pushed the cluster_for_test branch 3 times, most recently from 10bdaee to d5a16ad Compare October 30, 2019 08:05
@deepthi
Copy link
Member

deepthi commented Oct 31, 2019

W1030 19:39:55.158670   23792 plugin_mysql_server.go:426] Found existent socket when trying to create new unix mysql listener: /tmp/mysql.sock, attempting to clean up

How are you ensuring that when we start more than one vttablet+mysql, each mysql is running on a different socket?

@deepthi
Copy link
Member

deepthi commented Oct 31, 2019

I have verified that I can run go test on my dev machine, and it works fine, no docker necessary.

@arindamnayak
Copy link
Contributor Author

/tmp/mysql.sock,

We execute mysqlctl here, there we specify the tablet_uid which is unique for each tablets, at that point different vt_0000XXX directory is created, where mysql socket file is created under such tablet directories. The following lines , create tablet and uses the same tablet_uid created just before, which ensures the corresponding tablet uses the socket file under that directory.

Regarding the warning, /tmp/mysql.sock, attempting to clean up, I have never got it (not even in docker), but in ajeet got such warning. I think it is related to the mysql connection we make for testing e.g. here. I have also noticed such warning (I mean earlier, outside of vitess project) when I try do mysql connection from console (mysql -uroot -p).

@deepthi
Copy link
Member

deepthi commented Nov 1, 2019

E1031 17:08:00.560412   30510 cluster_process.go:121] mkdir /home/go/vtdataroot/backups: file exists
E1031 17:09:15.040979   30801 cluster_process.go:121] mkdir /home/go/vtdataroot/tmp: file exists

when these errors occur, the tests fail. Can we try to mkdir only if the directory doesn't already exist?

@arindamnayak
Copy link
Contributor Author

e direc

@deepthi , this is already taken care, please check this file. Also I changed the code to not use tmp directory, currently it uses tmp_{random_id} as directory name, so that parallel execution won't conflict.For backups directory, it check if directory is present then don't create it.

Please take latest update and then run the tests.

deepthi
deepthi previously requested changes Nov 5, 2019
go/test/endtoend/cluster/vttablet_process.go Outdated Show resolved Hide resolved
go/test/endtoend/cluster/vttablet_process.go Outdated Show resolved Hide resolved
test/config.json Outdated Show resolved Hide resolved
Copy link
Contributor

@sougou sougou left a comment

Choose a reason for hiding this comment

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

Nice work. Very readable code. I caught one issue on the random number generation. I'm surprised any tests ran successfully in parallel.

}

func getRandomNumber(maxNumber int32, baseNumber int) int {
return int(rand.Int31n(maxNumber)) + baseNumber
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not as random as you think. At minimum, you have to call rand.Seed. Otherwise, all processes will generate the exact same sequence of random numbers.

I'm also worried about the possibility of collisions even after seeding. But I don't have an elegant answer right now.

Copy link
Contributor Author

@arindamnayak arindamnayak Nov 9, 2019

Choose a reason for hiding this comment

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

Currently all these type of tests run sequentially - check here. However, I noticed that for every run of test, the processes generated with different numbers for port even in travis and github workflow (just verified those in execution log) as well as in local environment (Whereas it should have generated same seq of random numbers for every run). Anyway I will try with rand.Seed to add some randomness.

Note: Here it can be seen that for every test, the etcd uses different port (same applicable for each process), 1st, 2nd , 3rd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added rand.seed in the recent commit.

@morgo morgo requested a review from deepthi November 9, 2019 20:40

- name: Get dependencies
run: |
sudo apt-get install -y mysql-server mysql-client make unzip g++ etcd curl git wget
Copy link
Member

Choose a reason for hiding this comment

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

@morgo how do we know which version of mysql is being used here?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is the one included in ubuntu-latest, so likely 8.0. I can change it to MySQL 5.7 from Oracle repos. For the local-example it does the same, but a matrix build probably makes more sense so we catch both.

Copy link
Contributor

Choose a reason for hiding this comment

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

I looked into this further, it is 5.7:

mysql-client is already the newest version (5.7.27-0ubuntu0.18.04.1).
mysql-server is already the newest version (5.7.27-0ubuntu0.18.04.1).

The ubuntu-latest is 18.04. Assuming GitHub plans to bump this with new lts releases, this will change to 20.04, and MySQL 8.0 in April 2020. The fix then is to switch to the MySQL team repos, or consider upgrading our testsuite. Since MySQL 8.0 initializes slower, we will most likely chose the repo switch:

        wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
        sudo apt install -y ./mysql-apt-config_0.8*
        sudo sed -i 's/mysql-8.0/mysql-5.7/' /etc/apt/sources.list.d/mysql.list
        sudo apt-get update
        sudo apt-get install mysql-community-server mysql-community-client

@sougou sougou merged commit 2bc1adf into vitessio:master Nov 23, 2019
@morgo morgo mentioned this pull request Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants