Skip to content

Commit 2cc1360

Browse files
author
Peng Gu
committed
[OPTIMIZATION] Do not wait for commit replication response if not an actual commit
1 parent 23bfd65 commit 2cc1360

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

libspectrum/src/spectrum_log.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
7171
#include <my_check_opt.h>
7272
#include <mysql/service_thd_alloc.h>
7373
#include <mysql/service_thd_wait.h>
74+
#include <mysql/plugin.h>
7475
#include <mysql_com.h>
7576
#include <sql_string.h>
7677
#include <sql_tablespace.h>
@@ -241,6 +242,13 @@ int spectrum_log_commit(THD *thd, bool all, bool ignore_global_read_lock) {
241242
sql_print_error("spectrum_log_commit: stream write error");
242243
return HA_ERR_GENERIC;
243244
}
245+
246+
// Do not wait for commit response if not an actual commit
247+
bool will_commit = all ||
248+
(!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
249+
if (!will_commit) {
250+
return 0;
251+
}
244252

245253
do {
246254
if (!get_storage_replica_stream()->Read(&response)) {

0 commit comments

Comments
 (0)