Skip to content

Commit 6cc76fc

Browse files
committed
Initialize Bucket directory after the database
1 parent 5188590 commit 6cc76fc

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/main/ApplicationImpl.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,20 +239,13 @@ maybeRebuildLedger(Application& app, bool applyBuckets)
239239
void
240240
ApplicationImpl::initialize(bool createNewDB, bool forceRebuild)
241241
{
242-
// Subtle: initialize the bucket manager first before initializing the
243-
// database. This is needed as some modes in core (such as in-memory) use a
244-
// small database inside the bucket directory.
245242
mAppConnector = std::make_unique<AppConnector>(*this);
246-
mBucketManager = BucketManager::create(getAppConnector());
247243

248244
bool initNewDB =
249245
createNewDB || mConfig.DATABASE.value == "sqlite3://:memory:";
250-
if (initNewDB)
251-
{
252-
mBucketManager->maybeDropAndCreateNew();
253-
}
254246

255247
mDatabase = createDatabase();
248+
mBucketManager = BucketManager::create(getAppConnector());
256249
mPersistentState = std::make_unique<PersistentState>(*this);
257250
mOverlayManager = createOverlayManager();
258251
mLedgerManager = createLedgerManager();
@@ -377,6 +370,7 @@ void
377370
ApplicationImpl::newDB()
378371
{
379372
mDatabase->initialize();
373+
mBucketManager->maybeDropAndCreateNew();
380374
upgradeToCurrentSchemaAndMaybeRebuildLedger(false, true);
381375
mLedgerManager->startNewLedger();
382376
}

0 commit comments

Comments
 (0)