mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Enlarge the SQLite database cache intelligently.
This commit is contained in:
@@ -196,11 +196,18 @@ uint64 SqliteDatabase::getBigInt(int colIndex)
|
||||
return(sqlite3_column_int64(mCurrentStmt, colIndex));
|
||||
}
|
||||
|
||||
int SqliteDatabase::getKBUsed()
|
||||
int SqliteDatabase::getKBUsedAll()
|
||||
{
|
||||
return static_cast<int>(sqlite3_memory_used() / 1024);
|
||||
}
|
||||
|
||||
int SqliteDatabase::getKBUsedDB()
|
||||
{
|
||||
int cur = 0, hiw = 0;
|
||||
sqlite3_db_status(mConnection, SQLITE_DBSTATUS_CACHE_USED, &cur, &hiw, 0);
|
||||
return cur / 1024;
|
||||
}
|
||||
|
||||
static int SqliteWALHook(void *s, sqlite3* dbCon, const char *dbName, int walSize)
|
||||
{
|
||||
(reinterpret_cast<SqliteDatabase*>(s))->doHook(dbName, walSize);
|
||||
|
||||
@@ -58,7 +58,8 @@ public:
|
||||
void runWal();
|
||||
void doHook(const char *db, int walSize);
|
||||
|
||||
int getKBUsed();
|
||||
int getKBUsedDB();
|
||||
int getKBUsedAll();
|
||||
};
|
||||
|
||||
class SqliteStatement
|
||||
|
||||
@@ -89,7 +89,8 @@ public:
|
||||
|
||||
virtual bool setupCheckpointing(JobQueue*) { return false; }
|
||||
virtual SqliteDatabase* getSqliteDB() { return NULL; }
|
||||
virtual int getKBUsed() { return -1; }
|
||||
virtual int getKBUsedAll() { return -1; }
|
||||
virtual int getKBUsedDB() { return -1; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user