Skip to content

Commit 79383a6

Browse files
committed
merge from upstream
2 parents d3342f1 + 13ba048 commit 79383a6

206 files changed

Lines changed: 75011 additions & 72985 deletions

File tree

Some content is hidden

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

.github/workflows/publish-website-on-branch-update.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@ jobs:
5959
exit 1
6060
fi
6161
62+
- name: Validate ignite-website token
63+
env:
64+
GH_TOKEN: ${{ secrets.IGNITE_WEBSITE_BUILD }}
65+
run: |
66+
if [ -z "$GH_TOKEN" ]; then
67+
echo "::error::Secret IGNITE_WEBSITE_BUILD is empty or missing."
68+
echo "::error::Please contact Apache INFRA to create or update the token."
69+
echo "::error::Example INFRA ticket:"
70+
echo "::error::https://issues.apache.org/jira/browse/INFRA-27835"
71+
exit 1
72+
fi
73+
74+
if ! git ls-remote https://x-access-token:${GH_TOKEN}@github.com/apache/ignite-website.git &>/dev/null; then
75+
echo "::error::Invalid or expired IGNITE_WEBSITE_BUILD token."
76+
echo "::error::Please contact Apache INFRA to renew or recreate the token."
77+
echo "::error::Example INFRA ticket:"
78+
echo "::error::https://issues.apache.org/jira/browse/INFRA-27835"
79+
exit 1
80+
fi
81+
6282
- name: Check out 'ignite-website' repository code
6383
uses: actions/checkout@v3
6484
with:

docs/_data/toc.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@
232232
url: sql-reference/ddl
233233
- title: Data Manipulation Language (DML)
234234
url: sql-reference/dml
235-
- title: Transactions
236-
url: key-value-api/transactions
235+
- title: Transaction-aware Queries
236+
url: SQL/sql-calcite#transaction-aware-queries
237237
- title: Operational Commands
238238
url: sql-reference/operational-commands
239239
- title: Aggregate functions

docs/_docs/SQL/JDBC/jdbc-driver.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,9 @@ JDBC Thin Driver supports the standard JDBC savepoint API for explicit transacti
564564
* `Connection.rollback(Savepoint savepoint)`
565565
* `Connection.releaseSavepoint(Savepoint savepoint)`
566566

567-
Savepoints are available for JDBC connections that use the Calcite-based SQL engine and explicit `PESSIMISTIC` transactions.
567+
Savepoints are available for JDBC connections that use the Calcite-based SQL engine and explicit transactions.
568568
Disable auto-commit before creating a savepoint.
569-
If auto-commit is left enabled, JDBC savepoint API calls requiring an explicit transaction will fail with 'SQLException'.
569+
If auto-commit is left enabled, JDBC savepoint API calls requiring a transaction will fail with 'SQLException'.
570570

571571
[source,java]
572572
----

docs/_docs/SQL/sql-calcite.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ Disables certain optimizer rules. This is an optimizer level hint.
485485
SELECT /*+ DISABLE_RULE('MergeJoinConverter') */ T1.* FROM TBL1 T1 JOIN TBL2 T2 ON T1.V1=T2.V1 WHERE T2.V2=?
486486
----
487487

488-
== Transactions [[transactions]]
488+
== Transaction-aware Queries [[transaction-aware-queries]]
489489

490490
The Calcite-based query engine supports SQL transactions with READ_COMMITTED isolation.
491491
To ensure backward compatibility, transaction support is disabled by default. To enable it, use the following configuration:

