Skip to content

Commit 414a5e5

Browse files
Fix misc pool exception and relevant test (#5098)
2 parents bc2edc3 + 79a0587 commit 414a5e5

2 files changed

Lines changed: 28 additions & 18 deletions

File tree

src/history/StateSnapshot.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ bool
5454
StateSnapshot::writeSCPMessages() const
5555
{
5656
ZoneScoped;
57+
bool canUseMisc = mApp.getDatabase().canUseMiscDB();
5758
std::unique_ptr<soci::session> snapSess(
5859
(mApp.getDatabase().canUsePool()
59-
? std::make_unique<soci::session>(mApp.getDatabase().getMiscPool())
60+
? std::make_unique<soci::session>(
61+
canUseMisc ? mApp.getDatabase().getMiscPool()
62+
: mApp.getDatabase().getPool())
6063
: nullptr));
6164
soci::session& sess(snapSess ? *snapSess
6265
: mApp.getDatabase().getRawMiscSession());

src/history/test/HistoryTests.cpp

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,16 +1096,6 @@ TEST_CASE("Publish throttles catchup", "[history][catchup][acceptance]")
10961096
TEST_CASE("History catchup with different modes",
10971097
"[history][catchup][acceptance]")
10981098
{
1099-
CatchupSimulation catchupSimulation{};
1100-
1101-
auto checkpointLedger = catchupSimulation.getLastCheckpointLedger(3);
1102-
catchupSimulation.ensureOnlineCatchupPossible(checkpointLedger, 5);
1103-
1104-
std::vector<Application::pointer> apps;
1105-
1106-
std::vector<uint32_t> counts = {0, std::numeric_limits<uint32_t>::max(),
1107-
60};
1108-
11091099
std::vector<Config::TestDbMode> dbModes = {
11101100
Config::TESTDB_BUCKET_DB_PERSISTENT};
11111101
#ifdef USE_POSTGRES
@@ -1115,14 +1105,31 @@ TEST_CASE("History catchup with different modes",
11151105

11161106
for (auto dbMode : dbModes)
11171107
{
1118-
for (auto count : counts)
1108+
SECTION(std::string("DB mode: ") + dbModeName(dbMode))
11191109
{
1120-
auto a = catchupSimulation.createCatchupApplication(
1121-
count, dbMode,
1122-
std::string("full, ") + resumeModeName(count) + ", " +
1123-
dbModeName(dbMode));
1124-
REQUIRE(catchupSimulation.catchupOnline(a, checkpointLedger, 5));
1125-
apps.push_back(a);
1110+
CatchupSimulation catchupSimulation{
1111+
VirtualClock::VIRTUAL_TIME,
1112+
std::make_shared<TmpDirHistoryConfigurator>(), true, dbMode};
1113+
1114+
auto checkpointLedger =
1115+
catchupSimulation.getLastCheckpointLedger(3);
1116+
catchupSimulation.ensureOnlineCatchupPossible(checkpointLedger, 5);
1117+
1118+
std::vector<Application::pointer> apps;
1119+
1120+
std::vector<uint32_t> counts = {
1121+
0, std::numeric_limits<uint32_t>::max(), 60};
1122+
1123+
for (auto count : counts)
1124+
{
1125+
auto a = catchupSimulation.createCatchupApplication(
1126+
count, dbMode,
1127+
std::string("full, ") + resumeModeName(count) + ", " +
1128+
dbModeName(dbMode));
1129+
REQUIRE(
1130+
catchupSimulation.catchupOnline(a, checkpointLedger, 5));
1131+
apps.push_back(a);
1132+
}
11261133
}
11271134
}
11281135
}

0 commit comments

Comments
 (0)