Skip to content

Commit

Permalink
SQuery changes to skipInfoWarn
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragsalian committed Jun 3, 2024
1 parent d418d67 commit 3270418
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions libstuff/libstuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2535,7 +2535,7 @@ void SQueryLogClose() {

// --------------------------------------------------------------------------
// Executes a SQLite query
int SQuery(sqlite3* db, const char* e, const string& sql, SQResult& result, int64_t warnThreshold, bool skipWarn, bool skipQueryLog) {
int SQuery(sqlite3* db, const char* e, const string& sql, SQResult& result, int64_t warnThreshold, bool skipInfoWarn) {
#define MAX_TRIES 3
// Execute the query and get the results
uint64_t startTime = STimeNow();
Expand Down Expand Up @@ -2666,7 +2666,7 @@ int SQuery(sqlite3* db, const char* e, const string& sql, SQResult& result, int6
}

uint64_t elapsed = STimeNow() - startTime;
if (!skipQueryLog && ((int64_t)elapsed > warnThreshold || (int64_t)elapsed > 10000)) {
if (!skipInfoWarn && ((int64_t)elapsed > warnThreshold || (int64_t)elapsed > 10000)) {
// Avoid logging queries so long that we need dozens of lines to log them.
string sqlToLog = sql.substr(0, 20000);
SRedactSensitiveValues(sqlToLog);
Expand Down Expand Up @@ -2703,7 +2703,7 @@ int SQuery(sqlite3* db, const char* e, const string& sql, SQResult& result, int6

// Only OK and commit conflicts are allowed without warning because they're the only "successful" results that we expect here.
// OK means it succeeds, conflicts will get retried further up the call stack.
if (error != SQLITE_OK && extErr != SQLITE_BUSY_SNAPSHOT && !skipWarn) {
if (error != SQLITE_OK && extErr != SQLITE_BUSY_SNAPSHOT && !skipInfoWarn) {
string sqlToLog = sql.substr(0, 20000);
SRedactSensitiveValues(sqlToLog);

Expand Down Expand Up @@ -3062,9 +3062,9 @@ string SQ(double val) {
return SToStr(val);
}

int SQuery(sqlite3* db, const char* e, const string& sql, int64_t warnThreshold, bool skipWarn) {
int SQuery(sqlite3* db, const char* e, const string& sql, int64_t warnThreshold, bool skipInfoWarn) {
SQResult ignore;
return SQuery(db, e, sql, ignore, warnThreshold, skipWarn);
return SQuery(db, e, sql, ignore, warnThreshold, skipInfoWarn);
}

string SUNQUOTED_TIMESTAMP(uint64_t when) {
Expand Down
4 changes: 2 additions & 2 deletions libstuff/libstuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ void SQueryLogOpen(const string& logFilename);
void SQueryLogClose();

// Returns an SQLite result code.
int SQuery(sqlite3* db, const char* e, const string& sql, SQResult& result, int64_t warnThreshold = 2000 * STIME_US_PER_MS, bool skipWarn = false, bool skipQueryLog = false);
int SQuery(sqlite3* db, const char* e, const string& sql, int64_t warnThreshold = 2000 * STIME_US_PER_MS, bool skipWarn = false);
int SQuery(sqlite3* db, const char* e, const string& sql, SQResult& result, int64_t warnThreshold = 2000 * STIME_US_PER_MS, bool skipInfoWarn = false);
int SQuery(sqlite3* db, const char* e, const string& sql, int64_t warnThreshold = 2000 * STIME_US_PER_MS, bool skipInfoWarn = false);
bool SQVerifyTable(sqlite3* db, const string& tableName, const string& sql);
bool SQVerifyTableExists(sqlite3* db, const string& tableName);

Expand Down

0 comments on commit 3270418

Please sign in to comment.