Skip to content

resource to disable remote wipe#294

Open
danovaro wants to merge 1 commit into
developfrom
feature/disableWipe
Open

resource to disable remote wipe#294
danovaro wants to merge 1 commit into
developfrom
feature/disableWipe

Conversation

@danovaro

@danovaro danovaro commented Jun 30, 2026

Copy link
Copy Markdown
Member

Description

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

🌈🌦️📖🚧 Documentation FDB 🚧📖🌦️🌈
https://sites.ecmwf.int/docs/fdb/pull-requests/PR-294

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a runtime configuration switch to disable remote wipe operations in the remote server handlers, with wipe being disabled by default unless explicitly enabled via config/environment.

Changes:

  • Add fdbWipeEnabled;$FDB_WIPE_ENABLED resource flag (default false) to gate wipe-related control messages.
  • Reject wipe-related control messages when wipe is disabled.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
src/fdb5/remote/server/StoreHandler.cc Adds a wipeEnabled resource flag and blocks wipe-related control messages when disabled.
src/fdb5/remote/server/CatalogueHandler.cc Adds the same wipeEnabled resource flag and blocks wipe-related control messages when disabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 97 to 119
case Message::Wipe: // Initial wipe request
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
finaliseWipeState(clientID, requestID, payload);
return Handled::Replied;

case Message::DoWipeURIs: // request to delete data marked for wipe
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
doWipeURIs(clientID, requestID, payload);
return Handled::Yes;

case Message::DoWipeFinish: // request to delete empty databases and finish the wipe.
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
doWipeFinish(clientID, requestID, payload);
return Handled::Yes;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can deadlock clients waiting for the control response. Write the control ack first, then send the error, and return Handled::Replied to avoid duplicate acks/errors.

@danovaro , is this true?

Comment on lines 121 to 135
case Message::DoWipeUnknowns: // request to delete unknown URIs as part of a wipe
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
doWipeUnknowns(clientID, requestID, payload);
return Handled::Yes;

case Message::DoUnsafeFullWipe: // request to delete full database and content
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
doUnsafeFullWipe(clientID, requestID, payload);
return Handled::Replied;

Handled StoreHandler::handleControl(Message message, uint32_t clientID, uint32_t requestID, eckit::Buffer&& payload) {

static bool wipeEnabled = Resource<bool>("fdbWipeEnabled;$FDB_WIPE_ENABLED", false);
Comment on lines 136 to 151
case Message::Wipe: // Initial wipe request
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
wipe(clientID, requestID, std::move(payload));
return Handled::Yes;

case Message::DoMaskIndexEntries:
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
// doit! We expect DoMaskIndexEntries, doWipeURIs, DoWipeUnknowns and doWipeEmptyDatabase in succession
doMaskIndexEntries(clientID, requestID, std::move(payload));
return Handled::Yes;
Comment on lines 153 to 167
case Message::DoWipeURIs: // Do the wipe on our currentWipeState
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
doWipeURIs(clientID, requestID, std::move(payload));
return Handled::Yes;

case Message::DoWipeFinish: // Finish wipe by deleting empty DBs
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
doWipeEmptyDatabase(clientID, requestID, std::move(payload));
return Handled::Yes;
Comment on lines 169 to 183
case Message::DoWipeUnknowns: // Wipe a set of unknown URIs
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
doWipeUnknowns(clientID, requestID, std::move(payload));
return Handled::Yes;

case Message::DoUnsafeFullWipe: // wipe a full database including its content
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
doUnsafeFullWipe(clientID, requestID, std::move(payload));
return Handled::Replied;
Handled CatalogueHandler::handleControl(Message message, uint32_t clientID, uint32_t requestID,
eckit::Buffer&& payload) {

static bool wipeEnabled = Resource<bool>("fdbWipeEnabled;$FDB_WIPE_ENABLED", false);
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 5.71429% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.93%. Comparing base (6c9e5cd) to head (a27d2b1).

Files with missing lines Patch % Lines
src/fdb5/remote/server/CatalogueHandler.cc 5.26% 18 Missing ⚠️
src/fdb5/remote/server/StoreHandler.cc 6.25% 15 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #294      +/-   ##
===========================================
- Coverage    71.06%   70.93%   -0.14%     
===========================================
  Files          370      370              
  Lines        23455    23490      +35     
  Branches      2463     2472       +9     
===========================================
- Hits         16669    16663       -6     
- Misses        6786     6827      +41     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines 97 to 119
case Message::Wipe: // Initial wipe request
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
finaliseWipeState(clientID, requestID, payload);
return Handled::Replied;

case Message::DoWipeURIs: // request to delete data marked for wipe
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
doWipeURIs(clientID, requestID, payload);
return Handled::Yes;

case Message::DoWipeFinish: // request to delete empty databases and finish the wipe.
if (!wipeEnabled) {
error("Wipe functionality is not enabled", clientID, requestID);
return Handled::No;
}
doWipeFinish(clientID, requestID, payload);
return Handled::Yes;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can deadlock clients waiting for the control response. Write the control ack first, then send the error, and return Handled::Replied to avoid duplicate acks/errors.

@danovaro , is this true?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants