Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INFO logging of snapshot restore and completion #88257

Merged
merged 12 commits into from
Jul 12, 2022
Prev Previous commit
Next Next commit
Do not expose in XContext and fix backwards compat
  • Loading branch information
kingherc committed Jul 5, 2022
commit 2836e5dbeb944f81e714423d841944950abb22e6
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ backing indices are configured using the data stream's matching index template.
If `true`, the request restores aliases for any restored data streams and
indices. If `false`, the request doesn't restore aliases. Defaults to `true`.

`silent`::
(Optional, Boolean)
If `true`, logging happens at a lower level. Defaults to `false`.

[[restore-snapshot-api-include-global-state]]
`include_global_state`::
+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.elasticsearch.action.admin.cluster.snapshots.restore;

import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeRequest;
Expand Down Expand Up @@ -48,6 +49,7 @@ public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotReq
private boolean includeGlobalState = false;
private boolean partial = false;
private boolean includeAliases = true;
public static Version VERSION_SUPPORTING_SILENT_PARAMETER = Version.V_8_4_0;
private boolean silent = false;
private Settings indexSettings = Settings.EMPTY;
private String[] ignoreIndexSettings = Strings.EMPTY_ARRAY;
Expand Down Expand Up @@ -84,7 +86,11 @@ public RestoreSnapshotRequest(StreamInput in) throws IOException {
includeGlobalState = in.readBoolean();
partial = in.readBoolean();
includeAliases = in.readBoolean();
silent = in.readBoolean();
if (in.getVersion().onOrAfter(VERSION_SUPPORTING_SILENT_PARAMETER)) {
silent = in.readBoolean();
} else {
silent = true;
}
indexSettings = readSettingsFromStream(in);
ignoreIndexSettings = in.readStringArray();
snapshotUuid = in.readOptionalString();
Expand All @@ -104,7 +110,9 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(includeGlobalState);
out.writeBoolean(partial);
out.writeBoolean(includeAliases);
out.writeBoolean(silent);
if (out.getVersion().onOrAfter(VERSION_SUPPORTING_SILENT_PARAMETER)) {
out.writeBoolean(silent);
}
writeSettingsToStream(indexSettings, out);
out.writeStringArray(ignoreIndexSettings);
out.writeOptionalString(snapshotUuid);
Expand Down Expand Up @@ -528,8 +536,6 @@ public RestoreSnapshotRequest source(Map<String, Object> source) {
includeGlobalState = nodeBooleanValue(entry.getValue(), "include_global_state");
} else if (name.equals("include_aliases")) {
includeAliases = nodeBooleanValue(entry.getValue(), "include_aliases");
} else if (name.equals("silent")) {
silent = nodeBooleanValue(entry.getValue(), "silent");
} else if (name.equals("rename_pattern")) {
if (entry.getValue() instanceof String) {
renamePattern((String) entry.getValue());
Expand Down Expand Up @@ -598,7 +604,6 @@ private void toXContentFragment(XContentBuilder builder, Params params) throws I
builder.field("include_global_state", includeGlobalState);
builder.field("partial", partial);
builder.field("include_aliases", includeAliases);
builder.field("silent", silent);
if (indexSettings != null) {
builder.startObject("index_settings");
if (indexSettings.isEmpty() == false) {
Expand Down