jaykay12 commented on code in PR #5382:
URL: https://github.com/apache/solr/pull/5382#discussion_r4731054744


##########
solr/solr-ref-guide/modules/deployment-guide/pages/user-managed-index-replication.adoc:
##########
@@ -650,10 +650,30 @@ For file system repository, location defaults to the 
core's dataDir (data direct
 `restore`::
 Restore a backup from a backup repository.
 +
+[tabs#restore-request]
+======
+V1 API::
++
+====
 [source,bash]
+----
 http://{leaderHost}:{port}/solr/{coreName}/replication?command=restore
+----
+====
+
+V2 API::
++
+====
+[source,bash]
+----
+curl -X POST -H 'Content-Type: application/json' -d '{"name": "backup_name"}' \
+http://{leaderHost}:{port}/api/cores/{coreName}/replication/restore
+----
+====
+======
 +
 This command is used to restore a backup.
+It is asynchronous; use `restorestatus` to track the progress.

Review Comment:
   Good question. I looked at the existing v2 async patterns, and replication 
restore doesn't fit them today. 
   
   Here is why, and what I changed.
   
   ### Existing patterns
   
   - Collection-level APIs take `async=<id>` and are polled via 
/cluster/command-status/{id}. The state is persisted in ZooKeeper.
   - Core-level APIs (core snapshot create/delete, upgrade-core-index) take 
`async=<id>` and are polled via GET /api/node/commands/{requestId}. The IDs are 
node-local and in-memory.
   
   ### How replication restore works
   
   - ReplicationHandler submits the RestoreCore task to its own single-thread 
restoreExecutor. It keeps only a restoreFuture and a currentRestoreName. It 
never goes through the CoreAdminHandler async task tracking.
   - There is no request ID. The status is "the most recent restore on this 
core": NOT_STARTED, IN_PROGRESS, SUCCESS or FAILED, plus the exception message.
   - Starting a second restore while one is running is rejected, so a single 
latest-status slot is enough for the current design.
   - This is the existing v1 behaviour (command=restore + 
command=restorestatus). The v2 endpoints (POST .../replication/restore, GET 
.../replication/restore/status) mirror v1 one-to-one, and v1 behaviour is 
unchanged.
   
   ### What I did in this PR
   I did not bolt an async param onto the v2 request body. It would look 
consistent, but it would not be backed by the /node/commands/{id} machinery, so 
users would pass an ID that nothing can look up. Instead I reworded the ref 
guide and the OpenAPI description. They no longer just say "asynchronous". They 
say the restore runs in the background, takes no async request ID, and that 
restorestatus reports the most recent restore.
   
   ### Making it consistent (follow-up)
   
   I would be needing more context & hands-on if I chose to make these changes 
in the existing one.
   I'd rather do it as a separate JIRA/PR than widen the scope of this one. Let 
me know if that makes sense.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to