docs/_docs/code-snippets/java/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@
101101
<plugin>
102102
<groupId>org.apache.maven.plugins</groupId>
103103
<artifactId>maven-compiler-plugin</artifactId>
104-
<version>3.7.0</version>
104+
<version>3.14.1</version>
105105
<configuration>
106106
<source>1.8</source>
107107
<target>1.8</target>
108108
</configuration>
109109
</plugin>
110110
<plugin>
111111
<artifactId>maven-surefire-plugin</artifactId>
112-
<version>2.22.2</version>
112+
<version>3.5.4</version>
113113
<configuration>
114114
<includes>
115115
<include>**/*.java</include>
@@ -118,7 +118,7 @@
118118
</plugin>
119119
<plugin>
120120
<artifactId>maven-failsafe-plugin</artifactId>
121-
<version>2.22.2</version>
121+
<version>3.5.4</version>
122122
</plugin>
123123
</plugins>
124124
</build>

docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/DistributedComputing.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@
2222
import java.util.concurrent.ConcurrentMap;
2323
import java.util.concurrent.atomic.AtomicLong;
2424

25+
import javax.cache.Cache;
26+
2527
import org.apache.ignite.Ignite;
2628
import org.apache.ignite.IgniteCache;
2729
import org.apache.ignite.IgniteCluster;
2830
import org.apache.ignite.IgniteCompute;
2931
import org.apache.ignite.Ignition;
32+
import org.apache.ignite.cache.affinity.Affinity;
33+
import org.apache.ignite.cache.query.QueryCursor;
34+
import org.apache.ignite.cache.query.ScanQuery;
35+
import org.apache.ignite.cluster.ClusterNode;
3036
import org.apache.ignite.lang.IgniteCallable;
3137
import org.apache.ignite.lang.IgniteFuture;
3238
import org.apache.ignite.resources.IgniteInstanceResource;
@@ -194,4 +200,50 @@ public Integer call() throws Exception {
194200

195201
// end::access-data[]
196202

203+
// tag::local-scan-query[]
204+
public static class AverageAgeTask implements IgniteCallable<long[]> {
205+
@IgniteInstanceResource
206+
private Ignite ignite;
207+
208+
@Override
209+
public long[] call() throws Exception {
210+
IgniteCache<Long, Person> cache = ignite.cache("person");
211+
Affinity<Long> affinity = ignite.affinity("person");
212+
ClusterNode localNode = ignite.cluster().localNode();
213+
214+
long[] sumAndCount = new long[2];
215+
216+
try (QueryCursor<Cache.Entry<Long, Person>> cursor = cache
217+
.query(new ScanQuery<Long, Person>().setLocal(true))) {
218+
for (Cache.Entry<Long, Person> entry : cursor) {
219+
if (affinity.isPrimary(localNode, entry.getKey())) {
220+
sumAndCount[0] += entry.getValue().getAge();
221+
sumAndCount[1]++;
222+
}
223+
}
224+
}
225+
226+
return sumAndCount;
227+
}
228+
}
229+
230+
void calculateAverageAge(Ignite ignite) {
231+
Collection<long[]> results = ignite.compute(ignite.cluster().forDataNodes("person"))
232+
.broadcast(new AverageAgeTask());
233+
234+
long totalAge = 0;
235+
long totalCount = 0;
236+
237+
for (long[] result : results) {
238+
totalAge += result[0];
239+
totalCount += result[1];
240+
}
241+
242+
double averageAge = totalCount == 0 ? 0 : (double) totalAge / totalCount;
243+
244+
System.out.println("Average age: " + averageAge);
245+
}
246+
247+
// end::local-scan-query[]
248+
197249
}

docs/_docs/data-streaming.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ DataStreamer doesn't guarantee:
6868
If <<overwriting, 'allowOverwrite'>> property is 'false' (default), consider:
6969
[]
7070
- You should not have the same keys repeating in the data being streamed;
71-
- Streamer cancelation or streamer node failure can cause data inconsistency;
71+
- Streamer cancelation or topology change can cause data inconsistency;
7272
- If loading into a persistent cache, concurrently created snapshot may contain inconsistent data and might not be restored entirely.
7373

7474
Most important behavior of Ignite Data Streamer is defined by <<receivers, stream receiver>> and

docs/_docs/distributed-computing/distributed-computing.adoc

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -305,60 +305,27 @@ If you want to use the key and value objects inside `IgniteCallable` and `Ignite
305305
====
306306

307307

308-
////////////////////////////////////////////////////////////////////////////////
309-
310-
311-
312-
In the cases where you do not need to colocate computations with data but simply want to process all data remotely, you can run local cache queries inside the `call()` method. Consider the following example.
313-
314-
Let's say we have a cache that stores information about persons and we want to calculate the average age of all persons. One way to accomplish this is to run a link:key-value-api/using-cache-queries[scan query] that will fetch the ages of all persons to the local node, where you can calculate the average age.
315-
316-
A more efficient way, however, is to avoid network calls to other nodes by running the query locally on each remote node and aggregating the result on the local node.
317-
318-
This task can be easily split
319-
320-
[source, java]
321-
-------------------------------------------------------------------------------
322-
private class AverageAgeJob implements IgniteCallable<Double> {
323-
324-
@IgniteInstanceResource
325-
private Ignite ignite;
326-
327-
@Override
328-
public Double call() throws Exception {
329-
330-
IgniteCache<Long, Person> cache = ignite.cache("person");
331-
332-
int localAvg = 0;
333-
try (QueryCursor<Cache.Entry<Long, Person>> cursor = cache
334-
.query(new ScanQuery<Long, Person>().setLocal(true))) {
335-
for (Cache.Entry<Long, Person> entry : cursor) {
336-
localAvg += (int) entry.getValue().getAge();
337-
}
338-
}
339-
340-
return (localAvg / (double) cache.size());
341-
}
342-
}
343-
344-
-------------------------------------------------------------------------------
345-
Note that the scan query is executed in the local mode. It means that it will only fetch objects from the Person cache that are stored localy and will not request data from other nodes.
308+
=== Processing Cache Data Locally
346309

347-
If you broadcast this task to all nodes, all person objecs will be processed (each locally), and the results are sent to the node that initiated the task.
348-
349-
[source, java]
350-
-------------------------------------------------------------------------------
351-
Ignite ignite = Ignition.ignite();
352-
353-
double average = ignite.compute().broadcast(new AverageAgeTask()).stream().reduce(0D, (a, b) -> a + b);
354-
-------------------------------------------------------------------------------
355-
356-
357-
The task is executed on every node, where it will query all persons stored locally and calculate the local average. Then the result are sent to the node that initiated the task and summed up. In this implementation, objects are not transferred via network.
310+
If you need to process all cache data remotely, you can broadcast a task to the data nodes and run a local cache query inside the task.
311+
In this mode, each node scans only the cache entries stored locally, processes them there, and returns only the aggregated result to the caller.
358312

313+
For example, assume that a cache stores `Person` objects and it is necessary to calculate the average age of all persons.
314+
A regular link:key-value-api/using-cache-queries[scan query] transfers matching entries to the query initiator page by page.
315+
The following example avoids transferring the full dataset over the network: the task is broadcast to the nodes that store data for the `person` cache, and each node runs `ScanQuery.setLocal(true)`.
316+
The task checks primary ownership so backup copies are not counted twice.
359317

318+
[tabs]
319+
--
320+
tab:Java[]
321+
[source,java]
322+
----
323+
include::{javaFile}[tag=local-scan-query,indent=0]
324+
----
325+
tab:C#/.NET[unsupported]
360326

361-
////////////////////////////////////////////////////////////////////////////////
327+
tab:C++[unsupported]
328+
--
362329

363330

364331
////////////////////////////////////////////////////////////////////////////////

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ It is critical that an Ignite Transaction should be `closed` regardless of its c
9292

9393
== Transaction Savepoints
9494

95-
Savepoints allow you to mark an intermediate state inside an explicit transaction and later roll back only the changes made after that point.
95+
Savepoints allow you to mark an intermediate state inside a transaction and later roll back only the changes made after that point.
9696
They are useful when a transaction contains several logical steps and one of the later steps can be discarded without rolling back the whole transaction.
9797

98-
Ignite supports savepoints only for explicit `PESSIMISTIC` transactions.
98+
Ignite supports savepoints only for explicit transactions.
9999
Savepoints are local to the transaction that created them and are removed when the transaction is committed or rolled back.
100100

101101
Use `Transaction.savepoint(name)` to create a savepoint.

docs/_docs/monitoring-metrics/system-views.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ This view exposes information about currently running SQL queries.
497497
|START_TIME | date | Query start time
498498
|DURATION | long | Query execution duration
499499
|INITIATOR_ID | string | User defined query initiator ID
500+
|MAP_QUERY | boolean | True if query is H2 map query
500501
|LOCAL | boolean | True if local only
501502
|SCHEMA_NAME | string | Schema name
502503
|SUBJECT_ID | UUID | The subject ID of the entity that initiated the query

0 commit comments

Comments
 (0)