Skip to content

Commit bcd3ac0

Browse files
committed
Merge remote-tracking branch 'upstream/master' into IGNITE-26111__discovery_serialization
2 parents 3e81a15 + d045d7b commit bcd3ac0

File tree

254 files changed

+3100
-3832
lines changed

Some content is hidden

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

254 files changed

+3100
-3832
lines changed

docs/_docs/key-value-api/transactions.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ include::code-snippets/cpp/src/transactions.cpp[tag=transactions-execution,inden
8787

8888
[WARNING]
8989
====
90-
It is critical that an Ignite Transaction be `closed` regardless of its commit state. This ensures that all resources are released and the transaction is no longer bound to the current thread. Therefore, the `try-with-resource` statement is highly recommended when working with transactions.
90+
It is critical that an Ignite Transaction should be `closed` regardless of its commit state or ocurred exceptions. Using of `try-with-resources` is recommended approach, but you can also explicitly call `rollback` when catching exceptions. Calling of `close`, `commit` or `rollback` ensures that all resources are released and the transaction is no longer bound to the current thread.
9191
====
9292

9393
////

docs/_docs/monitoring-metrics/intro.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This chapter covers monitoring and metrics for Ignite. We'll start with an overv
1919
== Overview
2020
The basic task of monitoring in Ignite involves metrics. You have several approaches for accessing metrics:
2121

22-
- via link:monitoring-metrics/metrics[JMX]
22+
- via link:monitoring-metrics/new-metrics-system#jmx[JMX]
2323
- Programmatically
2424
- link:monitoring-metrics/system-views[System views]
2525

modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteMessage.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,4 @@ public interface CalciteMessage extends Message {
3232
@Override default short directType() {
3333
return type().directType();
3434
}
35-
36-
/** {@inheritDoc} */
37-
@Override default void onAckReceived() {
38-
// No-op.
39-
}
4035
}

modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryTxEntry.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ public void prepareUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader ldr)
137137
writer.incrementState();
138138

139139
case 1:
140-
if (!writer.writeMessage(key))
140+
if (!writer.writeKeyCacheObject(key))
141141
return false;
142142

143143
writer.incrementState();
144144

145145
case 2:
146-
if (!writer.writeMessage(val))
146+
if (!writer.writeCacheObject(val))
147147
return false;
148148

149149
writer.incrementState();
@@ -173,15 +173,15 @@ public void prepareUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader ldr)
173173
reader.incrementState();
174174

175175
case 1:
176-
key = reader.readMessage();
176+
key = reader.readKeyCacheObject();
177177

178178
if (!reader.isLastRead())
179179
return false;
180180

181181
reader.incrementState();
182182

183183
case 2:
184-
val = reader.readMessage();
184+
val = reader.readCacheObject();
185185

186186
if (!reader.isLastRead())
187187
return false;

modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/PlannerHelper.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,14 @@
4141
import org.apache.calcite.rel.core.TableScan;
4242
import org.apache.calcite.rel.hint.Hintable;
4343
import org.apache.calcite.rel.hint.RelHint;
44+
import org.apache.calcite.rel.logical.LogicalProject;
4445
import org.apache.calcite.rel.rules.CoreRules;
4546
import org.apache.calcite.rel.rules.JoinCommuteRule;
4647
import org.apache.calcite.rel.rules.JoinPushThroughJoinRule;
4748
import org.apache.calcite.rel.rules.JoinToMultiJoinRule;
4849
import org.apache.calcite.rel.rules.MultiJoin;
49-
import org.apache.calcite.rex.RexBuilder;
50-
import org.apache.calcite.rex.RexNode;
5150
import org.apache.calcite.sql.SqlKind;
5251
import org.apache.calcite.sql.SqlNode;
53-
import org.apache.calcite.util.Pair;
5452
import org.apache.calcite.util.Util;
5553
import org.apache.ignite.IgniteLogger;
5654
import org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition;
@@ -152,13 +150,9 @@ public static IgniteRel optimize(SqlNode sqlNode, IgnitePlanner planner, IgniteL
152150
IgniteRel igniteRel = planner.transform(PlannerPhase.OPTIMIZATION, desired, rel);
153151

154152
if (!root.isRefTrivial()) {
155-
final List<RexNode> projects = new ArrayList<>();
156-
final RexBuilder rexBuilder = igniteRel.getCluster().getRexBuilder();
153+
LogicalProject project = (LogicalProject)root.project();
157154

158-
for (int field : Pair.left(root.fields))
159-
projects.add(rexBuilder.makeInputRef(igniteRel, field));
160-
161-
igniteRel = new IgniteProject(igniteRel.getCluster(), desired, igniteRel, projects, root.validatedRowType);
155+
igniteRel = new IgniteProject(igniteRel.getCluster(), desired, igniteRel, project.getProjects(), project.getRowType());
162156
}
163157

164158
if (sqlNode.isA(ImmutableSet.of(SqlKind.INSERT, SqlKind.UPDATE, SqlKind.MERGE)))

modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableDmlPlannerTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
2828
import org.junit.Test;
2929

30+
import static org.apache.calcite.sql.type.SqlTypeName.INTEGER;
31+
import static org.apache.calcite.sql.type.SqlTypeName.VARCHAR;
3032
import static org.hamcrest.CoreMatchers.equalTo;
3133
import static org.hamcrest.CoreMatchers.instanceOf;
3234
import static org.hamcrest.CoreMatchers.notNullValue;
@@ -169,4 +171,23 @@ public void updateCachesDependentIndexScan() throws Exception {
169171
assertThat(invalidPlanMsg, spool.readType, equalTo(Spool.Type.EAGER));
170172
assertThat(invalidPlanMsg, findFirstNode(phys, byClass(IgniteIndexScan.class)), notNullValue());
171173
}
174+
175+
/** Tests that queries with duplicated column names are correctly parsed. */
176+
@Test
177+
public void testDuplicatedColumnNames() throws Exception {
178+
IgniteSchema schema = createSchema(
179+
createTable("CITY", IgniteDistributions.random(), "ID", INTEGER, "NAME", VARCHAR),
180+
createTable("STREET", IgniteDistributions.random(), "ID", INTEGER, "CITY_ID", INTEGER,
181+
"NAME", VARCHAR)
182+
);
183+
184+
assertPlan("SELECT NAME, (SELECT NAME FROM CITY WHERE ID = S.CITY_ID LIMIT 1) AS NAME FROM STREET S ORDER BY ID",
185+
schema, hasColumns("NAME", "NAME1"));
186+
187+
assertPlan("SELECT CITY_ID, NAME, NAME FROM STREET ORDER BY ID", schema,
188+
hasColumns("CITY_ID", "NAME", "NAME2"));
189+
190+
assertPlan("SELECT CITY.NAME, STREET.NAME FROM STREET JOIN CITY ON STREET.CITY_ID = CITY.ID ORDER BY STREET.ID",
191+
schema, hasColumns("NAME", "NAME1"));
192+
}
172193
}

modules/codegen2/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,15 @@ else if (assignableFrom(erasedType(type), type(Map.class.getName()))) {
364364
"MessageCollectionItemType." + messageCollectionItemType(typeArgs.get(1)));
365365
}
366366

367+
else if (assignableFrom(type, type("org.apache.ignite.internal.processors.cache.KeyCacheObject")))
368+
returnFalseIfWriteFailed(write, "writer.writeKeyCacheObject", getExpr);
369+
370+
else if (assignableFrom(type, type("org.apache.ignite.internal.processors.cache.CacheObject")))
371+
returnFalseIfWriteFailed(write, "writer.writeCacheObject", getExpr);
372+
373+
else if (assignableFrom(type, type("org.apache.ignite.internal.util.GridLongList")))
374+
returnFalseIfWriteFailed(write, "writer.writeGridLongList", getExpr);
375+
367376
else if (assignableFrom(type, type(MESSAGE_INTERFACE)))
368377
returnFalseIfWriteFailed(write, "writer.writeMessage", getExpr);
369378

