Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temper excessive warnings about historical shard #3620

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions src/ripple/nodestore/impl/DatabaseShardImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,9 @@ DatabaseShardImp::import(Database& source)
true,
boost::none);
success = true;

if (shardIndex < shardBoundaryIndex())
++numHistShards;
}
catch (std::exception const& e)
{
Expand Down Expand Up @@ -1409,10 +1412,20 @@ DatabaseShardImp::setFileStats()
fdRequired_ = sumFd;
avgShardFileSz_ = (numShards == 0 ? fileSz_ : fileSz_ / numShards);

if (!canAdd_)
return;

if (auto const count = numHistoricalShards(lock);
count >= maxHistoricalShards_)
{
JLOG(j_.warn()) << "maximum number of historical shards reached";
if (maxHistoricalShards_)
{
// In order to avoid excessive output, don't produce
// this warning if the server isn't configured to
// store historical shards.
JLOG(j_.warn()) << "maximum number of historical shards reached";
}

undertome marked this conversation as resolved.
Show resolved Hide resolved
canAdd_ = false;
}
else if (!sufficientStorage(
Expand All @@ -1422,6 +1435,8 @@ DatabaseShardImp::setFileStats()
{
JLOG(j_.warn())
<< "maximum shard store size exceeds available storage space";

canAdd_ = false;
}
}

Expand Down Expand Up @@ -1561,14 +1576,17 @@ DatabaseShardImp::removeFailedShard(std::shared_ptr<Shard>& shard)
std::uint32_t
DatabaseShardImp::shardBoundaryIndex() const
{
auto const validIndex = app_.getLedgerMaster().getValidLedgerIndex();

if (validIndex < earliestLedgerSeq())
undertome marked this conversation as resolved.
Show resolved Hide resolved
return validIndex;

// Shards with an index earlier than the recent shard boundary index
// are considered historical. The three shards at or later than
// this index consist of the two most recently validated shards
// and the shard still in the process of being built by live
// transactions.
return NodeStore::seqToShardIndex(
app_.getLedgerMaster().getValidLedgerIndex(), ledgersPerShard_) -
1;
return seqToShardIndex(validIndex) - 1;
undertome marked this conversation as resolved.
Show resolved Hide resolved
}

std::uint32_t
Expand Down