This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push: new 0e390e19b [java] methods for setting run-time flags via test harness 0e390e19b is described below commit 0e390e19b93a40302f53791afbcc95d110c28b57 Author: Alexey Serbin <ale...@apache.org> AuthorDate: Wed Feb 28 18:47:29 2024 -0800 [java] methods for setting run-time flags via test harness When I was trying to reproduce an issue seen in the field, I found that necessary functionality was missing in the Java test harness. This patch addresses the deficiency, introducing the corresponding methods to set run-time flags for Kudu masters and tablet servers. This patch also updates the test harness class to provides a means to restart a tablet server that hosts a particular tablet replica. Change-Id: I5ed12b2ef9fd077534528361f6bb42efe3730182 Reviewed-on: http://gerrit.cloudera.org:8080/21093 Reviewed-by: Abhishek Chennaka <achenn...@cloudera.com> Tested-by: Alexey Serbin <ale...@apache.org> --- .../java/org/apache/kudu/test/KuduTestHarness.java | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java index 47b6656f0..b8d01621e 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java @@ -336,6 +336,30 @@ public class KuduTestHarness extends ExternalResource { return hp; } + /** + * Set a run-time flag for a tablet server identified by its host and port. + * @param hp HostAndPort object identifying the target tablet server + * @param flag a flag to set (prefix dash(es) omitted) + * @param value a stringified representation of the flag's value to set + * @throws IOException + */ + public void setTabletServerFlag(HostAndPort hp, String flag, String value) throws IOException { + miniCluster.setTServerFlag(hp, flag, value); + } + + /** + * Kills and starts back a tablet server that serves the given tablet's leader. + * @param tablet a LocatedTablet which is hosted by the target tablet server + * @return the host and port of the restarted tablet server + * @throws Exception + */ + public HostAndPort restartTabletLeader(LocatedTablet tablet) throws Exception { + HostAndPort hp = findLeaderTabletServer(tablet); + miniCluster.killTabletServer(hp); + miniCluster.startTabletServer(hp); + return hp; + } + /** * Kills and restarts the leader master. * @return the host and port of the restarted master @@ -386,6 +410,17 @@ public class KuduTestHarness extends ExternalResource { miniCluster.resumeMasterServer(hp); } + /** + * Set a run-time flag for a Kudu master identified by its host and port. + * @param hp HostAndPort object identifying the target master + * @param flag a flag to set (prefix dash(es) omitted) + * @param value a stringified representation of the flag's value to set + * @throws IOException + */ + public void setMasterFlag(HostAndPort hp, String flag, String value) throws IOException { + miniCluster.setMasterFlag(hp, flag, value); + } + /** * Return the comma-separated list of "host:port" pairs that describes the master * config for this cluster.