@@ -185,7 +185,7 @@ std::string const&
185
185
BucketManagerImpl::getTmpDir ()
186
186
{
187
187
ZoneScoped;
188
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
188
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
189
189
if (!mWorkDir )
190
190
{
191
191
TmpDir t = mTmpDirManager ->tmpDir (" bucket" );
@@ -281,7 +281,7 @@ BucketManagerImpl::getMergeTimer()
281
281
MergeCounters
282
282
BucketManagerImpl::readMergeCounters ()
283
283
{
284
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
284
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
285
285
return mMergeCounters ;
286
286
}
287
287
@@ -371,7 +371,7 @@ MergeCounters::operator==(MergeCounters const& other) const
371
371
void
372
372
BucketManagerImpl::incrMergeCounters (MergeCounters const & delta)
373
373
{
374
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
374
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
375
375
mMergeCounters += delta;
376
376
}
377
377
@@ -397,7 +397,7 @@ BucketManagerImpl::adoptFileAsBucket(std::string const& filename,
397
397
{
398
398
ZoneScoped;
399
399
releaseAssertOrThrow (mApp .getConfig ().MODE_ENABLES_BUCKETLIST );
400
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
400
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
401
401
402
402
if (mergeKey)
403
403
{
@@ -481,7 +481,7 @@ BucketManagerImpl::noteEmptyMergeOutput(MergeKey const& mergeKey)
481
481
// because it'd over-identify multiple individual inputs with the empty
482
482
// output, potentially retaining far too many inputs, as lots of different
483
483
// mergeKeys result in an empty output.
484
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
484
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
485
485
CLOG_TRACE (Bucket, " BucketManager::noteEmptyMergeOutput({})" , mergeKey);
486
486
mLiveFutures .erase (mergeKey);
487
487
}
@@ -490,7 +490,7 @@ std::shared_ptr<Bucket>
490
490
BucketManagerImpl::getBucketIfExists (uint256 const & hash)
491
491
{
492
492
ZoneScoped;
493
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
493
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
494
494
auto i = mSharedBuckets .find (hash);
495
495
if (i != mSharedBuckets .end ())
496
496
{
@@ -507,7 +507,7 @@ std::shared_ptr<Bucket>
507
507
BucketManagerImpl::getBucketByHash (uint256 const & hash)
508
508
{
509
509
ZoneScoped;
510
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
510
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
511
511
if (isZero (hash))
512
512
{
513
513
return std::make_shared<Bucket>();
@@ -540,7 +540,7 @@ std::shared_future<std::shared_ptr<Bucket>>
540
540
BucketManagerImpl::getMergeFuture (MergeKey const & key)
541
541
{
542
542
ZoneScoped;
543
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
543
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
544
544
MergeCounters mc;
545
545
auto i = mLiveFutures .find (key);
546
546
if (i == mLiveFutures .end ())
@@ -586,7 +586,7 @@ BucketManagerImpl::putMergeFuture(
586
586
{
587
587
ZoneScoped;
588
588
releaseAssertOrThrow (mApp .getConfig ().MODE_ENABLES_BUCKETLIST );
589
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
589
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
590
590
CLOG_TRACE (
591
591
Bucket,
592
592
" BucketManager::putMergeFuture storing future for running merge {}" ,
@@ -598,7 +598,7 @@ BucketManagerImpl::putMergeFuture(
598
598
void
599
599
BucketManagerImpl::clearMergeFuturesForTesting ()
600
600
{
601
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
601
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
602
602
mLiveFutures .clear ();
603
603
}
604
604
#endif
@@ -697,7 +697,7 @@ BucketManagerImpl::cleanupStaleFiles()
697
697
return ;
698
698
}
699
699
700
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
700
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
701
701
auto referenced = getAllReferencedBuckets ();
702
702
std::transform (std::begin (mSharedBuckets ), std::end (mSharedBuckets ),
703
703
std::inserter (referenced, std::end (referenced)),
727
727
BucketManagerImpl::forgetUnreferencedBuckets ()
728
728
{
729
729
ZoneScoped;
730
- std::lock_guard<std::recursive_mutex> lock (mBucketFileMutex );
730
+ std::lock_guard<std::recursive_mutex> lock (mBucketMutex );
731
731
auto referenced = getAllReferencedBuckets ();
732
732
auto blReferenced = getBucketListReferencedBuckets ();
733
733
@@ -978,56 +978,49 @@ BucketManagerImpl::assumeState(HistoryArchiveState const& has,
978
978
ZoneScoped;
979
979
releaseAssertOrThrow (mApp .getConfig ().MODE_ENABLES_BUCKETLIST );
980
980
981
+ for (uint32_t i = 0 ; i < BucketList::kNumLevels ; ++i)
981
982
{
982
- for (uint32_t i = 0 ; i < BucketList::kNumLevels ; ++i)
983
+ auto curr = getBucketByHash (hexToBin256 (has.currentBuckets .at (i).curr ));
984
+ auto snap = getBucketByHash (hexToBin256 (has.currentBuckets .at (i).snap ));
985
+ if (!(curr && snap))
983
986
{
984
- auto curr =
985
- getBucketByHash (hexToBin256 (has.currentBuckets .at (i).curr ));
986
- auto snap =
987
- getBucketByHash (hexToBin256 (has.currentBuckets .at (i).snap ));
988
- if (!(curr && snap))
989
- {
990
- throw std::runtime_error (" Missing bucket files while assuming "
991
- " saved BucketList state" );
992
- }
987
+ throw std::runtime_error (" Missing bucket files while assuming "
988
+ " saved BucketList state" );
989
+ }
993
990
994
- auto const & nextFuture = has.currentBuckets .at (i).next ;
995
- std::shared_ptr<Bucket> nextBucket = nullptr ;
996
- if (nextFuture.hasOutputHash ())
991
+ auto const & nextFuture = has.currentBuckets .at (i).next ;
992
+ std::shared_ptr<Bucket> nextBucket = nullptr ;
993
+ if (nextFuture.hasOutputHash ())
994
+ {
995
+ nextBucket =
996
+ getBucketByHash (hexToBin256 (nextFuture.getOutputHash ()));
997
+ if (!nextBucket)
997
998
{
998
- nextBucket =
999
- getBucketByHash (hexToBin256 (nextFuture.getOutputHash ()));
1000
- if (!nextBucket)
1001
- {
1002
- throw std::runtime_error (
1003
- " Missing future bucket files while "
1004
- " assuming saved BucketList state" );
1005
- }
999
+ throw std::runtime_error (" Missing future bucket files while "
1000
+ " assuming saved BucketList state" );
1006
1001
}
1002
+ }
1007
1003
1008
- // Buckets on the BucketList should always be indexed when
1009
- // BucketListDB enabled
1010
- if (mApp .getConfig ().isUsingBucketListDB ())
1004
+ // Buckets on the BucketList should always be indexed when
1005
+ // BucketListDB enabled
1006
+ if (mApp .getConfig ().isUsingBucketListDB ())
1007
+ {
1008
+ releaseAssert (curr->isEmpty () || curr->isIndexed ());
1009
+ releaseAssert (snap->isEmpty () || snap->isIndexed ());
1010
+ if (nextBucket)
1011
1011
{
1012
- releaseAssert (curr->isEmpty () || curr->isIndexed ());
1013
- releaseAssert (snap->isEmpty () || snap->isIndexed ());
1014
- if (nextBucket)
1015
- {
1016
- releaseAssert (nextBucket->isEmpty () ||
1017
- nextBucket->isIndexed ());
1018
- }
1012
+ releaseAssert (nextBucket->isEmpty () || nextBucket->isIndexed ());
1019
1013
}
1020
-
1021
- mBucketList ->getLevel (i).setCurr (curr);
1022
- mBucketList ->getLevel (i).setSnap (snap);
1023
- mBucketList ->getLevel (i).setNext (nextFuture);
1024
1014
}
1025
1015
1026
- if (restartMerges)
1027
- {
1028
- mBucketList ->restartMerges (mApp , maxProtocolVersion,
1029
- has.currentLedger );
1030
- }
1016
+ mBucketList ->getLevel (i).setCurr (curr);
1017
+ mBucketList ->getLevel (i).setSnap (snap);
1018
+ mBucketList ->getLevel (i).setNext (nextFuture);
1019
+ }
1020
+
1021
+ if (restartMerges)
1022
+ {
1023
+ mBucketList ->restartMerges (mApp , maxProtocolVersion, has.currentLedger );
1031
1024
}
1032
1025
1033
1026
mSnapshotManager ->updateCurrentSnapshot (
0 commit comments