Skip to content

Commit 21f87f2

Browse files
committed
Merge branch 'master' into one-shard-to-rule-them-all
* master: Adjust copy settings versions Mute ShrinkIndexIT suite SQL: SYS TABLES ordered according to *DBC specs (elastic#30530)
2 parents a9c78f8 + 9014361 commit 21f87f2

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

docs/reference/indices/shrink-index.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ and `index.sort` settings, index settings on the source index are not copied
135135
during a shrink operation. With the exception of non-copyable settings, settings
136136
from the source index can be copied to the target index by adding the URL
137137
parameter `copy_settings=true` to the request. Note that `copy_settings` can not
138-
be set to `false`. The parameter `copy_settings` will be removed in 9.0.0
138+
be set to `false`. The parameter `copy_settings` will be removed in 8.0.0
139139

140140
deprecated[6.4.0, not copying settings is deprecated, copying settings will be
141-
the default behavior in 8.x]
141+
the default behavior in 7.x]
142142

143143
[float]
144144
=== Monitoring the shrink process

docs/reference/indices/split-index.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ and `index.sort` settings, index settings on the source index are not copied
182182
during a split operation. With the exception of non-copyable settings, settings
183183
from the source index can be copied to the target index by adding the URL
184184
parameter `copy_settings=true` to the request. Note that `copy_settings` can not
185-
be set to `false`. The parameter `copy_settings` will be removed in 9.0.0
185+
be set to `false`. The parameter `copy_settings` will be removed in 8.0.0
186186

187187
deprecated[6.4.0, not copying settings is deprecated, copying settings will be
188-
the default behavior in 8.x]
188+
the default behavior in 7.x]
189189

190190
[float]
191191
=== Monitoring the split process

server/src/test/java/org/elasticsearch/action/admin/indices/create/ShrinkIndexIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.apache.lucene.search.SortField;
2424
import org.apache.lucene.search.SortedSetSelector;
2525
import org.apache.lucene.search.SortedSetSortField;
26+
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
2627
import org.elasticsearch.Version;
2728
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteResponse;
2829
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
@@ -76,14 +77,14 @@
7677
import static org.hamcrest.Matchers.equalTo;
7778
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
7879

