Skip to content

Commit

Permalink
Avoid reading llmeta disableskipscan tunable for all tables during an…
Browse files Browse the repository at this point in the history
…alyze stat load.

Instead, read at the server start and when that tunable changes for any table (which is signaled by a scdone sc_analyze message).

Signed-off-by: Dorin Hogea <dhogea@bloomberg.net>
  • Loading branch information
dorinhogea committed Dec 6, 2024
1 parent a2b9bc1 commit 29be87c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions db/comdb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -5601,6 +5601,9 @@ int main(int argc, char **argv)
exit(1);
}

/* read disableskipscan here */
get_disable_skipscan_all();

/*
Place a freeze on tunables' registration. This is done to
avoid multiple re-registration during the creation of temp
Expand Down
2 changes: 2 additions & 0 deletions db/comdb2.h
Original file line number Diff line number Diff line change
Expand Up @@ -3673,4 +3673,6 @@ void csc2_allow_bools(void);
void csc2_disallow_bools(void);
int csc2_used_bools(void);

void get_disable_skipscan_all();

#endif /* !INCLUDED_COMDB2_H */
7 changes: 7 additions & 0 deletions db/sqlinterfaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -2594,6 +2594,13 @@ static int reload_analyze(struct sqlthdstate *thd, struct sqlclntstate *clnt,
extern volatile int analyze_running_flag;
if (analyze_running_flag)
return 0;

/* a change in disableskipscan comes on replicant as a sc_analyze scdone log
* read here the llmeta entries for that tunable (instead of deep down in
* sqlite3AnalysisLoad)
*/
get_disable_skipscan_all();

int rc, got_curtran;
rc = got_curtran = 0;
if (!clnt->dbtran.cursor_tran) {
Expand Down
5 changes: 0 additions & 5 deletions sqlite/src/analyze.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@
#if defined(SQLITE_BUILDING_FOR_COMDB2)
#include <logmsg.h>
int is_comdb2_index_disableskipscan(const char *);
void get_disable_skipscan_all();
#endif /* defined(SQLITE_BUILDING_FOR_COMDB2) */

#if defined(SQLITE_ENABLE_STAT4)
Expand Down Expand Up @@ -2442,10 +2441,6 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
assert( iDb>=0 && iDb<db->nDb );
assert( db->aDb[iDb].pBt!=0 );

#if defined(SQLITE_BUILDING_FOR_COMDB2)
/* AZ: put disabler loader here */
get_disable_skipscan_all();
#endif /* defined(SQLITE_BUILDING_FOR_COMDB2) */
/* Clear any prior statistics */
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
for(i=sqliteHashFirst(&pSchema->tblHash); i; i=sqliteHashNext(i)){
Expand Down

0 comments on commit 29be87c

Please sign in to comment.