Skip to content

Commit

Permalink
[FOLD] Fix travis error; Fix Checkpointer bug
Browse files Browse the repository at this point in the history
  • Loading branch information
undertome committed Nov 1, 2020
1 parent 453894b commit f8f52d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ripple/core/impl/DatabaseCon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ DatabaseCon::~DatabaseCon()
if (checkpointer_)
{
checkpointers.erase(checkpointer_->id());

std::weak_ptr<Checkpointer> wk(checkpointer_);
checkpointer_.reset();

// The references to our Checkpointer held by 'checkpointer_' and
// 'checkpointers' have been removed, so if the use count is nonzero, a
// checkpoint is currently in progress. Wait for it to end, otherwise
// creating a new DatabaseCon to the same database may fail due to the
// database being locked by our (now old) Checkpointer.
while (wk.use_count())
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/ripple/nodestore/impl/DatabaseShardImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ DatabaseShardImp::prepareShards(std::vector<std::uint32_t> const& shardIndexes)
auto const prepareSuccessful =
preparedIndexes_.emplace(shardIndex).second;

(void)prepareSuccessful;
assert(prepareSuccessful);
}

Expand Down

0 comments on commit f8f52d0

Please sign in to comment.