20 #include <ripple/beast/unit_test.h>
21 #include <ripple/beast/utility/temp_dir.h>
22 #include <ripple/core/ConfigSections.h>
23 #include <ripple/nodestore/DatabaseShard.h>
24 #include <ripple/protocol/jss.h>
25 #include <test/jtx/Env.h>
41 auto const completed =
42 result[jss::error_message] ==
"Database import not running";
47 info->incomplete().size() + info->finalized().size() ==
65 section.set(
"path", tempDir.
path());
66 section.set(
"max_historical_shards",
"20");
67 section.set(
"ledgers_per_shard",
"256");
68 section.set(
"earliest_seq",
"257");
70 sectionNode.set(
"earliest_seq",
"257");
71 sectionNode.set(
"ledgers_per_shard",
"256");
72 c->setupControl(
true,
true,
true);
74 return jtx::Env(*
this, std::move(c));
89 if (!BEAST_EXPECT(shardStore))
97 jvParams[jss::action] =
"start";
99 auto const result = env.
rpc(
100 "json",
"node_to_shard",
to_string(jvParams))[jss::result];
103 result[jss::message] ==
"Database import initiated...");
106 while (!shardStore->getDatabaseImportSequence())
117 jvParams[jss::action] =
"status";
119 auto const result = env.
rpc(
120 "json",
"node_to_shard",
to_string(jvParams))[jss::result];
123 result[jss::status] ==
"success" ||
134 auto const completeShards =
135 shardStore->getShardInfo()->finalized();
137 if (!completeShards.empty())
139 auto const result = env.
rpc(
146 BEAST_EXPECT(result[jss::firstShardIndex] == 1);
147 BEAST_EXPECT(result[jss::lastShardIndex] == 10);
151 if (boost::icl::contains(completeShards, 1))
153 auto const result = env.
rpc(
159 result[jss::currentShardIndex] >= 1 ||
169 false,
"Import timeout: could just be a slow machine.");
175 while (!boost::icl::contains(
176 shardStore->getShardInfo()->finalized(), 10))
199 section.set(
"path", tempDir.
path());
200 section.set(
"max_historical_shards",
"20");
201 section.set(
"ledgers_per_shard",
"256");
202 section.set(
"earliest_seq",
"257");
204 sectionNode.set(
"earliest_seq",
"257");
205 sectionNode.set(
"ledgers_per_shard",
"256");
206 c->setupControl(
true,
true,
true);
208 return jtx::Env(*
this, std::move(c));
216 (numberOfShards + 1);
223 if (!BEAST_EXPECT(shardStore))
231 jvParams[jss::action] =
"start";
233 auto const result = env.
rpc(
234 "json",
"node_to_shard",
to_string(jvParams))[jss::result];
237 result[jss::message] ==
"Database import initiated...");
245 jvParams[jss::action] =
"status";
247 auto const result = env.
rpc(
248 "json",
"node_to_shard",
to_string(jvParams))[jss::result];
251 result[jss::status] ==
"success" ||
257 while (shardStore->getShardInfo()->finalized().empty())
265 false,
"Import timeout: could just be a slow machine.");
273 jvParams[jss::action] =
"stop";
275 auto const result = env.
rpc(
276 "json",
"node_to_shard",
to_string(jvParams))[jss::result];
279 result[jss::message] ==
"Database import halt initiated..." ||
292 jvParams[jss::action] =
"status";
294 auto const result = env.
rpc(
295 "json",
"node_to_shard",
to_string(jvParams))[jss::result];
299 if (result.isMember(jss::error))
301 if (BEAST_EXPECT(result.isMember(jss::error_message)))
304 result[jss::error_message] ==
305 "Database import not running");
315 false,
"Import timeout: could just be a slow machine.");