From b6406bc9e82c50f51e6ff01e5905c345a086bfc9 Mon Sep 17 00:00:00 2001 From: Tim Serong Date: Wed, 18 Oct 2023 16:05:22 +1100 Subject: [PATCH] rgw/sfs: Use sqlite3_status() in make_sqlite3_status_fn() The current implementation calls sqlite3_db_status(), which is incorrect, given we're using it for SQLITE_STATUS_MEMORY_USED, SQLITE_STATUS_MALLOC_SIZE, and SQLITE_STATUS_MALLOC_COUNT. These codes are for use with sqlite3_status(). Signed-off-by: Tim Serong (cherry picked from commit ee79abab0d1962ea22fce1859399574bfb0a19ee) --- src/rgw/rgw_sal_sfs.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_sal_sfs.cc b/src/rgw/rgw_sal_sfs.cc index ae4123125d1e50..cff9dc8ace8679 100644 --- a/src/rgw/rgw_sal_sfs.cc +++ b/src/rgw/rgw_sal_sfs.cc @@ -512,16 +512,12 @@ void SFStore::filesystem_stats_updater_main( std::vector> SFStore::custom_metric_fns() { - sqlite3* sqlite_db = db_conn->first_sqlite_conn; auto make_sqlite3_status_fn = [&](const std::string& name, int op, bool use_highwater = false) { - return [sqlite_db, op, use_highwater, name]() { + return [op, use_highwater, name]() { int current; int highwater; - int ret = SQLITE_ERROR; - if (sqlite_db) { - ret = sqlite3_db_status(sqlite_db, op, ¤t, &highwater, false); - } + int ret = sqlite3_status(op, ¤t, &highwater, false); if (ret != SQLITE_OK) { return std::make_tuple( perfcounter_type_d::PERFCOUNTER_U64, name, std::nan("error")