Address coverity errors (CID 364045,364046) (#10282)
Remove the unused sql_database_size function for now
Stelios Fragkakis committed
Nov 25, 2020 at 11:00 UTC
2c1d3e3a2f80cb9691edc8790398e050f9c44d7a
1 file changed
-50
database/sqlite/sqlite_functions.c
-50
@@ -29,12 +29,6 @@ const char *database_config[] = {
29
sqlite3 *db_meta = NULL;
30
31
static uv_mutex_t sqlite_transaction_lock;
32
-static uint32_t page_size;
33
-static uint32_t page_count;
34
-static uint32_t free_page_count;
35
-
36
-uint32_t sqlite_disk_quota_mb;
37
-uint32_t desired_pages = 0;
32
33
static int execute_insert(sqlite3_stmt *res)
34
{
@@ -184,50 +178,6 @@ void sql_close_database(void)
178
return;
179
}
180
187
-/*
188
- * Return the database size in MiB
189
- */
190
-int sql_database_size(void)
191
-{
192
- sqlite3_stmt *chk_size;
193
- int rc;
194
-
195
- rc = sqlite3_prepare_v2(db_meta, "pragma page_count;", -1, &chk_size, 0);
196
- if (rc != SQLITE_OK)
197
- return 0;
198
-
199
- if (sqlite3_step(chk_size) == SQLITE_ROW)
200
- page_count = sqlite3_column_int(chk_size, 0);
201
-
202
- sqlite3_finalize(chk_size);
203
-
204
- rc = sqlite3_prepare_v2(db_meta, "pragma freelist_count;", -1, &chk_size, 0);
205
- if (rc != SQLITE_OK)
206
- return 0;
207
-
208
- if (sqlite3_step(chk_size) == SQLITE_ROW)
209
- free_page_count = sqlite3_column_int(chk_size, 0);
210
-
211
- sqlite3_finalize(chk_size);
212
-
213
- if (unlikely(!page_size)) {
214
- rc = sqlite3_prepare_v2(db_meta, "pragma page_size;", -1, &chk_size, 0);
215
- if (rc != SQLITE_OK)
216
- return 0;
217
-
218
- if (sqlite3_step(chk_size) == SQLITE_ROW)
219
- page_size = (uint32_t)sqlite3_column_int(chk_size, 0);
220
-
221
- sqlite3_finalize(chk_size);
222
- desired_pages = (sqlite_disk_quota_mb * 0.95) * (1024 * 1024 / page_size);
223
- info(
224
- "Database desired size is %u pages (page size is %u bytes). Current size is %u pages (includes %u free pages)",
225
- desired_pages, page_size, page_count, free_page_count);
226
- }
227
-
228
- return ((page_count - free_page_count) / 1024) * (page_size / 1024);
229
-}
230
-
181
#define FIND_UUID_TYPE "select 1 from host where host_id = @uuid union select 2 from chart where chart_id = @uuid union select 3 from dimension where dim_id = @uuid;"
182
183
int find_uuid_type(uuid_t *uuid)