SOLR-18078: Support deleting implicitly created request handlers and query response writers via config API #4066
+385
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/SOLR-18078
Description
You can now delete any of the request handlers created by ImplicitPlugins.json and query response writers that are hard coded.
Solution
Implemented the Tombstone Marker pattern to enable deletion of implicitly created request handlers (from
ImplicitPlugins.json) and query response writers through the ConfigOverlay API.I'm going to paste in a whole bunch of claude generated details for anyone who wants to read thorugh it....
What Was Implemented
1. Core Functionality
ConfigOverlay.java - Tombstone tracking system
deletedPluginsSet field to track deleted pluginsdeleteNamedPlugin()to create tombstone markers in "deleted" listisPluginDeleted(String typ, String name)to check deletion statusgetDeletedPlugins()to retrieve all deleted plugin keysRequestHandlers.java - Handler filtering
initHandlersFromConfig()to filter deleted implicit handlersoverlay.isPluginDeleted()before registering each implicit handlerSolrConfigHandler.java - Enhanced deletion logic
deleteNamedComponent()to recognize and delete implicit handlerspluginExists()to exclude deleted plugins from existence checks2. Data Structure
The ConfigOverlay JSON now supports a "deleted" array:
{ "overlay": { "requestHandler": { "/custom": {...} }, "deleted": [ "requestHandler:/admin/ping", "requestHandler:/sql" ] } }3. Test Coverage
Unit Tests (TestConfigOverlay.java) - 6 tests, all passing ✅
testPaths()- Existing test, still passingtestSetProperty()- Existing test, still passingtestDeletedPluginTombstone()- Tests basic tombstone creationtestDeletedPluginFromOverlay()- Tests deleting overlay-defined pluginstestDeletedPluginPersistence()- Tests loading from JSONtestDeleteSamePluginTwice()- Tests idempotent deletionIntegration Tests (TestSolrConfigHandler.java) - 9 tests, all passing ✅
testDeleteImplicitHandler()- New test for implicit handler deletionHow It Works
POST /config {"delete-requesthandler": "/admin/ping"}configoverlay.jsonUsage Examples
Delete an Implicit Handler
View Deleted Handlers
Response:
{ "responseHeader": { "status": 0, "QTime": 1 }, "overlay": { "deleted": [ "requestHandler:/admin/ping" ] } }Recreate a Deleted Handler
After deletion, you can create a new handler with the same name:
Files Modified
solr/core/src/java/org/apache/solr/core/ConfigOverlay.javasolr/core/src/java/org/apache/solr/core/RequestHandlers.javasolr/core/src/java/org/apache/solr/handler/SolrConfigHandler.javasolr/core/src/test/org/apache/solr/core/TestConfigOverlay.javasolr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.javaKey Design Decisions
Why Tombstone Marker?
We evaluated three approaches:
Tombstone was selected because:
Tests
Add tests + manually tested