[
https://issues.apache.org/jira/browse/SOLR-9269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15387878#comment-15387878
]
ASF GitHub Bot commented on SOLR-9269:
--------------------------------------
Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/52#discussion_r71725843
--- Diff:
solr/core/src/java/org/apache/solr/handler/admin/CoreAdminOperation.java ---
@@ -919,7 +928,93 @@ public void call(CallInfo callInfo) throws Exception {
}
}
}
+ },
+ CREATESNAPSHOT_OP(CREATESNAPSHOT) {
+ @Override
+ public void call(CallInfo callInfo) throws Exception {
+ CoreContainer cc = callInfo.handler.getCoreContainer();
+ final SolrParams params = callInfo.req.getParams();
+
+ String commitName =
params.required().get(CoreAdminParams.COMMIT_NAME);
+ String cname = params.required().get(CoreAdminParams.CORE);
+ try (SolrCore core = cc.getCore(cname)) {
+ if (core == null) {
+ throw new SolrException(ErrorCode.SERVER_ERROR, "Unable to
locate core " + cname);
+ }
+ if (core.getDeletionPolicy().getLatestCommit() == null) {
+ throw new SolrException(ErrorCode.SERVER_ERROR, "Could not find
latest commit. Please ensure to execute a hard commit");
+ }
+
+ String indexDirPath = core.getIndexDir();
+ IndexCommit ic = core.getDeletionPolicy().getLatestCommit();
+ SolrSnapshotMetaDataManager mgr =
core.getSnapshotMetaDataManager();
+ mgr.snapshot(commitName, indexDirPath, ic.getGeneration());
+ }
+ }
+ },
+ DELETESNAPSHOT_OP(DELETESNAPSHOT) {
+ @Override
+ public void call(CallInfo callInfo) throws Exception {
+ CoreContainer cc = callInfo.handler.getCoreContainer();
+ final SolrParams params = callInfo.req.getParams();
+
+ String commitName =
params.required().get(CoreAdminParams.COMMIT_NAME);
+ String cname = params.required().get(CoreAdminParams.CORE);
+ try (SolrCore core = cc.getCore(cname)) {
+ if (core == null) {
+ throw new SolrException(ErrorCode.SERVER_ERROR, "Unable to
locate core " + cname);
+ }
+
+ SolrSnapshotMetaDataManager mgr =
core.getSnapshotMetaDataManager();
+ Optional<SnapshotMetaData> metadata = mgr.release(commitName);
+ if (metadata.isPresent()) {
--- End diff --
Perhaps add an error if we can't find the commit name? REQUEST_ERROR. And
FYI some other exceptions we throw should also be REQUEST_ERROR if it's based
on a param.
> Ability to create/delete/list snapshots for a solr core
> -------------------------------------------------------
>
> Key: SOLR-9269
> URL: https://issues.apache.org/jira/browse/SOLR-9269
> Project: Solr
> Issue Type: Sub-task
> Components: SolrCloud
> Reporter: Hrishikesh Gadre
> Assignee: David Smiley
> Attachments: SOLR-9269.patch
>
>
> Support snapshot create/delete/list functionality @ the Solr core level.
> Please refer to parent JIRA for more details.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]