Skip to content

Commit baae3db

Browse files
author
diego Dupin
committed
[misc] setting "transaction read only" only for replica
1 parent 361cf71 commit baae3db

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/org/mariadb/jdbc/client/impl/StandardClient.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,9 @@ private void postConnectionQueries() throws SQLException {
295295
commands.add("show status like 'wsrep_local_state'");
296296
}
297297

298-
if (context.getVersion().versionGreaterOrEqual(5, 6, 5)) {
299-
commands.add(
300-
"SET SESSION TRANSACTION "
301-
+ ((hostAddress != null && !hostAddress.primary) ? "READ ONLY" : "READ WRITE"));
298+
if (!hostAddress.primary
299+
&& context.getVersion().versionGreaterOrEqual(5, 6, 5)) {
300+
commands.add("SET SESSION TRANSACTION READ ONLY");
302301
}
303302

304303
try {

0 commit comments

Comments
 (0)