Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions db/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,8 @@ static int read_lrl_option(struct dbenv *dbenv, char *line,
} else if (tokcmp(tok, ltok, "enable_snapshot_isolation") == 0) {
gbl_snapisol = 1;
gbl_use_modsnap_for_snapshot = 1;
if (gbl_sql_tranlevel_default == gbl_snapshot_impl)
gbl_sql_tranlevel_default = TRANLEVEL_MODSNAP;
gbl_snapshot_impl = TRANLEVEL_MODSNAP;
gbl_modsnap_asof = 1;
} else if (tokcmp(tok, ltok, "enable_serial_isolation") == 0) {
Expand Down
2 changes: 2 additions & 0 deletions db/process_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -5144,6 +5144,8 @@ int process_command(struct dbenv *dbenv, char *line, int lline, int st)
}
} else if (tokcmp(tok, ltok, "do_not_use_modsnap_for_snapshot") == 0) {
gbl_use_modsnap_for_snapshot = 0;
if (gbl_sql_tranlevel_default == gbl_snapshot_impl)
gbl_sql_tranlevel_default = TRANLEVEL_SNAPISOL;
gbl_snapshot_impl = TRANLEVEL_SNAPISOL;
} else if (tokcmp(tok, ltok, "del_llmeta_comdb2_seqno") == 0) {
bdb_del_seqno(NULL);
Expand Down
27 changes: 21 additions & 6 deletions plugins/newsql/newsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -1746,9 +1746,18 @@ int process_set_commands(struct sqlclntstate *clnt, CDB2SQLQUERY *sql_query)
sqlstr);
rc = ii + 1;
} else if (clnt->dbtran.mode != TRANLEVEL_SOSQL) {
snprintf(err, sizeof(err),
"transaction chunks require SOCKSQL transaction mode");
rc = ii + 1;
int snapshot_by_default =
(clnt->dbtran.mode == TRANLEVEL_MODSNAP && gbl_sql_tranlevel_default == TRANLEVEL_MODSNAP);
if (snapshot_by_default) {
logmsg(LOGMSG_DEBUG, "snapshot is on by default, use socksql instead\n");
clnt->dbtran.mode = TRANLEVEL_SOSQL;
clnt->dbtran.maxchunksize = tmp;
/* in chunked mode, we disable verify retries */
clnt->verifyretry_off = 1;
} else {
snprintf(err, sizeof(err), "transaction chunks require SOCKSQL transaction mode");
rc = ii + 1;
}
} else {
clnt->dbtran.maxchunksize = tmp;
/* in chunked mode, we disable verify retries */
Expand Down Expand Up @@ -1792,9 +1801,15 @@ int process_set_commands(struct sqlclntstate *clnt, CDB2SQLQUERY *sql_query)
if (clnt->dbtran.mode == TRANLEVEL_INVALID) {
rc = ii + 1;
} else if (clnt->dbtran.mode != TRANLEVEL_SOSQL && clnt->dbtran.maxchunksize) {
snprintf(err, sizeof(err),
"transaction chunks require SOCKSQL transaction mode");
rc = ii + 1;
int snapshot_by_default =
(clnt->dbtran.mode == TRANLEVEL_MODSNAP && gbl_sql_tranlevel_default == TRANLEVEL_MODSNAP);
if (snapshot_by_default) {
logmsg(LOGMSG_DEBUG, "snapshot is on by default, use socksql instead\n");
clnt->dbtran.mode = TRANLEVEL_SOSQL;
} else {
snprintf(err, sizeof(err), "transaction chunks require SOCKSQL transaction mode");
rc = ii + 1;
}
}
}
} else if (strncasecmp(sqlstr, "timeout", 7) == 0) {
Expand Down
2 changes: 2 additions & 0 deletions tests/chunk_txn_effects.test/snapshot.testopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
enable_snapshot_isolation
sql_tranlevel_default snapshot