Skip to content

Commit 26f1737

Browse files
Merge remote-tracking branch 'elastic/master' into simplify-snapshot-service
2 parents beb084e + 9554b2f commit 26f1737

File tree

18 files changed

+189
-121
lines changed

18 files changed

+189
-121
lines changed

buildSrc/src/main/resources/checkstyle_suppressions.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,8 @@
4848

4949
<!-- Hopefully temporary suppression of LineLength on files that don't pass it. We should remove these when we the
5050
files start to pass. -->
51-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]GcNames.java" checks="LineLength" />
52-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]HotThreads.java" checks="LineLength" />
5351
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]node[/\\]Node.java" checks="LineLength" />
5452
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]aliases[/\\]IndexAliasesIT.java" checks="LineLength" />
55-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]JvmGcMonitorServiceSettingsTests.java" checks="LineLength" />
5653

5754
<!-- Gradle requires inputs to be seriablizable -->
5855
<suppress files="buildSrc[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]gradle[/\\]precommit[/\\]TestingConventionRule.java" checks="RegexpSinglelineJava" />

docs/reference/docs/delete-by-query.asciidoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,9 @@ POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel
383383

384384
The task ID can be found using the <<tasks,tasks API>>.
385385

386-
Cancellation should happen quickly but might take a few seconds. The task status
387-
API above will continue to list the task until it is wakes to cancel itself.
386+
Cancellation should happen quickly but might take a few seconds. The task status
387+
API above will continue to list the delete by query task until this task checks that it
388+
has been cancelled and terminates itself.
388389

389390

390391
[float]

docs/reference/indices/flush.asciidoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
== Flush
33

44
The flush API allows to flush one or more indices through an API. The
5-
flush process of an index basically frees memory from the index by
6-
flushing data to the index storage and clearing the internal
7-
<<index-modules-translog,transaction log>>. By
8-
default, Elasticsearch uses memory heuristics in order to automatically
9-
trigger flush operations as required in order to clear memory.
5+
flush process of an index makes sure that any data that is currently only
6+
persisted in the <<index-modules-translog,transaction log>> is also permanently
7+
persisted in Lucene. This reduces recovery times as that data doesn't need to be
8+
reindexed from the transaction logs after the Lucene indexed is opened. By
9+
default, Elasticsearch uses heuristics in order to automatically
10+
trigger flushes as required. It is rare for users to need to call the API directly.
1011

1112
[source,js]
1213
--------------------------------------------------

server/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestBuilder.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.elasticsearch.common.settings.Settings;
2626
import org.elasticsearch.common.unit.ByteSizeValue;
2727
import org.elasticsearch.common.unit.TimeValue;
28+
import org.elasticsearch.common.xcontent.XContentType;
2829

2930

3031
public class RolloverRequestBuilder extends MasterNodeOperationRequestBuilder<RolloverRequest, RolloverResponse,
@@ -73,11 +74,16 @@ public RolloverRequestBuilder alias(Alias alias) {
7374
return this;
7475
}
7576

