Skip to content

Commit

Permalink
trying compatibility setings to support downgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
dlg99 committed Aug 19, 2024
1 parent 5f6e259 commit 1014371
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ class TestCompatUpgradeDowngrade {
@Test
public void upgradeDowngrade_015() {
String currentVersion = BookKeeperClusterUtils.CURRENT_VERSION
BookKeeperClusterUtils.appendToAllBookieConf(docker, currentVersion,
"dbStorage_rocksDB_format_version",
"2")
BookKeeperClusterUtils.appendToAllBookieConf(docker, currentVersion,
"dbStorage_rocksDB_checksum_type",
"kCRC32c")
BookKeeperClusterUtils.appendToAllBookieConf(docker, currentVersion,
"conf/default_rocksdb.conf.default",
"format_version",
"2")
upgradeDowngrade("4.17.0", currentVersion)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,28 @@ public static void updateBookieConf(DockerClient docker, String containerId,
DockerUtils.runCommand(docker, containerId, "sed", "-i", "-e", sedProgram, confFile);
}

public static void appendToAllBookieConf(DockerClient docker, String version, String key, String value)
public static void appendToAllBookieConf(DockerClient docker, String version, String confFile0,
String key, String value)
throws Exception {
for (String b : allBookies()) {
appendToBookieConf(docker, b, version, key, value);
appendToBookieConf(docker, b, version, confFile0, key, value);
}
}

public static void appendToAllBookieConf(DockerClient docker, String version,
String key, String value)
throws Exception {
appendToAllBookieConf(docker, version, "conf/bk_server.conf", key, value);
}

public static void appendToBookieConf(DockerClient docker, String containerId,
String version, String key, String value) throws Exception {
String confFile = "/opt/bookkeeper/" + version + "/conf/bk_server.conf";
appendToBookieConf(docker, containerId, version, "conf/bk_server.conf", key, value);
}

public static void appendToBookieConf(DockerClient docker, String containerId,
String version, String confFile0, String key, String value) throws Exception {
String confFile = "/opt/bookkeeper/" + version + "/" + confFile0;
String sedProgram = String.format("$a%s=%s", key, value);
DockerUtils.runCommand(docker, containerId, "sed", "-i", "-e", sedProgram, confFile);
}
Expand Down

0 comments on commit 1014371

Please sign in to comment.