Skip to content

Commit

Permalink
IGNITE-23554 ScanQuery code cleanup (#11645)
Browse files Browse the repository at this point in the history
  • Loading branch information
nizhikov authored Nov 7, 2024
1 parent 11fca4a commit f56ffce
Show file tree
Hide file tree
Showing 12 changed files with 506 additions and 484 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
import org.apache.ignite.events.SqlQueryExecutionEvent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.failure.FailureProcessor;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
Expand Down Expand Up @@ -119,10 +119,10 @@
import org.apache.ignite.internal.processors.query.calcite.util.Service;
import org.apache.ignite.internal.processors.security.SecurityUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;

import static org.apache.ignite.IgniteSystemProperties.getLong;
import static org.apache.ignite.configuration.TransactionConfiguration.TX_AWARE_QUERIES_SUPPORTED_MODES;
import static org.apache.ignite.events.EventType.EVT_SQL_QUERY_EXECUTION;

/** */
Expand Down Expand Up @@ -605,20 +605,15 @@ private static GridCacheVersion queryTransactionVersion(@Nullable QueryContext q

/** */
private void ensureTransactionModeSupported(@Nullable QueryContext qryCtx) {
if (!ctx.config().getTransactionConfiguration().isTxAwareQueriesEnabled())
if (!U.isTxAwareQueriesEnabled(ctx))
return;

GridCacheVersion ver = queryTransactionVersion(qryCtx);

if (ver == null)
return;

final GridNearTxLocal userTx = ctx.cache().context().tm().tx(ver);

if (TX_AWARE_QUERIES_SUPPORTED_MODES.contains(userTx.isolation()))
return;

throw new IllegalStateException("Transaction isolation mode not supported for SQL queries: " + userTx.isolation());
IgniteTxManager.ensureTransactionModeSupported(ctx.cache().context().tm().tx(ver).isolation());
}

/** */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.apache.ignite.internal.managers.systemview.walker.ScanQueryViewWalker;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager.ScanQueryIterator;
import org.apache.ignite.internal.processors.cache.query.ScanQueryIterator;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.spi.IgniteSpiCloseableIterator;
Expand Down Expand Up @@ -83,7 +83,7 @@ public ScanQuerySystemView(Collection<GridCacheContext<K, V>> cctxs) {
return new QueryDataIterator();
}

/** Class to iterate through all {@link GridCacheQueryManager.ScanQueryIterator}. */
/** Class to iterate through all {@link ScanQueryIterator}. */
private class QueryDataIterator implements Iterator<ScanQueryView> {
/** Cache contexts iterator. */
private final Iterator<GridCacheContext<K, V>> cctxsIter;
Expand All @@ -95,7 +95,7 @@ private class QueryDataIterator implements Iterator<ScanQueryView> {
private Iterator<Map.Entry<UUID, GridCacheQueryManager<K, V>.RequestFutureMap>> nodeQryIter;

/** Local query iterator. */
private Iterator<GridCacheQueryManager.ScanQueryIterator> localQryIter;
private Iterator<ScanQueryIterator> localQryIter;

/** Current node id. */
private UUID nodeId;
Expand Down Expand Up @@ -173,7 +173,7 @@ public QueryDataIterator() {
}

/**
* @return {@code True} if next {@link GridCacheQueryManager.ScanQueryIterator} found.
* @return {@code True} if next {@link ScanQueryIterator} found.
*/
private boolean nextScanIter() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,6 @@ private Collection<ClusterNode> nodes() throws IgniteCheckedException {
top.readLock();

try {

Collection<ClusterNode> affNodes = nodes(cctx, null, null);

List<ClusterNode> nodes = new ArrayList<>(affNodes);
Expand Down
Loading

0 comments on commit f56ffce

Please sign in to comment.