@@ -487,6 +496,15 @@ else if (assignableFrom(erasedType(type), type(Map.class.getName()))) {
487496
"MessageCollectionItemType." + messageCollectionItemType(typeArgs.get(1)), "false");
488497
}
489498

499+
else if (assignableFrom(type, type("org.apache.ignite.internal.processors.cache.KeyCacheObject")))
500+
returnFalseIfReadFailed(name, "reader.readKeyCacheObject");
501+
502+
else if (assignableFrom(type, type("org.apache.ignite.internal.processors.cache.CacheObject")))
503+
returnFalseIfReadFailed(name, "reader.readCacheObject");
504+
505+
else if (assignableFrom(type, type("org.apache.ignite.internal.util.GridLongList")))
506+
returnFalseIfReadFailed(name, "reader.readGridLongList");
507+
490508
else if (assignableFrom(type, type(MESSAGE_INTERFACE)))
491509
returnFalseIfReadFailed(name, "reader.readMessage");
492510

@@ -547,6 +565,15 @@ private String messageCollectionItemType(TypeMirror type) throws Exception {
547565
if (sameType(type, "org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion"))
548566
return "AFFINITY_TOPOLOGY_VERSION";
549567

568+
if (sameType(type, "org.apache.ignite.internal.processors.cache.KeyCacheObject"))
569+
return "KEY_CACHE_OBJECT";
570+
571+
if (sameType(type, "org.apache.ignite.internal.processors.cache.CacheObject"))
572+
return "CACHE_OBJECT";
573+
574+
if (sameType(type, "org.apache.ignite.internal.util.GridLongList"))
575+
return "GRID_LONG_LIST";
576+
550577
PrimitiveType primitiveType = unboxedType(type);
551578

552579
if (primitiveType != null)

modules/compress/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCompressionBasicTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.ignite.internal.processors.cache.persistence.snapshot;
1919

20+
import java.io.File;
2021
import java.io.IOException;
2122
import java.nio.file.DirectoryStream;
2223
import java.nio.file.Files;
@@ -203,6 +204,8 @@ private void testRestoreFullSnapshot(int gridCnt) throws Exception {
203204
finally {
204205
locEvts.clear();
205206
}
207+
208+
awaitPartitionMapExchange();
206209
}
207210
}
208211

@@ -257,6 +260,8 @@ public void testRestoreNotCompressed_OnGridWithoutCompression() throws Exception
257260
finally {
258261
locEvts.clear();
259262
}
263+
264+
awaitPartitionMapExchange();
260265
}
261266
}
262267

@@ -288,7 +293,7 @@ public void testRestoreNotCompressed_OnGridWithoutCompression() throws Exception
288293
continue;
289294
}
290295

291-
NodeFileTree ft = nodeFileTree(dir.toString());
296+
NodeFileTree ft = new NodeFileTree(new File(dir.toString()), dir.getFileName().toString());
292297

293298
U.delete(ft.checkpoint());
294299
U.delete(ft.db());

modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/indexreader/IgniteIndexReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ private PageListsInfo pageListsInfo(long metaPageListId) throws IgniteCheckedExc
492492
io.getBucketsData(addr, data);
493493

494494
for (Map.Entry<Integer, GridLongList> e : data.entrySet()) {
495-
List<Long> listIds = LongStream.of(e.getValue().array())
495+
List<Long> listIds = LongStream.of(e.getValue().arrayCopy())
496496
.map(IgniteIndexReader::normalizePageId)
497497
.boxed()
498498
.collect(toList());

modules/core/src/main/java/org/apache/ignite/cache/query/IndexQuery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public IndexQuery<K, V> setCriteria(List<IndexQueryCriterion> criteria) {
138138
*
139139
* @return List of criteria for this index query.
140140
*/
141-
public List<IndexQueryCriterion> getCriteria() {
141+
@Nullable public List<IndexQueryCriterion> getCriteria() {
142142
return criteria;
143143
}
144144

0 commit comments

Comments
 (0)