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

[Backport 7.6] Deprecate index soft delete enabled setting #4418

Merged
merged 1 commit into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ void Set(string knownKey, object newValue)
Set(RoutingPartitionSize, indexSettings.RoutingPartitionSize);
if (indexSettings.SoftDeletes != null)
{
#pragma warning disable 618
Set(SoftDeletesEnabled, indexSettings.SoftDeletes.Enabled);
#pragma warning restore 618
Set(SoftDeletesRetentionOperations, indexSettings.SoftDeletes.Retention?.Operations);
}

Expand Down Expand Up @@ -259,7 +261,9 @@ private static void SetKnownIndexSettings(ref JsonReader reader, IJsonFormatterR
Set<bool?>(s, settings, QueriesCacheEnabled, v => queriesCache.Enabled = v, formatterResolver);

var softDeletes = s.SoftDeletes = new SoftDeleteSettings();
#pragma warning disable 618
Set<bool?>(s, settings, SoftDeletesEnabled, v => softDeletes.Enabled = v, formatterResolver);
#pragma warning restore 618
var softDeletesRetention = s.SoftDeletes.Retention = new SoftDeleteRetentionSettings();
Set<long?>(s, settings, SoftDeletesEnabled, v => softDeletesRetention.Operations = v, formatterResolver);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace Nest
{
public interface ISoftDeleteSettings
{
[Obsolete("Creating indices with soft-deletes disabled is deprecated and will be removed in future Elasticsearch versions. Do not set a value of 'false'")]
/// <summary> Enables soft deletes on the index</summary>
bool? Enabled { get; set; }
/// <summary> Configure the retention of soft deletes on the index</summary>
Expand All @@ -15,6 +16,7 @@ public class SoftDeleteSettings : ISoftDeleteSettings
/// <inheritdoc see cref="ISoftDeleteSettings.Retention"/>
public ISoftDeleteRetentionSettings Retention { get; set; }

[Obsolete("Creating indices with soft-deletes disabled is deprecated and will be removed in future Elasticsearch versions. Do not set a value of 'false'")]
/// <inheritdoc see cref="ISoftDeleteSettings.Enabled"/>
public bool? Enabled { get; set; }
}
Expand All @@ -28,6 +30,7 @@ public class SoftDeleteSettingsDescriptor : DescriptorBase<SoftDeleteSettingsDes
public SoftDeleteSettingsDescriptor Retention(Func<SoftDeleteRetentionSettingsDescriptor, ISoftDeleteRetentionSettings> selector) =>
Assign(selector.Invoke(new SoftDeleteRetentionSettingsDescriptor()), (a, v) => a.Retention = v);

[Obsolete("Creating indices with soft-deletes disabled is deprecated and will be removed in future Elasticsearch versions. Do not set a value of 'false'")]
/// <inheritdoc see cref="ISoftDeleteSettings.Enabled"/>
public SoftDeleteSettingsDescriptor Enabled(bool? enabled = true) => Assign(enabled, (a, v) => a.Enabled = v);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public CrossClusterReplicationFollowTests(XPackCluster cluster, EndpointUsage us
NumberOfReplicas = 0,
SoftDeletes = new SoftDeleteSettings
{
Enabled = true,
Retention = new SoftDeleteRetentionSettings { Operations = 1024 }
}
}
Expand All @@ -63,7 +62,6 @@ public CrossClusterReplicationFollowTests(XPackCluster cluster, EndpointUsage us
.NumberOfShards(1)
.NumberOfReplicas(0)
.SoftDeletes(sd => sd
.Enabled()
.Retention(r => r.Operations(1024))
)
),
Expand Down