Skip to content
9 changes: 9 additions & 0 deletions changelog/unreleased/SOLR-16398-replication-phase1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title:
Add V2 JAX-RS API for replication details (GET /api/cores/{coreName}/replication)
type: added
authors:
- name: Jalaz Kumar
nick: jaykay12
links:
- name: SOLR-16398
url: https://issues.apache.org/jira/browse/SOLR-16398
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,26 @@
import java.io.IOException;
import org.apache.solr.client.api.model.FileListResponse;
import org.apache.solr.client.api.model.IndexVersionResponse;
import org.apache.solr.client.api.model.ReplicationDetailsResponse;
import org.apache.solr.client.api.util.CoreApiParameters;

@Path("/cores/{coreName}/replication")
public interface ReplicationApis {

@GET
@CoreApiParameters
@Path("/details")
@Operation(
summary = "Return replication configuration and current status.",
tags = {"replication"})
ReplicationDetailsResponse fetchReplicationDetails(
@Parameter(
description = "When true on a follower, include nested details fetched from leader",
required = false)
@QueryParam("follower")
@DefaultValue("true")
Boolean follower);

@GET
@CoreApiParameters
@Path("/indexversion")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import org.apache.solr.client.api.util.ReflectWritable;

public class ReplicationDetailsResponse extends SolrJerseyResponse {

@JsonProperty("status")
@Schema(description = "Request status, typically OK")
public String status;

@JsonProperty("details")
@Schema(description = "Replication configuration and status details")
public ReplicationDetails details;

public ReplicationDetailsResponse() {}

public ReplicationDetailsResponse(ReplicationDetails details, String status) {
this.details = details;
this.status = status;
}

/** Top-level replication details payload (nested under {@code details} in the response). */
public static class ReplicationDetails implements ReflectWritable {
@JsonProperty("indexSize")
public String indexSize;

@JsonProperty("indexPath")
public String indexPath;

@JsonProperty("commits")
public List<CommitDetails> commits;

@JsonProperty("isLeader")
public boolean isLeader;

@JsonProperty("isFollower")
public boolean isFollower;

@JsonProperty("indexVersion")
public Long indexVersion;

@JsonProperty("generation")
public Long generation;

@JsonProperty("leader")
public LeaderDetails leader;

@JsonProperty("follower")
public FollowerDetails follower;

/** Optional snapshot/backup stats (heterogeneous NamedList from the handler). */
@JsonProperty("backup")
public Object backup;
}

public static class CommitDetails implements ReflectWritable {
@JsonProperty("indexVersion")
public Long indexVersion;

@JsonProperty("generation")
public Long generation;

@JsonProperty("filelist")
public List<String> filelist;
}

public static class LeaderDetails implements ReflectWritable {
@JsonProperty("confFiles")
public String confFiles;

@JsonProperty("replicateAfter")
public List<String> replicateAfter;

@JsonProperty("replicationEnabled")
public boolean replicationEnabled;

@JsonProperty("replicableVersion")
public Long replicableVersion;

@JsonProperty("replicableGeneration")
public Long replicableGeneration;
}

public static class FollowerDetails implements ReflectWritable {
/** Nested leader details (remote NamedList or map), present when follower=true. */
@JsonProperty("leaderDetails")
public Object leaderDetails;

@JsonProperty("ERROR")
public String error;

@JsonProperty("leaderUrl")
public String leaderUrl;

@JsonProperty("pollInterval")
public String pollInterval;

@JsonProperty("nextExecutionAt")
public String nextExecutionAt;

@JsonProperty("indexReplicatedAt")
public String indexReplicatedAt;

@JsonProperty("indexReplicatedAtList")
public List<String> indexReplicatedAtList;

@JsonProperty("replicationFailedAtList")
public List<String> replicationFailedAtList;

@JsonProperty("timesIndexReplicated")
public Integer timesIndexReplicated;

@JsonProperty("confFilesReplicated")
public String confFilesReplicated;

@JsonProperty("timesConfigReplicated")
public Integer timesConfigReplicated;

@JsonProperty("confFilesReplicatedAt")
public String confFilesReplicatedAt;

@JsonProperty("lastCycleBytesDownloaded")
public Long lastCycleBytesDownloaded;

@JsonProperty("timesFailed")
public Integer timesFailed;

@JsonProperty("replicationFailedAt")
public String replicationFailedAt;

@JsonProperty("previousCycleTimeInSeconds")
public Long previousCycleTimeInSeconds;

@JsonProperty("currentDate")
public String currentDate;

@JsonProperty("isPollingDisabled")
public boolean isPollingDisabled;

@JsonProperty("isReplicating")
public boolean isReplicating;

@JsonProperty("filesToDownload")
public List<String> filesToDownload;

@JsonProperty("numFilesToDownload")
public String numFilesToDownload;

@JsonProperty("bytesToDownload")
public String bytesToDownload;

@JsonProperty("filesDownloaded")
public List<String> filesDownloaded;

@JsonProperty("numFilesDownloaded")
public String numFilesDownloaded;

@JsonProperty("replicationStartTime")
public String replicationStartTime;

@JsonProperty("timeElapsed")
public String timeElapsed;

@JsonProperty("currentFile")
public String currentFile;

@JsonProperty("currentFileSize")
public String currentFileSize;

@JsonProperty("currentFileSizeDownloaded")
public String currentFileSizeDownloaded;

@JsonProperty("currentFileSizePercent")
public String currentFileSizePercent;

@JsonProperty("bytesDownloaded")
public String bytesDownloaded;

@JsonProperty("totalPercent")
public String totalPercent;

@JsonProperty("timeRemaining")
public String timeRemaining;

@JsonProperty("downloadSpeed")
public String downloadSpeed;
}
}
Loading
Loading