76-
public RolloverRequestBuilder mapping(String type, String source) {
77+
public RolloverRequestBuilder mapping(String type, Object... source) {
7778
this.request.getCreateIndexRequest().mapping(type, source);
7879
return this;
7980
}
8081

82+
public RolloverRequestBuilder mapping(String type, String source, XContentType xContentType) {
83+
this.request.getCreateIndexRequest().mapping(type, source, xContentType);
84+
return this;
85+
}
86+
8187
/**
8288
* Sets the number of shard copies that should be active for creation of the
8389
* new rollover index to return. Defaults to {@link ActiveShardCount#DEFAULT}, which will

server/src/main/java/org/elasticsearch/monitor/jvm/GcNames.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ public class GcNames {
2929
* Resolves the GC type by its memory pool name ({@link java.lang.management.MemoryPoolMXBean#getName()}.
3030
*/
3131
public static String getByMemoryPoolName(String poolName, String defaultName) {
32-
if ("Eden Space".equals(poolName) || "PS Eden Space".equals(poolName) || "Par Eden Space".equals(poolName) || "G1 Eden Space".equals(poolName)) {
32+
if ("Eden Space".equals(poolName) || "PS Eden Space".equals(poolName)
33+
|| "Par Eden Space".equals(poolName) || "G1 Eden Space".equals(poolName)) {
3334
return YOUNG;
3435
}
35-
if ("Survivor Space".equals(poolName) || "PS Survivor Space".equals(poolName) || "Par Survivor Space".equals(poolName) || "G1 Survivor Space".equals(poolName)) {
36+
if ("Survivor Space".equals(poolName) || "PS Survivor Space".equals(poolName)
37+
|| "Par Survivor Space".equals(poolName) || "G1 Survivor Space".equals(poolName)) {
3638
return SURVIVOR;
3739
}
38-
if ("Tenured Gen".equals(poolName) || "PS Old Gen".equals(poolName) || "CMS Old Gen".equals(poolName) || "G1 Old Gen".equals(poolName)) {
40+
if ("Tenured Gen".equals(poolName) || "PS Old Gen".equals(poolName)
41+
|| "CMS Old Gen".equals(poolName) || "G1 Old Gen".equals(poolName)) {
3942
return OLD;
4043
}
4144
return defaultName;
@@ -45,7 +48,8 @@ public static String getByGcName(String gcName, String defaultName) {
4548
if ("Copy".equals(gcName) || "PS Scavenge".equals(gcName) || "ParNew".equals(gcName) || "G1 Young Generation".equals(gcName)) {
4649
return YOUNG;
4750
}
48-
if ("MarkSweepCompact".equals(gcName) || "PS MarkSweep".equals(gcName) || "ConcurrentMarkSweep".equals(gcName) || "G1 Old Generation".equals(gcName)) {
51+
if ("MarkSweepCompact".equals(gcName) || "PS MarkSweep".equals(gcName)
52+
|| "ConcurrentMarkSweep".equals(gcName) || "G1 Old Generation".equals(gcName)) {
4953
return OLD;
5054
}
5155
return defaultName;

server/src/main/java/org/elasticsearch/monitor/jvm/HotThreads.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ private String innerDetect() throws Exception {
234234
continue; // thread is not alive yet or died before the first snapshot - ignore it!
235235
}
236236
double percent = (((double) time) / interval.nanos()) * 100;
237-
sb.append(String.format(Locale.ROOT, "%n%4.1f%% (%s out of %s) %s usage by thread '%s'%n", percent, TimeValue.timeValueNanos(time), interval, type, threadName));
237+
sb.append(String.format(Locale.ROOT, "%n%4.1f%% (%s out of %s) %s usage by thread '%s'%n",
238+
percent, TimeValue.timeValueNanos(time), interval, type, threadName));
238239
// for each snapshot (2nd array index) find later snapshot for same thread with max number of
239240
// identical StackTraceElements (starting from end of each)
240241
boolean[] done = new boolean[threadElementsSnapshotCount];
@@ -267,7 +268,8 @@ private String innerDetect() throws Exception {
267268
sb.append(String.format(Locale.ROOT, " %s%n", show[l]));
268269
}
269270
} else {
270-
sb.append(String.format(Locale.ROOT, " %d/%d snapshots sharing following %d elements%n", count, threadElementsSnapshotCount, maxSim));
271+
sb.append(String.format(Locale.ROOT, " %d/%d snapshots sharing following %d elements%n",
272+
count, threadElementsSnapshotCount, maxSim));
271273
for (int l = show.length - maxSim; l < show.length; l++) {
272274
sb.append(String.format(Locale.ROOT, " %s%n", show[l]));
273275
}

server/src/main/java/org/elasticsearch/transport/RemoteClusterService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,14 @@ boolean isRemoteClusterRegistered(String clusterName) {
303303
return remoteClusters.containsKey(clusterName);
304304
}
305305

306+
/**
307+
* Returns the registered remote cluster names.
308+
*/
309+
public Set<String> getRegisteredRemoteClusterNames() {
310+
// remoteClusters is unmodifiable so its key set will be unmodifiable too
311+
return remoteClusters.keySet();
312+
}
313+
306314
public void collectSearchShards(IndicesOptions indicesOptions, String preference, String routing,
307315
Map<String, OriginalIndices> remoteIndicesByCluster,
308316
ActionListener<Map<String, ClusterSearchShardsResponse>> listener) {

server/src/test/java/org/elasticsearch/monitor/jvm/JvmGcMonitorServiceSettingsTests.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public void testNegativeSetting() throws InterruptedException {
6565
Settings settings = Settings.builder().put("monitor.jvm.gc.collector." + collector + ".warn", "-" + randomTimeValue()).build();
6666
execute(settings, (command, interval, name) -> null, e -> {
6767
assertThat(e, instanceOf(IllegalArgumentException.class));
68-
assertThat(e.getMessage(), allOf(containsString("invalid gc_threshold"), containsString("for [monitor.jvm.gc.collector." + collector + ".")));
68+
assertThat(e.getMessage(), allOf(containsString("invalid gc_threshold"),
69+
containsString("for [monitor.jvm.gc.collector." + collector + ".")));
6970
}, true, null);
7071
}
7172

@@ -78,8 +79,9 @@ public void testMissingSetting() throws InterruptedException {
7879
Settings.Builder builder = Settings.builder();
7980

8081
// drop a random setting or two
81-
for (@SuppressWarnings("unchecked") AbstractMap.SimpleEntry<String, String> entry : randomSubsetOf(randomIntBetween(1, 2), entries.toArray(new AbstractMap.SimpleEntry[0]))) {
82-
builder.put(entry.getKey(), entry.getValue());
82+
for (@SuppressWarnings("unchecked") AbstractMap.SimpleEntry<String, String> entry : randomSubsetOf(randomIntBetween(1, 2),
83+
entries.toArray(new AbstractMap.SimpleEntry[0]))) {
84+
builder.put(entry.getKey(), entry.getValue());
8385
}
8486

8587
// we should get an exception that a setting is missing
@@ -115,25 +117,31 @@ public void testIllegalOverheadSettings() throws InterruptedException {
115117
infoWarnOutOfOrderBuilder.put("monitor.jvm.gc.overhead.warn", warn);
116118
execute(infoWarnOutOfOrderBuilder.build(), (command, interval, name) -> null, e -> {
117119
assertThat(e, instanceOf(IllegalArgumentException.class));
118-
assertThat(e.getMessage(), containsString("[monitor.jvm.gc.overhead.warn] must be greater than [monitor.jvm.gc.overhead.info] [" + info + "] but was [" + warn + "]"));
120+
assertThat(e.getMessage(), containsString("[monitor.jvm.gc.overhead.warn] must be greater than "
121+
+ "[monitor.jvm.gc.overhead.info] [" + info + "] but was [" + warn + "]"));
119122
}, true, null);
120123

121124
final Settings.Builder debugInfoOutOfOrderBuilder = Settings.builder();
122125
debugInfoOutOfOrderBuilder.put("monitor.jvm.gc.overhead.info", info);
123126
final int debug = randomIntBetween(info + 1, 99);
124127
debugInfoOutOfOrderBuilder.put("monitor.jvm.gc.overhead.debug", debug);
125-
debugInfoOutOfOrderBuilder.put("monitor.jvm.gc.overhead.warn", randomIntBetween(debug + 1, 100)); // or the test will fail for the wrong reason
128+
debugInfoOutOfOrderBuilder.put("monitor.jvm.gc.overhead.warn",
129+
randomIntBetween(debug + 1, 100)); // or the test will fail for the wrong reason
126130
execute(debugInfoOutOfOrderBuilder.build(), (command, interval, name) -> null, e -> {
127131
assertThat(e, instanceOf(IllegalArgumentException.class));
128-
assertThat(e.getMessage(), containsString("[monitor.jvm.gc.overhead.info] must be greater than [monitor.jvm.gc.overhead.debug] [" + debug + "] but was [" + info + "]"));
132+
assertThat(e.getMessage(), containsString("[monitor.jvm.gc.overhead.info] must be greater than "
133+
+ "[monitor.jvm.gc.overhead.debug] [" + debug + "] but was [" + info + "]"));
129134
}, true, null);
130135
}
131136

132-
private static void execute(Settings settings, TriFunction<Runnable, TimeValue, String, Cancellable> scheduler, Runnable asserts) throws InterruptedException {
137+
private static void execute(Settings settings, TriFunction<Runnable, TimeValue, String, Cancellable> scheduler,
138+
Runnable asserts) throws InterruptedException {
133139
execute(settings, scheduler, null, false, asserts);
134140
}
135141

136-
private static void execute(Settings settings, TriFunction<Runnable, TimeValue, String, Cancellable> scheduler, Consumer<Throwable> consumer, boolean constructionShouldFail, Runnable asserts) throws InterruptedException {
142+
private static void execute(Settings settings, TriFunction<Runnable, TimeValue, String, Cancellable> scheduler,
143+
Consumer<Throwable> consumer, boolean constructionShouldFail,
144+
Runnable asserts) throws InterruptedException {
137145
assert constructionShouldFail == (consumer != null);
138146
assert constructionShouldFail == (asserts == null);
139147
ThreadPool threadPool = null;

test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ protected void recoverReplica(IndexShard replica, IndexShard primary, boolean st
565565
recoverReplica(replica, primary,
566566
(r, sourceNode) -> new RecoveryTarget(r, sourceNode, recoveryListener, version -> {
567567
}),
568-
true, true);
568+
true, startReplica);
569569
}
570570

571571
/** recovers a replica from the given primary **/

x-pack/docs/en/security/auditing/output-logfile.asciidoc

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,36 @@ the `<clustername>_audit.log` file in the logs directory. To maintain
77
compatibility with releases prior to 6.5.0, a `<clustername>_access.log` file
88
is also generated. They differ in the output format but the contents
99
are similar. For systems that are not ingesting the audit file for search or
10-
analytics it is strongly recommended to only keep the newer format.
11-
Turning off the deprecated output format can be achieved by disabling the logger
12-
in the `log4j2.properties` file (hint: there is a config comment
13-
about it).
14-
For more information, see {ref}/logging.html#configuring-logging-levels[configuring-logging].
10+
analytics it is strongly recommended to keep only the newer format.
11+
12+
To turn off the deprecated output format, you can disable the logger in the
13+
`log4j2.properties` file:
14+
15+
[source, properties]
16+
--------------------------------------------------
17+
# change info to off
18+
# logger.xpack_security_audit_deprecated_logfile.level = info
19+
logger.xpack_security_audit_deprecated_logfile.level = off
20+
--------------------------------------------------
21+
22+
Alternatively, use the
23+
{ref}/cluster-update-settings.html[cluster update settings API] to dynamically
24+
configure the logger:
25+
26+
[source,js]
27+
--------------------------------------------------
28+
PUT /_cluster/settings
29+
{
30+
"persistent": {
31+
"logger.org.elasticsearch.xpack.security.audit.logfile.DeprecatedLoggingAuditTrail": "off"
32+
}
33+
}
34+
--------------------------------------------------
35+
// CONSOLE
36+
37+
NOTE: If you overwrite the `log4j2.properties` and do not specify appenders for
38+
any of the audit trails, audit events are forwarded to the root appender, which
39+
by default points to the `elasticsearch.log` file.
1540

1641

1742
[float]

0 commit comments

Comments
 (0)