1#include <xrpl/server/Vacuum.h>
3#include <xrpl/beast/utility/Journal.h>
4#include <xrpl/beast/utility/instrumentation.h>
5#include <xrpl/rdb/DBInit.h>
6#include <xrpl/rdb/DatabaseCon.h>
8#include <boost/filesystem/operations.hpp>
9#include <boost/filesystem/path.hpp>
10#include <boost/format.hpp>
25 uintmax_t
const dbSize = file_size(dbPath);
26 XRPL_ASSERT(dbSize !=
static_cast<uintmax_t
>(-1),
"xrpl::doVacuumDB : file_size succeeded");
28 if (
auto available = space(dbPath.parent_path()).available; available < dbSize)
30 std::cerr <<
"The database filesystem must have at least as "
31 "much free space as the size of "
32 << dbPath.string() <<
", which is " << dbSize <<
" bytes. Only " << available
33 <<
" bytes are available.\n";
38 auto& session = txnDB->getSession();
45 session <<
"PRAGMA page_size;", soci::into(pageSize);
50 XRPL_ASSERT(setup.
globalPragma,
"xrpl::doVacuumDB : non-null global pragma");
53 session <<
"PRAGMA page_size;", soci::into(pageSize);
A generic endpoint for log messages.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool doVacuumDB(DatabaseCon::Setup const &setup, beast::Journal j)
doVacuumDB Creates, initialises, and performs cleanup on a database.
constexpr std::array< char const *, 8 > kTxDbInit
constexpr char const * kCommonDbPragmaTemp
std::array< std::string, 4 > txPragma
static std::unique_ptr< std::vector< std::string > const > globalPragma
boost::filesystem::path dataDir