Merge remote-tracking branch 'sfc-gh-tclinkenbeard/clear-key-provider' into redwood-page-lifetimes
This commit is contained in:
commit
cd83595a0f
|
@ -4805,7 +4805,7 @@ struct BoundaryRefAndPage {
|
|||
// DecodeBoundaryVerifier provides simulation-only verification of DeltaTree boundaries between
|
||||
// reads and writes by using a static structure to track boundaries used during DeltaTree generation
|
||||
// for all writes and updates across cold starts and virtual process restarts.
|
||||
struct DecodeBoundaryVerifier {
|
||||
class DecodeBoundaryVerifier {
|
||||
struct DecodeBoundaries {
|
||||
Key lower;
|
||||
Key upper;
|
||||
|
@ -4816,11 +4816,13 @@ struct DecodeBoundaryVerifier {
|
|||
|
||||
typedef std::map<Version, DecodeBoundaries> BoundariesByVersion;
|
||||
std::unordered_map<LogicalPageID, BoundariesByVersion> boundariesByPageID;
|
||||
std::vector<Key> boundarySamples;
|
||||
int boundarySampleSize = 1000;
|
||||
int boundaryPopulation = 0;
|
||||
Reference<IPageEncryptionKeyProvider> keyProvider;
|
||||
|
||||
public:
|
||||
std::vector<Key> boundarySamples;
|
||||
|
||||
// Sample rate of pages to be scanned to verify if all entries in the page meet domain prefix requirement.
|
||||
double domainPrefixScanProbability = 0.01;
|
||||
uint64_t domainPrefixScanCount = 0;
|
||||
|
@ -4849,7 +4851,7 @@ struct DecodeBoundaryVerifier {
|
|||
if (boundarySamples.empty()) {
|
||||
return Key();
|
||||
}
|
||||
return boundarySamples[deterministicRandom()->randomInt(0, boundarySamples.size())];
|
||||
return deterministicRandom()->randomChoice(boundarySamples);
|
||||
}
|
||||
|
||||
bool update(BTreeNodeLinkRef id,
|
||||
|
@ -5415,6 +5417,15 @@ public:
|
|||
Future<Void> init() { return m_init; }
|
||||
|
||||
virtual ~VersionedBTree() {
|
||||
// DecodeBoundaryVerifier objects outlive simulated processes.
|
||||
// Thus, if we did not clear the key providers here, each DecodeBoundaryVerifier object might
|
||||
// maintain references to untracked peers through its key provider. This would result in
|
||||
// errors when FlowTransport::removePeerReference is called to remove a peer that is no
|
||||
// longer tracked by FlowTransport::transport().
|
||||
if (m_pBoundaryVerifier != nullptr) {
|
||||
m_pBoundaryVerifier->setKeyProvider(Reference<IPageEncryptionKeyProvider>());
|
||||
}
|
||||
|
||||
// This probably shouldn't be called directly (meaning deleting an instance directly) but it should be safe,
|
||||
// it will cancel init and commit and leave the pager alive but with potentially an incomplete set of
|
||||
// uncommitted writes so it should not be committed.
|
||||
|
|
Loading…
Reference in New Issue