80+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/30416")
7981
public class ShrinkIndexIT extends ESIntegTestCase {
8082

8183
@Override
8284
protected Collection<Class<? extends Plugin>> nodePlugins() {
8385
return Arrays.asList(InternalSettingsPlugin.class);
8486
}
8587

86-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/30416")
8788
public void testCreateShrinkIndexToN() {
8889
int[][] possibleShardSplits = new int[][] {{8,4,2}, {9, 3, 1}, {4, 2, 1}, {15,5,1}};
8990
int[] shardSplits = randomFrom(possibleShardSplits);

x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plan/logical/command/sys/SysTables.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.elasticsearch.xpack.sql.plan.logical.command.sys;
77

88
import org.elasticsearch.action.ActionListener;
9+
import org.elasticsearch.xpack.sql.analysis.index.IndexResolver.IndexInfo;
910
import org.elasticsearch.xpack.sql.analysis.index.IndexResolver.IndexType;
1011
import org.elasticsearch.xpack.sql.expression.Attribute;
1112
import org.elasticsearch.xpack.sql.expression.regex.LikePattern;
@@ -18,6 +19,7 @@
1819
import org.elasticsearch.xpack.sql.util.CollectionUtils;
1920

2021
import java.util.ArrayList;
22+
import java.util.Comparator;
2123
import java.util.EnumSet;
2224
import java.util.List;
2325
import java.util.Objects;
@@ -93,6 +95,8 @@ public final void execute(SqlSession session, ActionListener<SchemaRowSet> liste
9395
enumeration[3] = type.toSql();
9496
values.add(asList(enumeration));
9597
}
98+
99+
values.sort(Comparator.comparing(l -> l.get(3).toString()));
96100
listener.onResponse(Rows.of(output(), values));
97101
return;
98102
}
@@ -112,6 +116,9 @@ public final void execute(SqlSession session, ActionListener<SchemaRowSet> liste
112116

113117
session.indexResolver().resolveNames(index, regex, types, ActionListener.wrap(result -> listener.onResponse(
114118
Rows.of(output(), result.stream()
119+
// sort by type (which might be legacy), then by name
120+
.sorted(Comparator.<IndexInfo, String> comparing(i -> legacyName(i.type()))
121+
.thenComparing(Comparator.comparing(i -> i.name())))
115122
.map(t -> asList(cluster,
116123
EMPTY,
117124
t.name(),

x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/plan/logical/command/sys/SysTablesTests.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.xpack.sql.type.EsField;
2525
import org.elasticsearch.xpack.sql.type.TypesTests;
2626

27+
import java.util.Comparator;
2728
import java.util.Iterator;
2829
import java.util.LinkedHashSet;
2930
import java.util.List;
@@ -57,30 +58,30 @@ public void testSysTablesDifferentCatalog() throws Exception {
5758

5859
public void testSysTablesNoTypes() throws Exception {
5960
executeCommand("SYS TABLES", r -> {
61+
assertEquals("alias", r.column(2));
62+
assertTrue(r.advanceRow());
6063
assertEquals(2, r.size());
6164
assertEquals("test", r.column(2));
62-
assertTrue(r.advanceRow());
63-
assertEquals("alias", r.column(2));
6465
}, index, alias);
6566
}
6667

6768
public void testSysTablesPattern() throws Exception {
6869
executeCommand("SYS TABLES LIKE '%'", r -> {
70+
assertEquals("alias", r.column(2));
71+
assertTrue(r.advanceRow());
6972
assertEquals(2, r.size());
7073
assertEquals("test", r.column(2));
71-
assertTrue(r.advanceRow());
72-
assertEquals("alias", r.column(2));
7374
}, index, alias);
7475
}
7576

7677
public void testSysTablesPatternParameterized() throws Exception {
7778
List<SqlTypedParamValue> params = asList(param("%"));
7879
executeCommand("SYS TABLES LIKE ?", params, r -> {
80+
assertEquals("alias", r.column(2));
81+
assertTrue(r.advanceRow());
7982
assertEquals(2, r.size());
8083
assertEquals("test", r.column(2));
81-
assertTrue(r.advanceRow());
82-
assertEquals("alias", r.column(2));
83-
}, index, alias);
84+
}, alias, index);
8485
}
8586

8687
public void testSysTablesOnlyAliases() throws Exception {
@@ -131,32 +132,32 @@ public void testSysTablesOnlyIndicesParameterized() throws Exception {
131132

132133
public void testSysTablesOnlyIndicesAndAliases() throws Exception {
133134
executeCommand("SYS TABLES LIKE 'test' TYPE 'ALIAS', 'BASE TABLE'", r -> {
135+
assertEquals("alias", r.column(2));
136+
assertTrue(r.advanceRow());
134137
assertEquals(2, r.size());
135138
assertEquals("test", r.column(2));
136-
assertTrue(r.advanceRow());
137-
assertEquals("alias", r.column(2));
138139
}, index, alias);
139140
}
140141

141142
public void testSysTablesOnlyIndicesAndAliasesParameterized() throws Exception {
142143
List<SqlTypedParamValue> params = asList(param("ALIAS"), param("BASE TABLE"));
143144
executeCommand("SYS TABLES LIKE 'test' TYPE ?, ?", params, r -> {
145+
assertEquals("alias", r.column(2));
146+
assertTrue(r.advanceRow());
144147
assertEquals(2, r.size());
145148
assertEquals("test", r.column(2));
146-
assertTrue(r.advanceRow());
147-
assertEquals("alias", r.column(2));
148149
}, index, alias);
149150
}
150151

151152
public void testSysTablesOnlyIndicesLegacyAndAliasesParameterized() throws Exception {
152153
List<SqlTypedParamValue> params = asList(param("ALIAS"), param("TABLE"));
153154
executeCommand("SYS TABLES LIKE 'test' TYPE ?, ?", params, r -> {
155+
assertEquals("alias", r.column(2));
156+
assertEquals("ALIAS", r.column(3));
157+
assertTrue(r.advanceRow());
154158
assertEquals(2, r.size());
155159
assertEquals("test", r.column(2));
156160
assertEquals("TABLE", r.column(3));
157-
assertTrue(r.advanceRow());
158-
assertEquals("alias", r.column(2));
159-
assertEquals("ALIAS", r.column(3));
160161
}, index, alias);
161162
}
162163

@@ -188,7 +189,7 @@ public void testSysTablesTypesEnumeration() throws Exception {
188189
executeCommand("SYS TABLES CATALOG LIKE '' LIKE '' TYPE '%'", r -> {
189190
assertEquals(2, r.size());
190191

191-
Iterator<IndexType> it = IndexType.VALID.iterator();
192+
Iterator<IndexType> it = IndexType.VALID.stream().sorted(Comparator.comparing(IndexType::toSql)).iterator();
192193

193194
for (int t = 0; t < r.size(); t++) {
194195
assertEquals(it.next().toSql(), r.column(3));
@@ -209,7 +210,7 @@ public void testSysTablesTypesEnumerationWoString() throws Exception {
209210
executeCommand("SYS TABLES CATALOG LIKE '' LIKE '' ", r -> {
210211
assertEquals(2, r.size());
211212

212-
Iterator<IndexType> it = IndexType.VALID.iterator();
213+
Iterator<IndexType> it = IndexType.VALID.stream().sorted(Comparator.comparing(IndexType::toSql)).iterator();
213214

214215
for (int t = 0; t < r.size(); t++) {
215216
assertEquals(it.next().toSql(), r.column(3));

0 commit comments

Comments
 (0)