diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-05-18 07:05:20 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-05-18 07:05:20 +0000 |
commit | 2aed6a345561957d952dbe22557599e9c275a094 (patch) | |
tree | 934143b5005941e022b7eaaef7c48e16b4c4b278 /src/datastore/plugin_datastore_sqlite.c | |
parent | ffa3d05eae9159386b615be5cf4d5cfd7e270c95 (diff) | |
download | gnunet-2aed6a345561957d952dbe22557599e9c275a094.tar.gz gnunet-2aed6a345561957d952dbe22557599e9c275a094.zip |
fix quota calculations
Diffstat (limited to 'src/datastore/plugin_datastore_sqlite.c')
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 1576cef00..6e20a7491 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -1613,13 +1613,19 @@ process_stat_done (void *cls, | |||
1613 | struct Plugin *plugin = cls; | 1613 | struct Plugin *plugin = cls; |
1614 | sqlite3_stmt *stmt; | 1614 | sqlite3_stmt *stmt; |
1615 | uint64_t pages; | 1615 | uint64_t pages; |
1616 | uint64_t free_pages; | 1616 | uint64_t page_size; |
1617 | 1617 | ||
1618 | plugin->stat_get = NULL; | 1618 | plugin->stat_get = NULL; |
1619 | if (plugin->stats_worked == GNUNET_NO) | 1619 | if (plugin->stats_worked == GNUNET_NO) |
1620 | { | 1620 | { |
1621 | CHECK (SQLITE_OK == | 1621 | CHECK (SQLITE_OK == |
1622 | sq_prepare (plugin->dbh, | 1622 | sq_prepare (plugin->dbh, |
1623 | "VACUUM;", | ||
1624 | &stmt)); | ||
1625 | sqlite3_step (stmt); | ||
1626 | sqlite3_finalize (stmt); | ||
1627 | CHECK (SQLITE_OK == | ||
1628 | sq_prepare (plugin->dbh, | ||
1623 | "PRAGMA page_count", | 1629 | "PRAGMA page_count", |
1624 | &stmt)); | 1630 | &stmt)); |
1625 | if (SQLITE_ROW == | 1631 | if (SQLITE_ROW == |
@@ -1630,17 +1636,17 @@ process_stat_done (void *cls, | |||
1630 | sqlite3_finalize (stmt); | 1636 | sqlite3_finalize (stmt); |
1631 | CHECK (SQLITE_OK == | 1637 | CHECK (SQLITE_OK == |
1632 | sq_prepare (plugin->dbh, | 1638 | sq_prepare (plugin->dbh, |
1633 | "PRAGMA freelist_count", | 1639 | "PRAGMA page_size", |
1634 | &stmt)); | 1640 | &stmt)); |
1635 | CHECK (SQLITE_ROW == | 1641 | CHECK (SQLITE_ROW == |
1636 | sqlite3_step (stmt)); | 1642 | sqlite3_step (stmt)); |
1637 | free_pages = sqlite3_column_int64 (stmt, 0); | 1643 | page_size = sqlite3_column_int64 (stmt, 0); |
1638 | sqlite3_finalize (stmt); | 1644 | sqlite3_finalize (stmt); |
1639 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1645 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1640 | _("Using sqlite page utilization to estimate payload (%llu pages total, %llu free)\n"), | 1646 | _("Using sqlite page utilization to estimate payload (%llu pages of size %llu bytes)\n"), |
1641 | (unsigned long long) pages, | 1647 | (unsigned long long) pages, |
1642 | (unsigned long long) free_pages); | 1648 | (unsigned long long) page_size); |
1643 | plugin->payload = (pages - free_pages) * 4092LL; | 1649 | plugin->payload = pages * page_size; |
1644 | } | 1650 | } |
1645 | } | 1651 | } |
1646 | 1652 | ||