Merge branch 'master' into index-lifecycle
This commit is contained in:
commit
4c55dbce1a
|
@ -27,7 +27,6 @@ import org.gradle.api.tasks.OutputDirectory
|
||||||
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.util.regex.Matcher
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates REST tests for each snippet marked // TEST.
|
* Generates REST tests for each snippet marked // TEST.
|
||||||
|
@ -100,6 +99,14 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
|
||||||
return snippet.language == 'js' || snippet.curl
|
return snippet.language == 'js' || snippet.curl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Certain requests should not have the shard failure check because the
|
||||||
|
* format of the response is incompatible i.e. it is not a JSON object.
|
||||||
|
*/
|
||||||
|
static shouldAddShardFailureCheck(String path) {
|
||||||
|
return path.startsWith('_cat') == false && path.startsWith('_xpack/ml/datafeeds/') == false
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts Kibana's block quoted strings into standard JSON. These
|
* Converts Kibana's block quoted strings into standard JSON. These
|
||||||
* {@code """} delimited strings can be embedded in CONSOLE and can
|
* {@code """} delimited strings can be embedded in CONSOLE and can
|
||||||
|
@ -309,13 +316,11 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
|
||||||
* no shard succeeds. But we need to fail the tests on all of these
|
* no shard succeeds. But we need to fail the tests on all of these
|
||||||
* because they mean invalid syntax or broken queries or something
|
* because they mean invalid syntax or broken queries or something
|
||||||
* else that we don't want to teach people to do. The REST test
|
* else that we don't want to teach people to do. The REST test
|
||||||
* framework doesn't allow us to has assertions in the setup
|
* framework doesn't allow us to have assertions in the setup
|
||||||
* section so we have to skip it there. We also have to skip _cat
|
* section so we have to skip it there. We also omit the assertion
|
||||||
* actions because they don't return json so we can't is_false
|
* from APIs that don't return a JSON object
|
||||||
* them. That is ok because they don't have this
|
|
||||||
* partial-success-is-success thing.
|
|
||||||
*/
|
*/
|
||||||
if (false == inSetup && false == path.startsWith('_cat')) {
|
if (false == inSetup && shouldAddShardFailureCheck(path)) {
|
||||||
current.println(" - is_false: _shards.failures")
|
current.println(" - is_false: _shards.failures")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.gradle.doc
|
package org.elasticsearch.gradle.doc
|
||||||
|
|
||||||
import org.elasticsearch.gradle.doc.SnippetsTask.Snippet
|
import static org.elasticsearch.gradle.doc.RestTestsFromSnippetsTask.shouldAddShardFailureCheck
|
||||||
import org.gradle.api.InvalidUserDataException
|
|
||||||
|
|
||||||
import static org.elasticsearch.gradle.doc.RestTestsFromSnippetsTask.replaceBlockQuote
|
import static org.elasticsearch.gradle.doc.RestTestsFromSnippetsTask.replaceBlockQuote
|
||||||
|
|
||||||
class RestTestFromSnippetsTaskTest extends GroovyTestCase {
|
class RestTestFromSnippetsTaskTest extends GroovyTestCase {
|
||||||
|
@ -47,4 +45,10 @@ class RestTestFromSnippetsTaskTest extends GroovyTestCase {
|
||||||
assertEquals("\"foo\": \"bort\\n baz\"",
|
assertEquals("\"foo\": \"bort\\n baz\"",
|
||||||
replaceBlockQuote("\"foo\": \"\"\"bort\n baz\"\"\""));
|
replaceBlockQuote("\"foo\": \"\"\"bort\n baz\"\"\""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testIsDocWriteRequest() {
|
||||||
|
assertTrue(shouldAddShardFailureCheck("doc-index/_search"));
|
||||||
|
assertFalse(shouldAddShardFailureCheck("_cat"))
|
||||||
|
assertFalse(shouldAddShardFailureCheck("_xpack/ml/datafeeds/datafeed-id/_preview"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class Alias implements Streamable, ToXContentFragment {
|
||||||
filter = in.readOptionalString();
|
filter = in.readOptionalString();
|
||||||
indexRouting = in.readOptionalString();
|
indexRouting = in.readOptionalString();
|
||||||
searchRouting = in.readOptionalString();
|
searchRouting = in.readOptionalString();
|
||||||
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
|
||||||
writeIndex = in.readOptionalBoolean();
|
writeIndex = in.readOptionalBoolean();
|
||||||
} else {
|
} else {
|
||||||
writeIndex = null;
|
writeIndex = null;
|
||||||
|
@ -215,7 +215,7 @@ public class Alias implements Streamable, ToXContentFragment {
|
||||||
out.writeOptionalString(filter);
|
out.writeOptionalString(filter);
|
||||||
out.writeOptionalString(indexRouting);
|
out.writeOptionalString(indexRouting);
|
||||||
out.writeOptionalString(searchRouting);
|
out.writeOptionalString(searchRouting);
|
||||||
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
|
||||||
out.writeOptionalBoolean(writeIndex);
|
out.writeOptionalBoolean(writeIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,7 @@ public class IndicesAliasesRequest extends AcknowledgedRequest<IndicesAliasesReq
|
||||||
routing = in.readOptionalString();
|
routing = in.readOptionalString();
|
||||||
searchRouting = in.readOptionalString();
|
searchRouting = in.readOptionalString();
|
||||||
indexRouting = in.readOptionalString();
|
indexRouting = in.readOptionalString();
|
||||||
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
|
||||||
writeIndex = in.readOptionalBoolean();
|
writeIndex = in.readOptionalBoolean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ public class IndicesAliasesRequest extends AcknowledgedRequest<IndicesAliasesReq
|
||||||
out.writeOptionalString(routing);
|
out.writeOptionalString(routing);
|
||||||
out.writeOptionalString(searchRouting);
|
out.writeOptionalString(searchRouting);
|
||||||
out.writeOptionalString(indexRouting);
|
out.writeOptionalString(indexRouting);
|
||||||
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
|
||||||
out.writeOptionalBoolean(writeIndex);
|
out.writeOptionalBoolean(writeIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class AliasMetaData extends AbstractDiffable<AliasMetaData> implements To
|
||||||
out.writeBoolean(false);
|
out.writeBoolean(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
|
||||||
out.writeOptionalBoolean(writeIndex());
|
out.writeOptionalBoolean(writeIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ public class AliasMetaData extends AbstractDiffable<AliasMetaData> implements To
|
||||||
searchRouting = null;
|
searchRouting = null;
|
||||||
searchRoutingValues = emptySet();
|
searchRoutingValues = emptySet();
|
||||||
}
|
}
|
||||||
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
|
||||||
writeIndex = in.readOptionalBoolean();
|
writeIndex = in.readOptionalBoolean();
|
||||||
} else {
|
} else {
|
||||||
writeIndex = null;
|
writeIndex = null;
|
||||||
|
|
|
@ -693,7 +693,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
});
|
});
|
||||||
inSyncAllocationIds = DiffableUtils.readImmutableOpenIntMapDiff(in, DiffableUtils.getVIntKeySerializer(),
|
inSyncAllocationIds = DiffableUtils.readImmutableOpenIntMapDiff(in, DiffableUtils.getVIntKeySerializer(),
|
||||||
DiffableUtils.StringSetValueSerializer.getInstance());
|
DiffableUtils.StringSetValueSerializer.getInstance());
|
||||||
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
|
||||||
rolloverInfos = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), RolloverInfo::new,
|
rolloverInfos = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), RolloverInfo::new,
|
||||||
RolloverInfo::readDiffFrom);
|
RolloverInfo::readDiffFrom);
|
||||||
} else {
|
} else {
|
||||||
|
@ -714,7 +714,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
aliases.writeTo(out);
|
aliases.writeTo(out);
|
||||||
customs.writeTo(out);
|
customs.writeTo(out);
|
||||||
inSyncAllocationIds.writeTo(out);
|
inSyncAllocationIds.writeTo(out);
|
||||||
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
|
||||||
rolloverInfos.writeTo(out);
|
rolloverInfos.writeTo(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -765,7 +765,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
Set<String> allocationIds = DiffableUtils.StringSetValueSerializer.getInstance().read(in, key);
|
Set<String> allocationIds = DiffableUtils.StringSetValueSerializer.getInstance().read(in, key);
|
||||||
builder.putInSyncAllocationIds(key, allocationIds);
|
builder.putInSyncAllocationIds(key, allocationIds);
|
||||||
}
|
}
|
||||||
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
|
||||||
int rolloverAliasesSize = in.readVInt();
|
int rolloverAliasesSize = in.readVInt();
|
||||||
for (int i = 0; i < rolloverAliasesSize; i++) {
|
for (int i = 0; i < rolloverAliasesSize; i++) {
|
||||||
builder.putRolloverInfo(new RolloverInfo(in));
|
builder.putRolloverInfo(new RolloverInfo(in));
|
||||||
|
@ -800,7 +800,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
out.writeVInt(cursor.key);
|
out.writeVInt(cursor.key);
|
||||||
DiffableUtils.StringSetValueSerializer.getInstance().write(cursor.value, out);
|
DiffableUtils.StringSetValueSerializer.getInstance().write(cursor.value, out);
|
||||||
}
|
}
|
||||||
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
|
||||||
out.writeVInt(rolloverInfos.size());
|
out.writeVInt(rolloverInfos.size());
|
||||||
for (ObjectCursor<RolloverInfo> cursor : rolloverInfos.values()) {
|
for (ObjectCursor<RolloverInfo> cursor : rolloverInfos.values()) {
|
||||||
cursor.value.writeTo(out);
|
cursor.value.writeTo(out);
|
||||||
|
|
|
@ -14,8 +14,8 @@ The JDBC driver can be obtained either by downloading it from the https://www.el
|
||||||
["source","xml",subs="attributes"]
|
["source","xml",subs="attributes"]
|
||||||
----
|
----
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.elasticsearch.plugin.jdbc</groupId>
|
<groupId>org.elasticsearch.plugin</groupId>
|
||||||
<artifactId>jdbc</artifactId>
|
<artifactId>x-pack-sql-jdbc</artifactId>
|
||||||
<version>{version}</version>
|
<version>{version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
----
|
----
|
||||||
|
|
Loading…
Reference in New Issue