Skip to content

Commit ba26776

Browse files
committed
Merge branch 'master' into retention-lease-ccr
* master: Add an authentication cache for API keys (elastic#38469) Fix exit code in certutil packaging test (elastic#38393) Enable logs for intermittent test failure (elastic#38426) Disable BWC to backport recovering retention leases (elastic#38477) Enable bwc tests now that elastic#38443 is backported. (elastic#38462) Fix Master Failover and DataNode Leave Blocking Snapshot (elastic#38460) Recover retention leases during peer recovery (elastic#38435) Set update mappings mater node timeout to 30 min (elastic#38439) Assert job is not null in FullClusterRestartIT (elastic#38218) Update ilm-api.asciidoc, point to REMOVE policy (elastic#38235) (elastic#38463) SQL: Fix esType for DATETIME/DATE and INTERVALS (elastic#38179) Handle deprecation header-AbstractUpgradeTestCase (elastic#38396) XPack: core/ccr/Security-cli migration to java-time (elastic#38415) Disable bwc tests for elastic#38443 (elastic#38456) Bubble-up exceptions from scheduler (elastic#38317) Re-enable TasksClientDocumentationIT.testCancelTasks (elastic#38234) Allow custom authorization with an authorization engine (elastic#38358) CRUDDocumentationIT fix documentation references Remove support for internal versioning for concurrency control (elastic#38254)
2 parents c7bdc7b + e73c9c9 commit ba26776

File tree

174 files changed

+5705
-3834
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+5705
-3834
lines changed

build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ task verifyVersions {
159159
* the enabled state of every bwc task. It should be set back to true
160160
* after the backport of the backcompat code is complete.
161161
*/
162-
final boolean bwc_tests_enabled = true
163-
final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */
162+
final boolean bwc_tests_enabled = false
163+
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/38435" /* place a PR link here when committing bwc changes */
164164
if (bwc_tests_enabled == false) {
165165
if (bwc_tests_disabled_issue.isEmpty()) {
166166
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")
@@ -233,6 +233,9 @@ allprojects {
233233
"org.elasticsearch.plugin:aggs-matrix-stats-client:${version}": ':modules:aggs-matrix-stats',
234234
"org.elasticsearch.plugin:percolator-client:${version}": ':modules:percolator',
235235
"org.elasticsearch.plugin:rank-eval-client:${version}": ':modules:rank-eval',
236+
// for security example plugins
237+
"org.elasticsearch.plugin:x-pack-core:${version}": ':x-pack:plugin:core',
238+
"org.elasticsearch.client.x-pack-transport:${version}": ':x-pack:transport-client'
236239
]
237240

238241
/*

client/rest-high-level/src/main/java/org/elasticsearch/client/WatcherRequestConverters.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ static Request putWatch(PutWatchRequest putWatchRequest) {
7070

7171
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
7272
RequestConverters.Params params = new RequestConverters.Params(request)
73-
.withVersion(putWatchRequest.getVersion())
7473
.withIfSeqNo(putWatchRequest.ifSeqNo())
7574
.withIfPrimaryTerm(putWatchRequest.ifPrimaryTerm());
7675
if (putWatchRequest.isActive() == false) {

client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/PutWatchRequest.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.elasticsearch.client.Validatable;
2222
import org.elasticsearch.common.Strings;
2323
import org.elasticsearch.common.bytes.BytesReference;
24-
import org.elasticsearch.common.lucene.uid.Versions;
2524
import org.elasticsearch.common.xcontent.XContentType;
2625
import org.elasticsearch.index.seqno.SequenceNumbers;
2726

@@ -43,11 +42,9 @@ public final class PutWatchRequest implements Validatable {
4342
private final BytesReference source;
4443
private final XContentType xContentType;
4544
private boolean active = true;
46-
private long version = Versions.MATCH_ANY;
4745
private long ifSeqNo = SequenceNumbers.UNASSIGNED_SEQ_NO;
4846
private long ifPrimaryTerm = UNASSIGNED_PRIMARY_TERM;
4947

50-
5148
public PutWatchRequest(String id, BytesReference source, XContentType xContentType) {
5249
Objects.requireNonNull(id, "watch id is missing");
5350
if (isValidId(id) == false) {
@@ -95,14 +92,6 @@ public XContentType xContentType() {
9592
return xContentType;
9693
}
9794

98-
public long getVersion() {
99-
return version;
100-
}
101-
102-
public void setVersion(long version) {
103-
this.version = version;
104-
}
105-
10695
/**
10796
* only performs this put request if the watch's last modification was assigned the given
10897
* sequence number. Must be used in combination with {@link #setIfPrimaryTerm(long)}

client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,6 @@ public void testUpdate() throws IOException {
768768
}
769769
}
770770
setRandomWaitForActiveShards(updateRequest::waitForActiveShards, expectedParams);
771-
setRandomVersion(updateRequest, expectedParams);
772-
setRandomVersionType(updateRequest::versionType, expectedParams);
773771
setRandomIfSeqNoAndTerm(updateRequest, new HashMap<>()); // if* params are passed in the body
774772
if (randomBoolean()) {
775773
int retryOnConflict = randomIntBetween(0, 5);
@@ -911,14 +909,7 @@ public void testBulk() throws IOException {
911909
if (randomBoolean()) {
912910
docWriteRequest.routing(randomAlphaOfLength(10));
913911
}
914-
if (randomBoolean()) {
915-
if (randomBoolean()) {
916-
docWriteRequest.version(randomNonNegativeLong());
917-
}
918-
if (randomBoolean()) {
919-
docWriteRequest.versionType(randomFrom(VersionType.values()));
920-
}
921-
} else if (randomBoolean()) {
912+
if (opType != DocWriteRequest.OpType.UPDATE && randomBoolean()) {
922913
docWriteRequest.setIfSeqNo(randomNonNegativeLong());
923914
docWriteRequest.setIfPrimaryTerm(randomLongBetween(1, 200));
924915
}

client/rest-high-level/src/test/java/org/elasticsearch/client/WatcherRequestConvertersTests.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import org.elasticsearch.client.watcher.DeactivateWatchRequest;
3030
import org.elasticsearch.client.watcher.DeleteWatchRequest;
3131
import org.elasticsearch.client.watcher.ExecuteWatchRequest;
32-
import org.elasticsearch.client.watcher.PutWatchRequest;
3332
import org.elasticsearch.client.watcher.GetWatchRequest;
33+
import org.elasticsearch.client.watcher.PutWatchRequest;
3434
import org.elasticsearch.client.watcher.StartWatchServiceRequest;
3535
import org.elasticsearch.client.watcher.StopWatchServiceRequest;
3636
import org.elasticsearch.client.watcher.WatcherStatsRequest;
@@ -88,9 +88,12 @@ public void testPutWatch() throws Exception {
8888
}
8989

9090
if (randomBoolean()) {
91-
long version = randomLongBetween(10, 100);
92-
putWatchRequest.setVersion(version);
93-
expectedParams.put("version", String.valueOf(version));
91+
long seqNo = randomNonNegativeLong();
92+
long ifPrimaryTerm = randomLongBetween(1, 200);
93+
putWatchRequest.setIfSeqNo(seqNo);
94+
putWatchRequest.setIfPrimaryTerm(ifPrimaryTerm);
95+
expectedParams.put("if_seq_no", String.valueOf(seqNo));
96+
expectedParams.put("if_primary_term", String.valueOf(ifPrimaryTerm));
9497
}
9598

9699
Request request = WatcherRequestConverters.putWatch(putWatchRequest);

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ public void testIndex() throws Exception {
170170
// tag::index-response
171171
String index = indexResponse.getIndex();
172172
String id = indexResponse.getId();
173-
long version = indexResponse.getVersion();
174173
if (indexResponse.getResult() == DocWriteResponse.Result.CREATED) {
175174
// <1>
176175
} else if (indexResponse.getResult() == DocWriteResponse.Result.UPDATED) {
@@ -220,7 +219,8 @@ public void testIndex() throws Exception {
220219
IndexRequest request = new IndexRequest("posts")
221220
.id("1")
222221
.source("field", "value")
223-
.version(1);
222+
.setIfSeqNo(10L)
223+
.setIfPrimaryTerm(20);
224224
try {
225225
IndexResponse response = client.index(request, RequestOptions.DEFAULT);
226226
} catch(ElasticsearchException e) {
@@ -432,7 +432,8 @@ public void testUpdate() throws Exception {
432432
// tag::update-conflict
433433
UpdateRequest request = new UpdateRequest("posts", "1")
434434
.doc("field", "value")
435-
.version(1);
435+
.setIfSeqNo(101L)
436+
.setIfPrimaryTerm(200L);
436437
try {
437438
UpdateResponse updateResponse = client.update(
438439
request, RequestOptions.DEFAULT);
@@ -499,9 +500,10 @@ public void testUpdate() throws Exception {
499500
request.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL); // <1>
500501
request.setRefreshPolicy("wait_for"); // <2>
501502
// end::update-request-refresh
502-
// tag::update-request-version
503-
request.version(2); // <1>
504-
// end::update-request-version
503+
// tag::update-request-cas
504+
request.setIfSeqNo(2L); // <1>
505+
request.setIfPrimaryTerm(1L); // <2>
506+
// end::update-request-cas
505507
// tag::update-request-detect-noop
506508
request.detectNoop(false); // <1>
507509
// end::update-request-detect-noop
@@ -630,7 +632,7 @@ public void testDelete() throws Exception {
630632
// tag::delete-conflict
631633
try {
632634
DeleteResponse deleteResponse = client.delete(
633-
new DeleteRequest("posts", "1").version(2),
635+
new DeleteRequest("posts", "1").setIfSeqNo(100).setIfPrimaryTerm(2),
634636
RequestOptions.DEFAULT);
635637
} catch (ElasticsearchException exception) {
636638
if (exception.status() == RestStatus.CONFLICT) {

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/TasksClientDocumentationIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ public void onFailure(Exception e) {
150150
}
151151
}
152152

153-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/35514")
154153
@SuppressWarnings("unused")
155154
public void testCancelTasks() throws IOException {
156155
RestHighLevelClient client = highLevelClient();

docs/java-rest/high-level/document/update.asciidoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ include-tagged::{doc-tests-file}[{api}-request-source-exclude]
140140

141141
["source","java",subs="attributes,callouts,macros"]
142142
--------------------------------------------------
143-
include-tagged::{doc-tests-file}[{api}-request-version]
143+
include-tagged::{doc-tests-file}[{api}-request-cas]
144144
--------------------------------------------------
145-
<1> Version
145+
<1> ifSeqNo
146+
<2> ifPrimaryTerm
146147

147148
["source","java",subs="attributes,callouts,macros"]
148149
--------------------------------------------------

docs/reference/ilm/apis/ilm-api.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ about Index Lifecycle Management.
1919

2020
* <<ilm-move-to-step,Move index to step>>
2121
* <<ilm-retry-policy,Retry policy on indices>>
22+
* <<ilm-remove-policy,Remove policy from index>>
2223

2324
[float]
2425
[[ilm-api-management-endpoint]]

docs/reference/migration/migrate_7_0/api.asciidoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22
[[breaking_70_api_changes]]
33
=== API changes
44

5+
[float]
6+
==== Internal Versioning is no longer supported for optimistic concurrency control
7+
8+
Elasticsearch maintains a numeric version field for each document it stores. That field
9+
is incremented by one with every change to the document. Until 7.0.0 the API allowed using
10+
that field for optimistic concurrency control, i.e., making a write operation conditional
11+
on the current document version. Sadly, that approach is flawed because the value of the
12+
version doesn't always uniquely represent a change to the document. If a primary fails
13+
while handling a write operation, it may expose a version that will then be reused by the
14+
new primary.
15+
16+
Due to that issue, internal versioning can no longer be used and is replaced by a new
17+
method based on sequence numbers. See <<optimistic-concurrency-control>> for more details.
18+
19+
Note that the `external` versioning type is still fully supported.
20+
521
[float]
622
==== Camel case and underscore parameters deprecated in 6.x have been removed
723
A number of duplicate parameters deprecated in 6.x have been removed from

0 commit comments

Comments
 (0)