Skip to content

Conversation

@epugh
Copy link
Contributor

@epugh epugh commented Jan 20, 2026

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

  • Added deletedPlugins Set field to track deleted plugins
  • Modified deleteNamedPlugin() to create tombstone markers in "deleted" list
  • Added isPluginDeleted(String typ, String name) to check deletion status
  • Added getDeletedPlugins() to retrieve all deleted plugin keys
  • Constructor updated to load deleted plugins from persisted JSON

RequestHandlers.java - Handler filtering

  • Modified initHandlersFromConfig() to filter deleted implicit handlers
  • Checks overlay.isPluginDeleted() before registering each implicit handler

SolrConfigHandler.java - Enhanced deletion logic

  • Updated deleteNamedComponent() to recognize and delete implicit handlers
  • Modified pluginExists() to exclude deleted plugins from existence checks

2. 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 passing
  • testSetProperty() - Existing test, still passing
  • testDeletedPluginTombstone() - Tests basic tombstone creation
  • testDeletedPluginFromOverlay() - Tests deleting overlay-defined plugins
  • testDeletedPluginPersistence() - Tests loading from JSON
  • testDeleteSamePluginTwice() - Tests idempotent deletion

Integration Tests (TestSolrConfigHandler.java) - 9 tests, all passing ✅

  • All existing tests continue to pass
  • testDeleteImplicitHandler() - New test for implicit handler deletion

How It Works

  1. User issues delete command: POST /config {"delete-requesthandler": "/admin/ping"}
  2. SolrConfigHandler processes the command
  3. ConfigOverlay adds "requestHandler:/admin/ping" to the "deleted" list
  4. Overlay is persisted to configoverlay.json
  5. Core is reloaded
  6. RequestHandlers.initHandlersFromConfig() filters out deleted implicit handlers
  7. Handler is no longer available

Usage Examples

Delete an Implicit Handler

curl -X POST http://localhost:8983/solr/collection1/config \
  -H 'Content-Type: application/json' \
  -d '{
    "delete-requesthandler": "/admin/ping"
  }'

View Deleted Handlers

curl http://localhost:8983/solr/collection1/config/overlay

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:

curl -X POST http://localhost:8983/solr/collection1/config \
  -H 'Content-Type: application/json' \
  -d '{
    "create-requesthandler": {
      "name": "/admin/ping",
      "class": "org.apache.solr.handler.DumpRequestHandler"
    }
  }'

Files Modified

  • solr/core/src/java/org/apache/solr/core/ConfigOverlay.java
  • solr/core/src/java/org/apache/solr/core/RequestHandlers.java
  • solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java
  • solr/core/src/test/org/apache/solr/core/TestConfigOverlay.java
  • solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java

Key Design Decisions

Why Tombstone Marker?

We evaluated three approaches:

  1. Tombstone Marker (chosen) ✅
  2. Null value marker
  3. Dedicated deletion API

Tombstone was selected because:

  • ✅ Clean separation of concerns
  • ✅ Doesn't pollute plugin data structure
  • ✅ Easy to check if plugin is deleted
  • ✅ Works for both implicit and overlay plugins
  • ✅ Extensible to other plugin types
  • ✅ Serializes/persists naturally in JSON

Tests

Add tests + manually tested

@github-actions github-actions bot added documentation Improvements or additions to documentation tests labels Jan 20, 2026
@epugh epugh changed the title SOLR-18078: Support deleting implicitly created request handlers via config API SOLR-18078: Support deleting implicitly created request handlers and query response writers via config API Jan 21, 2026
@epugh
Copy link
Contributor Author

epugh commented Jan 21, 2026

Extending to Query Response Writers was pretty easy!

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

Labels

documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant