Abhishek Umarjikar created SOLR-17830:
-----------------------------------------

             Summary: Restore Fails when spacial character in backup file in V1
                 Key: SOLR-17830
                 URL: https://issues.apache.org/jira/browse/SOLR-17830
             Project: Solr
          Issue Type: Bug
          Components: Backup/Restore
    Affects Versions: 9.8.1
            Reporter: Abhishek Umarjikar


I encountered an issue with the restore api which working with the backup name 
containing ":", if it would have complained about the file name or back up name 
I can understand if there are any restriction on the backup name conventions 
but the exception complains about collection name which is not correct. And 
this issue is only with V1 api. Which i assume due to url parameter being 
extracted incorrectly. I encountered this issue in 9.8.1.

Here are the steps to reproduce this.

Solr Restore V1 URL:

[http://localhost:8983/solr/admin/collections?action=RESTORE&name=test-2025-06-05T18:00&collection=testbr&location=/var/solr/data/]

OR
{code:bash}
curl --location 
'http://localhost:8983/solr/admin/collections?action=RESTORE&name=test-2025-06-05T18%3A00&collection=testbr&location=%2Fvar%2Fsolr%2Fdata%2F'
{code}
Fails with bellow error:
{code:json}
{
    "responseHeader": {
        "status": 400,
        "QTime": 2
    },
    "error": {
        "metadata": [
            "error-class",
            "org.apache.solr.common.SolrException",
            "root-error-class",
            "org.apache.solr.common.SolrException"
        ],
        "msg": "Invalid collection: [test-2025-06-05T18:00]. collection names 
must consist entirely of periods, underscores, hyphens, and alphanumerics as 
well not start with a hyphen",
        "code": 400
    }
}
{code}
Solr Restore V2:
{code:bash}
curl --location 
'http://localhost:8983/api/backups/test-2025-06-05T18:00/restore' \
--header 'Content-Type: application/json' \
--data '{
    "collection": "testbr",
    "location": "/var/solr/data/"
}'
{code}
Success with 200 status code:
{code:json}
{
    "responseHeader": {
        "status": 0,
        "QTime": 594
    }
}
{code}
Looks to be issue with ":" in backup name, when taking backup with name without 
":" and restoring works in V1 as well.

Solr log trace:
{code:java}
2025-06-13 08:06:41.535 ERROR (qtp479459041-26-null-157) [c:testbr s: r: x: 
t:null-157] o.a.s.h.RequestHandlerBase Client exception => 
org.apache.solr.common.SolrException: Invalid collection: 
[test-2025-06-05T18:00]. collection names must consist entirely of periods, 
underscores, hyphens, and alphanumerics as well not start with a hyphen
        at 
org.apache.solr.client.solrj.util.SolrIdentifierValidator.validateName(SolrIdentifierValidator.java:42)
org.apache.solr.common.SolrException: Invalid collection: 
[test-2025-06-05T18:00]. collection names must consist entirely of periods, 
underscores, hyphens, and alphanumerics as well not start with a hyphen
        at 
org.apache.solr.client.solrj.util.SolrIdentifierValidator.validateName(SolrIdentifierValidator.java:42)
 ~[?:?]
        at 
org.apache.solr.client.solrj.util.SolrIdentifierValidator.validateCollectionName(SolrIdentifierValidator.java:51)
 ~[?:?]
        at 
org.apache.solr.handler.admin.api.CreateCollection.validateRequestBody(CreateCollection.java:342)
 ~[?:?]
        at 
org.apache.solr.handler.admin.api.RestoreCollection.restoreCollection(RestoreCollection.java:118)
 ~[?:?]
        at 
org.apache.solr.handler.admin.api.RestoreCollection.invokeFromV1Params(RestoreCollection.java:190)
 ~[?:?]
        at 
org.apache.solr.handler.admin.CollectionsHandler$CollectionOperation.lambda$static$33(CollectionsHandler.java:1073)
 ~[?:?]
        at 
org.apache.solr.handler.admin.CollectionsHandler$CollectionOperation.execute(CollectionsHandler.java:1264)
 ~[?:?]
        at 
org.apache.solr.handler.admin.CollectionsHandler.invokeAction(CollectionsHandler.java:321)
 ~[?:?]
        at 
org.apache.solr.handler.admin.CollectionsHandler.handleRequestBody(CollectionsHandler.java:299)
 ~[?:?]
        at 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:228)
 ~[?:?]
        at 
org.apache.solr.servlet.HttpSolrCall.handleAdmin(HttpSolrCall.java:940) ~[?:?]
        at 
org.apache.solr.servlet.HttpSolrCall.handleAdminRequest(HttpSolrCall.java:894) 
~[?:?]
        at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:555) 
~[?:?]
        at 
org.apache.solr.servlet.SolrDispatchFilter.dispatch(SolrDispatchFilter.java:241)
 ~[?:?]
        at 
org.apache.solr.servlet.SolrDispatchFilter.lambda$doFilterRetry$0(SolrDispatchFilter.java:198)
 ~[?:?]
        at 
org.apache.solr.servlet.ServletUtils.traceHttpRequestExecution2(ServletUtils.java:227)
 ~[?:?]
        at 
org.apache.solr.servlet.ServletUtils.rateLimitRequest(ServletUtils.java:197) 
~[?:?]
        at 
org.apache.solr.servlet.SolrDispatchFilter.doFilterRetry(SolrDispatchFilter.java:192)
 ~[?:?]
        at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:181)
 ~[?:?]
        at javax.servlet.http.HttpFilter.doFilter(HttpFilter.java:97) 
~[jetty-servlet-api-4.0.6.jar:?]
        at 
org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:210) 
~[jetty-servlet-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
 ~[jetty-servlet-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527) 
~[jetty-servlet-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131) 
~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:598) 
~[jetty-security-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) 
~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484) 
~[jetty-servlet-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129) 
~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:228)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:141)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) 
~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:301)
 ~[jetty-rewrite-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) 
~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:822) 
~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) 
~[jetty-server-10.0.22.jar:10.0.22]
        at org.eclipse.jetty.server.Server.handle(Server.java:563) 
~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
 ~[jetty-server-10.0.22.jar:10.0.22]
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753) 
~[jetty-server-10.0.22.jar:10.0.22]
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501) 
~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287) 
~[jetty-server-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
 ~[jetty-io-10.0.22.jar:10.0.22]
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100) 
~[jetty-io-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
 ~[jetty-io-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
 ~[jetty-util-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
 ~[jetty-util-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
 ~[jetty-util-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
 ~[jetty-util-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
 ~[jetty-util-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
 ~[jetty-util-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
 ~[jetty-util-10.0.22.jar:10.0.22]
        at 
org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
 ~[jetty-util-10.0.22.jar:10.0.22]
        at java.base/java.lang.Thread.run(Unknown Source) [?:?]
2025-06-13 08:06:41.536 INFO  (qtp479459041-26-null-157) [c:testbr s: r: x: 
t:null-157] o.a.s.s.HttpSolrCall [admin] webapp=null path=/admin/collections 
params={name=test-2025-06-05T18:00&action=RESTORE&location=/var/solr/data/&collection=testbr}
 status=400 QTime=5
{code}
If you work without ":" in the backup name, it works as expected. for e.g.

[http://localhost:8983/solr/admin/collections?action=RESTORE&name=test-2025-06-05T1800&collection=testbr&location=/var/solr/data/]

I checked in the code and i suspect if V2 api broken the behaviour as i could 
see there is common place which extract and create an object of the params.

[~gerlowskija] [~dsmiley] 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to