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

[release-18.0] Improve the queries upgrade/downgrade CI workflow by using same test code version as binary (#16494) #16500

Merged
merged 6 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,69 +116,57 @@ jobs:
# install JUnit report formatter
go install github.com/vitessio/go-junit-report@HEAD

# Checkout to the last release of Vitess
- name: Check out other version's code (${{ steps.output-previous-release-ref.outputs.previous_release_ref }})
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v4
with:
ref: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }}

- name: Get dependencies for the last release
# Build current commit's binaries
- name: Get dependencies for this commit
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
go mod download

- name: Building last release's binaries
- name: Building the binaries for this commit
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 10
run: |
source build.env
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/
rm -Rf bin/*

# Checkout to this build's commit
- name: Check out commit's code
# Checkout to the last release of Vitess
- name: Check out other version's code (${{ steps.output-previous-release-ref.outputs.previous_release_ref }})
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v4
with:
ref: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }}

- name: Get dependencies for this commit
- name: Get dependencies for the last release
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
go mod download

- name: Building the binaries for this commit
- name: Building last release's binaries
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 10
run: |
source build.env
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

# Running a test with vtgate and vttablet using version n
- name: Run query serving tests (vtgate=N, vttablet=N)
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
rm -rf /tmp/vtdataroot
mkdir -p /tmp/vtdataroot

source build.env
eatmydata -- go run test.go -skip-build -keep-data=false -docker=false -print-log -follow -tag upgrade_downgrade_query_serving_queries
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*

# Swap the binaries in the bin. Use vtgate version n-1 and keep vttablet at version n
- name: Use last release's VTGate
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
source build.env

cp -r /tmp/vitess-build-current/bin/* $PWD/bin/
rm -f $PWD/bin/vtgate
cp /tmp/vitess-build-other/bin/vtgate $PWD/bin/vtgate
vtgate --version

# Running a test with vtgate at version n-1 and vttablet at version n
- name: Run query serving tests (vtgate=N-1, vttablet=N)
# Running a test with vtgate at version n-1 and vttablet/vtctld at version n
- name: Run query serving tests (vtgate=N-1, vttablet=N, vtctld=N)
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
rm -rf /tmp/vtdataroot
Expand All @@ -187,22 +175,38 @@ jobs:
source build.env
eatmydata -- go run test.go -skip-build -keep-data=false -docker=false -print-log -follow -tag upgrade_downgrade_query_serving_queries

# Swap the binaries again. This time, vtgate will be at version n, and vttablet will be at version n-1
- name: Use current version VTGate, and other version VTTablet
- name: Check out commit's code
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0

# Swap the binaries again. This time, vtgate will be at version n, and vttablet/vtctld will be at version n-1
- name: Use current version VTGate, and other version VTTablet/VTctld
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
source build.env

rm -f $PWD/bin/vtgate $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-current/bin/vtgate $PWD/bin/vtgate
rm -Rf bin/*
cp -r /tmp/vitess-build-current/bin/* $PWD/bin/

rm -f $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld

cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld

cp /tmp/vitess-build-other/bin/vtctld $PWD/bin/vtctld
cp /tmp/vitess-build-other/bin/vtctldclient $PWD/bin/vtctldclient
cp /tmp/vitess-build-other/bin/vtctl $PWD/bin/vtctl
cp /tmp/vitess-build-other/bin/vtctlclient $PWD/bin/vtctlclient

vtgate --version
vttablet --version
vtctl --version

# Running a test with vtgate at version n and vttablet at version n-1
- name: Run query serving tests (vtgate=N, vttablet=N-1)
# Running a test with vtgate at version n and vttablet/vtctld at version n-1
- name: Run query serving tests (vtgate=N, vttablet=N-1, vtctld=N-1)
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
rm -rf /tmp/vtdataroot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,63 +117,51 @@ jobs:
# install JUnit report formatter
go install github.com/vitessio/go-junit-report@HEAD

# Checkout to the next release of Vitess
- name: Check out other version's code (${{ steps.output-next-release-ref.outputs.next_release_ref }})
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v4
with:
ref: ${{ steps.output-next-release-ref.outputs.next_release_ref }}

- name: Get dependencies for the next release
# Build current commit's binaries
- name: Get dependencies for this commit
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
go mod download

- name: Building next release's binaries
- name: Building the binaries for this commit
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 10
run: |
source build.env
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/
rm -Rf bin/*

# Checkout to this build's commit
- name: Check out commit's code
# Checkout to the next release of Vitess
- name: Check out other version's code (${{ steps.output-next-release-ref.outputs.next_release_ref }})
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v4
with:
ref: ${{ steps.output-next-release-ref.outputs.next_release_ref }}

- name: Get dependencies for this commit
- name: Get dependencies for the next release
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
go mod download

- name: Building the binaries for this commit
- name: Building next release's binaries
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 10
run: |
source build.env
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

# Running a test with vtgate and vttablet using version n
- name: Run query serving tests (vtgate=N, vttablet=N)
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
rm -rf /tmp/vtdataroot
mkdir -p /tmp/vtdataroot

source build.env
eatmydata -- go run test.go -skip-build -keep-data=false -docker=false -print-log -follow -tag upgrade_downgrade_query_serving_queries
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*

# Swap the binaries in the bin. Use vtgate version n+1 and keep vttablet at version n
- name: Use next release's VTGate
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
source build.env

cp -r /tmp/vitess-build-current/bin/* $PWD/bin/
rm -f $PWD/bin/vtgate
cp /tmp/vitess-build-other/bin/vtgate $PWD/bin/vtgate
vtgate --version
Expand All @@ -188,22 +176,38 @@ jobs:
source build.env
eatmydata -- go run test.go -skip-build -keep-data=false -docker=false -print-log -follow -tag upgrade_downgrade_query_serving_queries

- name: Check out commit's code
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0

# Swap the binaries again. This time, vtgate will be at version n, and vttablet will be at version n+1
- name: Use current version VTGate, and other version VTTablet
- name: Use current version VTGate, and other version VTTablet/VTctld
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
source build.env

rm -f $PWD/bin/vtgate $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-current/bin/vtgate $PWD/bin/vtgate
rm -Rf bin/*
cp -r /tmp/vitess-build-current/bin/* $PWD/bin/

rm -f $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld

cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld

cp /tmp/vitess-build-other/bin/vtctld $PWD/bin/vtctld
cp /tmp/vitess-build-other/bin/vtctldclient $PWD/bin/vtctldclient
cp /tmp/vitess-build-other/bin/vtctl $PWD/bin/vtctl
cp /tmp/vitess-build-other/bin/vtctlclient $PWD/bin/vtctlclient

vtgate --version
vttablet --version
vtctl --version

# Running a test with vtgate at version n and vttablet at version n+1
- name: Run query serving tests (vtgate=N, vttablet=N+1)
- name: Run query serving tests (vtgate=N, vttablet=N+1, vtctld=N+1)
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
rm -rf /tmp/vtdataroot
Expand Down
15 changes: 5 additions & 10 deletions go/test/endtoend/backup/vtbackup/backup_only_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,10 @@ func TestTabletInitialBackup(t *testing.T) {
// Initialize the tablets
initTablets(t, false, false)

vtTabletVersion, err := cluster.GetMajorVersion("vttablet")
require.NoError(t, err)
// For all version at or above v17.0.0, each replica will start in super_read_only mode. Let's verify that is working correctly.
if vtTabletVersion >= 17 {
err := primary.VttabletProcess.CreateDB("testDB")
require.ErrorContains(t, err, "The MySQL server is running with the --super-read-only option so it cannot execute this statement")
err = replica1.VttabletProcess.CreateDB("testDB")
require.ErrorContains(t, err, "The MySQL server is running with the --super-read-only option so it cannot execute this statement")
}
err := primary.VttabletProcess.CreateDB("testDB")
require.ErrorContains(t, err, "The MySQL server is running with the --super-read-only option so it cannot execute this statement")
err = replica1.VttabletProcess.CreateDB("testDB")
require.ErrorContains(t, err, "The MySQL server is running with the --super-read-only option so it cannot execute this statement")

// Restore the Tablet
restore(t, primary, "replica", "NOT_SERVING")
Expand Down Expand Up @@ -172,7 +167,7 @@ func firstBackupTest(t *testing.T, tabletType string) {
restore(t, replica2, "replica", "SERVING")
// Replica2 takes time to serve. Sleeping for 5 sec.
time.Sleep(5 * time.Second)
//check the new replica has the data
// check the new replica has the data
cluster.VerifyRowsInTablet(t, replica2, keyspaceName, 2)

removeBackups(t)
Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/cluster/vtorc_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ func (orc *VTOrcProcess) Setup() (err error) {
// Faster topo information refresh speeds up the tests. This doesn't add any significant load either
"--topo-information-refresh-duration", "3s",
)

if v, err := GetMajorVersion("vtorc"); err != nil {
return err
} else if v >= 18 {
Expand Down
30 changes: 10 additions & 20 deletions go/test/endtoend/reparent/plannedreparent/reparent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ func TestReparentFromOutsideWithNoPrimary(t *testing.T) {
}

func reparentFromOutside(t *testing.T, clusterInstance *cluster.LocalProcessCluster, downPrimary bool) {
//This test will start a primary and 3 replicas.
//Then:
//- one replica will be the new primary
//- one replica will be reparented to that new primary
//- one replica will be busted and dead in the water and we'll call TabletExternallyReparented.
//Args:
//downPrimary: kills the old primary first
// This test will start a primary and 3 replicas.
// Then:
// - one replica will be the new primary
// - one replica will be reparented to that new primary
// - one replica will be busted and dead in the water and we'll call TabletExternallyReparented.
// Args:
// downPrimary: kills the old primary first
ctx := context.Background()
tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets

Expand All @@ -220,7 +220,7 @@ func reparentFromOutside(t *testing.T, clusterInstance *cluster.LocalProcessClus
demoteCommands := "SET GLOBAL read_only = ON; FLUSH TABLES WITH READ LOCK; UNLOCK TABLES"
utils.RunSQL(ctx, t, demoteCommands, tablets[0])

//Get the position of the old primary and wait for the new one to catch up.
// Get the position of the old primary and wait for the new one to catch up.
err := utils.WaitForReplicationPosition(t, tablets[0], tablets[1])
require.NoError(t, err)
}
Expand Down Expand Up @@ -455,14 +455,7 @@ func TestFullStatus(t *testing.T) {
assert.Contains(t, primaryStatus.PrimaryStatus.String(), "vt-0000000101-bin")
assert.Equal(t, primaryStatus.GtidPurged, "MySQL56/")
assert.False(t, primaryStatus.ReadOnly)
vtTabletVersion, err := cluster.GetMajorVersion("vttablet")
require.NoError(t, err)
vtcltlVersion, err := cluster.GetMajorVersion("vtctl")
require.NoError(t, err)
// For all version at or above v17.0.0, each replica will start in super_read_only mode.
if vtTabletVersion >= 17 && vtcltlVersion >= 17 {
assert.False(t, primaryStatus.SuperReadOnly)
}
assert.False(t, primaryStatus.SuperReadOnly)
assert.True(t, primaryStatus.SemiSyncPrimaryEnabled)
assert.True(t, primaryStatus.SemiSyncReplicaEnabled)
assert.True(t, primaryStatus.SemiSyncPrimaryStatus)
Expand Down Expand Up @@ -516,10 +509,7 @@ func TestFullStatus(t *testing.T) {
assert.Contains(t, replicaStatus.PrimaryStatus.String(), "vt-0000000102-bin")
assert.Equal(t, replicaStatus.GtidPurged, "MySQL56/")
assert.True(t, replicaStatus.ReadOnly)
// For all version at or above v17.0.0, each replica will start in super_read_only mode.
if vtTabletVersion >= 17 && vtcltlVersion >= 17 {
assert.True(t, replicaStatus.SuperReadOnly)
}
assert.True(t, replicaStatus.SuperReadOnly)
assert.False(t, replicaStatus.SemiSyncPrimaryEnabled)
assert.True(t, replicaStatus.SemiSyncReplicaEnabled)
assert.False(t, replicaStatus.SemiSyncPrimaryStatus)
Expand Down
Loading
Loading