97 Throw<std::runtime_error>(
"database_path must be set.");
103 auto const& sqlite = c.
section(
"sqlite");
112 bool showRiskWarning =
false;
114 if (
set(safety_level,
"safety_level", sqlite))
116 if (boost::iequals(safety_level,
"low"))
119 journal_mode =
"memory";
121 temp_store =
"memory";
122 showRiskWarning =
true;
124 else if (!boost::iequals(safety_level,
"high"))
126 Throw<std::runtime_error>(
127 "Invalid safety_level value: " + safety_level);
134 if (
set(journal_mode,
"journal_mode", sqlite) &&
135 !safety_level.
empty())
137 Throw<std::runtime_error>(
138 "Configuration file may not define both "
139 "\"safety_level\" and \"journal_mode\"");
141 bool higherRisk = boost::iequals(journal_mode,
"memory") ||
142 boost::iequals(journal_mode,
"off");
143 showRiskWarning = showRiskWarning || higherRisk;
144 if (higherRisk || boost::iequals(journal_mode,
"delete") ||
145 boost::iequals(journal_mode,
"truncate") ||
146 boost::iequals(journal_mode,
"persist") ||
147 boost::iequals(journal_mode,
"wal"))
149 result->emplace_back(boost::str(
154 Throw<std::runtime_error>(
155 "Invalid journal_mode value: " + journal_mode);
161 if (
set(synchronous,
"synchronous", sqlite) &&
162 !safety_level.
empty())
164 Throw<std::runtime_error>(
165 "Configuration file may not define both "
166 "\"safety_level\" and \"synchronous\"");
168 bool higherRisk = boost::iequals(synchronous,
"off");
169 showRiskWarning = showRiskWarning || higherRisk;
170 if (higherRisk || boost::iequals(synchronous,
"normal") ||
171 boost::iequals(synchronous,
"full") ||
172 boost::iequals(synchronous,
"extra"))
174 result->emplace_back(boost::str(
179 Throw<std::runtime_error>(
180 "Invalid synchronous value: " + synchronous);
186 if (
set(temp_store,
"temp_store", sqlite) &&
187 !safety_level.
empty())
189 Throw<std::runtime_error>(
190 "Configuration file may not define both "
191 "\"safety_level\" and \"temp_store\"");
193 bool higherRisk = boost::iequals(temp_store,
"memory");
194 showRiskWarning = showRiskWarning || higherRisk;
195 if (higherRisk || boost::iequals(temp_store,
"default") ||
196 boost::iequals(temp_store,
"file"))
198 result->emplace_back(boost::str(
203 Throw<std::runtime_error>(
204 "Invalid temp_store value: " + temp_store);
211 <<
"reducing the data integrity guarantees from the "
212 "default [sqlite] behavior is not recommended for "
213 "nodes storing large amounts of history, because of the "
214 "difficulty inherent in rebuilding corrupted data.";
218 "ripple::setup_DatabaseCon::globalPragma : result size is 3");
230 setPragma(setup.
lgrPragma[0],
"journal_size_limit", 1582080);
233 int64_t page_size = 4096;
234 int64_t journal_size_limit = 1582080;
238 set(journal_size_limit,
"journal_size_limit", s);
239 set(page_size,
"page_size", s);
240 if (page_size < 512 || page_size > 65536)
241 Throw<std::runtime_error>(
242 "Invalid page_size. Must be between 512 and 65536.");
244 if (page_size & (page_size - 1))
245 Throw<std::runtime_error>(
246 "Invalid page_size. Must be a power of 2.");
249 setPragma(setup.
txPragma[0],
"page_size", page_size);
250 setPragma(setup.
txPragma[1],
"journal_size_limit", journal_size_limit);
251 setPragma(setup.
txPragma[2],
"max_page_count", 4294967294);
252 setPragma(setup.
txPragma[3],
"mmap_size", 17179869184);
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
std::shared_ptr< Checkpointer > makeCheckpointer(std::uintptr_t id, std::weak_ptr< soci::session > session, JobQueue &queue, Logs &logs)
Returns a new checkpointer which makes checkpoints of a soci database every checkpointPageCount pages...