Skip to content

Commit

Permalink
HIVE-28597: Upgrade to 8.4.3 LTS version of MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
KiranVelumuri committed Nov 4, 2024
1 parent 57f720d commit 18c4e92
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private ProcessResults runCmdAndPrintStreams(String[] cmd, long secondsToWait)


public void launchDockerContainer() throws Exception {
printDockerVersion();
runCmdAndPrintStreams(buildRmCmd(), 600);
if (runCmdAndPrintStreams(buildRunCmd(), 600).rc != 0) {
printDockerEvents();
Expand All @@ -134,15 +135,24 @@ public void launchDockerContainer() throws Exception {
}
}

protected void printDockerEvents() {
protected void printDockerVersion() {
try {
runCmdAndPrintStreams(new String[] { "docker", "events", "--since", "24h", "--until", "0s" }, 3);
runCmdAndPrintStreams(new String[] { "docker", "version" }, 3);
} catch (Exception e) {
LOG.warn("A problem was encountered while attempting to retrieve Docker events (the system made an analytical"
LOG.warn("A problem was encountered while attempting to retrieve Docker version (the system made an analytical"
+ " best effort to list the events to reveal the root cause). No further actions are necessary.", e);
}
}

protected void printDockerEvents() {
try {
runCmdAndPrintStreams(new String[] { "docker", "events", "--since", "24h", "--until", "0s" }, 3);
} catch (Exception e) {
LOG.warn("A problem was encountered while attempting to retrieve Docker events (the system made an analytical"
+ " best effort to list the events to reveal the root cause). No further actions are necessary.", e);
}
}

public void cleanupDockerContainer() throws IOException, InterruptedException {
if (runCmdAndPrintStreams(buildRmCmd(), 600).rc != 0) {
throw new RuntimeException("Unable to remove docker container");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public String getJdbcDriver() {
return "com.mysql.jdbc.Driver";
}

public String getDockerImageName() { return "mysql:5.7.37"; }
public String getDockerImageName() { return "mysql:8.4.3"; }

public String[] getDockerAdditionalArgs() {
return new String[] {"-p", "3306:3306",
Expand All @@ -53,7 +53,7 @@ public String[] getDockerAdditionalArgs() {
}

public boolean isContainerReady(ProcessResults pr) {
Pattern pat = Pattern.compile("ready for connections");
Pattern pat = Pattern.compile("mysqld.*ready for connections.*port.*3306");
Matcher m = pat.matcher(pr.stderr);
return m.find() && m.find();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Mysql extends DatabaseRule {

@Override
public String getDockerImageName() {
return "mysql:5.7.37";
return "mysql:8.4.3";
}

@Override
Expand Down Expand Up @@ -67,7 +67,7 @@ public String getInitialJdbcUrl(String hostAddress) {

@Override
public boolean isContainerReady(ProcessResults pr) {
Pattern pat = Pattern.compile("ready for connections");
Pattern pat = Pattern.compile("mysqld.*ready for connections.*port.*3306");
Matcher m = pat.matcher(pr.stderr);
return m.find() && m.find();
}
Expand Down

0 comments on commit 18c4e92

Please sign in to comment.