Skip to content
Open
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
1 change: 1 addition & 0 deletions db/fdb_bend_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ _fdb_svc_cursor_start(BtCursor *pCur, sqlclntstate *clnt, char *tblname,
pCur->numblobs = get_schema_blob_count(pCur->db, ".ONDISK");

if (need_bdbcursor) {
assert(clnt->dbtran.mode != TRANLEVEL_MODSNAP || clnt->modsnap_in_progress);
pCur->bdbcur = bdb_cursor_open(
pCur->db->handle, clnt->dbtran.cursor_tran,
clnt->dbtran.shadow_tran, pCur->ixnum,
Expand Down
2 changes: 2 additions & 0 deletions db/osqlshadtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2243,6 +2243,7 @@ static int insert_record_indexes(BtCursor *pCur, struct sql_thread *thd,
}
}

assert(thd->clnt->dbtran.mode != TRANLEVEL_MODSNAP || thd->clnt->modsnap_in_progress);
tmpcur = bdb_cursor_open(
pCur->db->handle, thd->clnt->dbtran.cursor_tran,
thd->clnt->dbtran.shadow_tran, ix, BDB_OPEN_SHAD,
Expand Down Expand Up @@ -2349,6 +2350,7 @@ static int delete_record_indexes(BtCursor *pCur, char *pdta, int dtasize,
}
memcpy(&key[db->ix_keylen[ix]], &genid, sizeof(genid));

assert(thd->clnt->dbtran.mode != TRANLEVEL_MODSNAP || thd->clnt->modsnap_in_progress);
tmpcur = bdb_cursor_open(
db->handle, thd->clnt->dbtran.cursor_tran,
thd->clnt->dbtran.shadow_tran, ix, BDB_OPEN_SHAD,
Expand Down
1 change: 1 addition & 0 deletions db/sqlglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -8449,6 +8449,7 @@ sqlite3BtreeCursor_cursor(Btree *pBt, /* The btree */
} else {
open_type = BDB_OPEN_REAL;
}
assert(clnt->dbtran.mode != TRANLEVEL_MODSNAP || clnt->modsnap_in_progress);
cur->bdbcur = bdb_cursor_open(
cur->db->handle, clnt->dbtran.cursor_tran, shadow_tran, cur->ixnum,
open_type, (clnt->dbtran.mode == TRANLEVEL_SOSQL)
Expand Down
8 changes: 8 additions & 0 deletions db/sqlinterfaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -3634,6 +3634,14 @@ static void handle_expert_query(struct sqlthdstate *thd,
int rc;
char *zErr = 0;

if (clnt->dbtran.mode == TRANLEVEL_MODSNAP) {
if (clnt->modsnap_in_progress) {
clear_modsnap_state(clnt);
}
logmsg(LOGMSG_WARN, "%s: Downgrading to blocksql for expert mode query\n", __func__);
clnt->dbtran.mode = TRANLEVEL_SOSQL;
}

*outrc = 0;
rdlock_schema_lk();
rc = sqlengine_prepare_engine(thd, clnt, PREPARE_RECREATE);
Expand Down
2 changes: 2 additions & 0 deletions tests/comdb2expert.test/snapshot.testopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sql_tranlevel_default snapshot
enable_snapshot_isolation