-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tt replicaset upgrade
: support remote replicaset
This patch adds the ability to update the schema on a remote replicaset. Closes #968
- Loading branch information
Showing
5 changed files
with
137 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
credentials: | ||
users: | ||
client: | ||
password: 'secret' | ||
roles: [super] | ||
guest: | ||
roles: [super] | ||
|
||
groups: | ||
group-001: | ||
replicasets: | ||
replicaset-001: | ||
instances: | ||
storage-master: | ||
iproto: | ||
listen: | ||
- uri: '127.0.0.1:3301' | ||
database: | ||
mode: rw | ||
storage-replica: | ||
iproto: | ||
listen: | ||
- uri: '127.0.0.1:3302' | ||
database: | ||
mode: ro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
storage-master: | ||
|
||
storage-replica: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,14 @@ | |
import shutil | ||
import subprocess | ||
import tempfile | ||
import time | ||
|
||
import pytest | ||
from replicaset_helpers import stop_application | ||
from vshard_cluster import VshardCluster | ||
|
||
from utils import get_tarantool_version, run_command_and_get_output, wait_file | ||
from utils import (control_socket, get_tarantool_version, | ||
run_command_and_get_output, run_path, wait_file) | ||
|
||
tarantool_major_version, _ = get_tarantool_version() | ||
|
||
|
@@ -192,3 +194,53 @@ def test_upgrade_downgraded_cluster_replicasets(tt_cmd, tmp_path): | |
|
||
finally: | ||
app.stop() | ||
|
||
|
||
def start_application(cmd, workdir, app_name, instances): | ||
instance_process = subprocess.Popen( | ||
cmd, | ||
cwd=workdir, | ||
stderr=subprocess.STDOUT, | ||
stdout=subprocess.PIPE, | ||
text=True | ||
) | ||
start_output = instance_process.stdout.read() | ||
for inst in instances: | ||
assert f"Starting an instance [{app_name}:{inst}]" in start_output | ||
|
||
|
||
@pytest.mark.skipif(tarantool_major_version < 3, | ||
reason="skip cluster instances test for Tarantool < 3") | ||
def test_upgrade_remote_replicasets(tt_cmd, tmpdir_with_cfg): | ||
tmpdir = tmpdir_with_cfg | ||
app_name = "small_cluster_app" | ||
app_path = os.path.join(tmpdir, app_name) | ||
shutil.copytree(os.path.join(os.path.dirname(__file__), app_name), app_path) | ||
|
||
run_dir = os.path.join(tmpdir, app_name, run_path) | ||
instances = ['storage-master', 'storage-replica'] | ||
|
||
try: | ||
# Start an instance. | ||
start_cmd = [tt_cmd, "start", app_name] | ||
start_application(start_cmd, tmpdir, app_name, instances) | ||
|
||
# Check status. | ||
for inst in instances: | ||
file = wait_file(os.path.join(run_dir, inst), 'tarantool.pid', []) | ||
assert file != "" | ||
file = wait_file(os.path.join(run_dir, inst), control_socket, []) | ||
assert file != "" | ||
# App is ready, but It is necessary to wait for some time | ||
# to be able to establish a connection. | ||
time.sleep(3) | ||
uri = "tcp://client:[email protected]:3301" | ||
upgrade_cmd = [tt_cmd, "replicaset", "upgrade", uri, "-t=15"] | ||
rc, out = run_command_and_get_output(upgrade_cmd, cwd=tmpdir) | ||
assert rc == 0 | ||
assert "ok" in out | ||
|
||
finally: | ||
stop_cmd = [tt_cmd, "stop", app_name, "-y"] | ||
stop_rc, stop_out = run_command_and_get_output(stop_cmd, cwd=tmpdir) | ||
assert stop_rc == 0 |