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 Jun 18, 2024
1 parent 63047f4 commit 9c6d39e
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 @@ -103,6 +103,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 9c6d39e

Please sign in to comment.