public class GridQueryProcessor extends GridProcessorAdapter
GridComponent.DiscoveryDataExchangeType| Modifier and Type | Field and Description |
|---|---|
static Class<? extends GridQueryIndexing> |
idxCls
For tests.
|
ctx, diagnosticLog, log| Constructor and Description |
|---|
GridQueryProcessor(GridKernalContext ctx) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
belongsToTable(GridCacheContext cctx,
String expCacheName,
String expTblName,
KeyCacheObject key,
CacheObject val)
Check whether provided key and value belongs to expected cache and table.
|
void |
cancelQueries(Collection<Long> queries)
Cancel specified queries.
|
void |
collectGridNodeData(DiscoveryDataBag dataBag)
Collects discovery data on nodes already in grid on receiving
TcpDiscoveryNodeAddedMessage. |
GridComponent.DiscoveryDataExchangeType |
discoveryDataType()
Gets unique component type to distinguish components providing discovery data.
|
IgniteInternalFuture<?> |
dynamicColumnAdd(String cacheName,
String schemaName,
String tblName,
List<QueryField> cols,
boolean ifTblExists,
boolean ifNotExists)
Entry point for add column procedure.
|
IgniteInternalFuture<?> |
dynamicColumnRemove(String cacheName,
String schemaName,
String tblName,
List<String> cols,
boolean ifTblExists,
boolean ifExists)
Entry point for drop column procedure.
|
IgniteInternalFuture<?> |
dynamicIndexCreate(String cacheName,
String schemaName,
String tblName,
QueryIndex idx,
boolean ifNotExists,
int parallel)
Entry point for index procedure.
|
IgniteInternalFuture<?> |
dynamicIndexDrop(String cacheName,
String schemaName,
String idxName,
boolean ifExists)
Entry point for index drop procedure
|
void |
dynamicTableCreate(String schemaName,
QueryEntity entity,
String templateName,
String cacheName,
String cacheGroup,
String dataRegion,
String affinityKey,
CacheAtomicityMode atomicityMode,
CacheWriteSynchronizationMode writeSyncMode,
Integer backups,
boolean ifNotExists,
boolean encrypted)
Create cache and table from given query entity.
|
void |
dynamicTableDrop(String cacheName,
String tblName,
boolean ifExists)
Drop table by destroying its cache if it's an 1:1 per cache table.
|
<R> R |
executeQuery(GridCacheQueryType qryType,
String qry,
GridCacheContext<?,?> cctx,
IgniteOutClosureX<R> clo,
boolean complete) |
GridQueryIndexing |
getIndexing() |
static AffinityTopologyVersion |
getRequestAffinityTopologyVersion() |
boolean |
moduleEnabled() |
CacheQueryObjectValueContext |
objectContext() |
void |
onCacheKernalStart()
Handle cache kernal start.
|
void |
onCacheReconnect()
Handle cache reconnect.
|
void |
onCacheStart(GridCacheContext cctx,
QuerySchema schema)
Handle cache start.
|
void |
onCacheStart0(GridCacheContext<?,?> cctx,
QuerySchema schema)
Create type descriptors from schema and initialize indexing for given cache.
|
void |
onCacheStop(GridCacheContext cctx,
boolean removeIdx) |
void |
onCacheStop0(GridCacheContext cctx,
boolean destroy)
Unregister cache.
|
void |
onCoordinatorFinished(SchemaAbstractOperation op,
SchemaOperationException err)
Invoked when coordinator finished ensuring that all participants are ready.
|
void |
onDisconnected(IgniteFuture<?> reconnectFut)
Client disconnected callback.
|
void |
onDiscovery(SchemaAbstractDiscoveryMessage msg)
Handle custom discovery message.
|
void |
onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
Receives discovery data object from remote nodes (called
on new node during discovery process).
|
void |
onKernalStop(boolean cancel)
Callback to notify that kernal is about to stop.
|
void |
onLocalOperationFinished(SchemaAbstractOperation op,
QueryTypeDescriptorImpl type)
Apply positive index operation result.
|
void |
onNodeLeave(ClusterNode node)
Handle node leave.
|
void |
onSchemaPropose(SchemaProposeDiscoveryMessage msg)
Handle schema propose from exchange thread.
|
UpdateSourceIterator<?> |
prepareDistributedUpdate(GridCacheContext<?,?> cctx,
int[] cacheIds,
int[] parts,
String schema,
String qry,
Object[] params,
int flags,
int pageSize,
int timeout,
AffinityTopologyVersion topVer,
MvccSnapshot mvccSnapshot,
GridQueryCancel cancel) |
PreparedStatement |
prepareNativeStatement(String schemaName,
String sql) |
void |
processSchemaOperationLocal(SchemaAbstractOperation op,
QueryTypeDescriptorImpl type,
IgniteUuid depId,
SchemaIndexOperationCancellationToken cancelTok)
Process schema operation.
|
<K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> |
querySql(GridCacheContext<?,?> cctx,
SqlQuery qry,
boolean keepBinary)
Execute distributed SQL query.
|
List<FieldsQueryCursor<List<?>>> |
querySqlFields(GridCacheContext<?,?> cctx,
SqlFieldsQuery qry,
SqlClientContext cliCtx,
boolean keepBinary,
boolean failOnMultipleStmts)
Query SQL fields.
|
FieldsQueryCursor<List<?>> |
querySqlFields(SqlFieldsQuery qry,
boolean keepBinary)
Query SQL fields.
|
List<FieldsQueryCursor<List<?>>> |
querySqlFields(SqlFieldsQuery qry,
boolean keepBinary,
boolean failOnMultipleStmts)
Query SQL fields.
|
<K,V> GridCloseableIterator<IgniteBiTuple<K,V>> |
queryText(String cacheName,
String clause,
String resType,
IndexingQueryFilter filters) |
IgniteInternalFuture<?> |
rebuildIndexesFromHash(Set<Integer> cacheIds)
Rebuilds indexes for provided caches from corresponding hash indexes.
|
void |
remove(GridCacheContext cctx,
CacheDataRow row) |
Collection<GridRunningQueryInfo> |
runningQueries(long duration)
Collect queries that already running more than specified duration.
|
void |
sendStatusMessage(UUID destNodeId,
UUID opId,
SchemaOperationException err)
Send status message to coordinator node.
|
static void |
setRequestAffinityTopologyVersion(AffinityTopologyVersion ver) |
boolean |
skipFieldLookup() |
void |
skipFieldLookup(boolean skipFieldLookup) |
void |
start()
Starts grid component.
|
void |
stop(boolean cancel)
Stops grid component.
|
void |
store(GridCacheContext cctx,
CacheDataRow newRow,
CacheDataRow prevRow,
boolean prevRowAvailable) |
List<Long> |
streamBatchedUpdateQuery(String schemaName,
SqlClientContext cliCtx,
String qry,
List<Object[]> args) |
long |
streamUpdateQuery(String cacheName,
String schemaName,
IgniteDataStreamer<?,?> streamer,
String qry,
Object[] args) |
Collection<GridQueryTypeDescriptor> |
types(String cacheName)
Gets types for cache.
|
void |
validateKeyAndValue(CacheObjectContext coctx,
KeyCacheObject key,
CacheObject val)
Performs validation of provided key and value against configured constraints.
|
assertParameter, collectJoiningNodeData, onJoiningNodeDataReceived, onKernalStart, onReconnected, printMemoryStats, toString, validateNode, validateNodepublic static Class<? extends GridQueryIndexing> idxCls
public GridQueryProcessor(GridKernalContext ctx) throws IgniteCheckedException
ctx - Kernal context.IgniteCheckedExceptionpublic void start()
throws IgniteCheckedException
start in interface GridComponentstart in class GridProcessorAdapterIgniteCheckedException - Throws in case of any errors.public void onKernalStop(boolean cancel)
onKernalStop in interface GridComponentonKernalStop in class GridProcessorAdaptercancel - Flag indicating whether jobs should be canceled.public void stop(boolean cancel)
throws IgniteCheckedException
stop in interface GridComponentstop in class GridProcessorAdaptercancel - If true, then all ongoing tasks or jobs for relevant
components need to be cancelled.IgniteCheckedException - Thrown in case of any errors.public void onCacheKernalStart()
throws IgniteCheckedException
IgniteCheckedException - If failed.public void onCacheReconnect()
throws IgniteCheckedException
IgniteCheckedException - If failed.@Nullable public GridComponent.DiscoveryDataExchangeType discoveryDataType()
GridComponent.collectJoiningNodeData(DiscoveryDataBag)
or GridComponent.collectGridNodeData(DiscoveryDataBag).discoveryDataType in interface GridComponentdiscoveryDataType in class GridProcessorAdapterpublic void collectGridNodeData(DiscoveryDataBag dataBag)
TcpDiscoveryNodeAddedMessage.collectGridNodeData in interface GridComponentcollectGridNodeData in class GridProcessorAdapterdataBag - container object to store discovery data in.public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
onGridDataReceived in interface GridComponentonGridDataReceived in class GridProcessorAdapterdata - DiscoveryDataBag.GridDiscoveryData interface to retrieve discovery data collected on remote nodes
(data common for all nodes in grid and specific for each node).public void onSchemaPropose(SchemaProposeDiscoveryMessage msg)
msg - Discovery message.public boolean moduleEnabled()
true If indexing module is in classpath and successfully initialized.public GridQueryIndexing getIndexing() throws IgniteException
IgniteException - If module is not enabled.public void onCacheStart0(GridCacheContext<?,?> cctx, QuerySchema schema) throws IgniteCheckedException
Use with busyLock where appropriate.
cctx - Cache context.schema - Initial schema.IgniteCheckedException - If failed.public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException
onDisconnected in interface GridComponentonDisconnected in class GridProcessorAdapterreconnectFut - Reconnect future.IgniteCheckedException - If failed.public void onCacheStart(GridCacheContext cctx, QuerySchema schema) throws IgniteCheckedException
cctx - Cache context.schema - Index states.IgniteCheckedException - If failed.public void onCacheStop(GridCacheContext cctx, boolean removeIdx)
cctx - Cache context.removeIdx - If true, will remove index.public boolean skipFieldLookup()
public void skipFieldLookup(boolean skipFieldLookup)
skipFieldLookup - Skip field lookup flag.public void onDiscovery(SchemaAbstractDiscoveryMessage msg)
msg - Message.public void onCoordinatorFinished(SchemaAbstractOperation op, @Nullable SchemaOperationException err)
op - Operation.err - Error (if any).public void onLocalOperationFinished(SchemaAbstractOperation op, @Nullable QueryTypeDescriptorImpl type)
op - Operation.type - Type descriptor (if available),public void onNodeLeave(ClusterNode node)
node - Node.public void processSchemaOperationLocal(SchemaAbstractOperation op, QueryTypeDescriptorImpl type, IgniteUuid depId, SchemaIndexOperationCancellationToken cancelTok) throws SchemaOperationException
op - Operation.type - Type descriptor.depId - Cache deployment ID.cancelTok - Cancel token.SchemaOperationException - If failed.public void dynamicTableCreate(String schemaName, QueryEntity entity, String templateName, String cacheName, String cacheGroup, @Nullable String dataRegion, String affinityKey, @Nullable CacheAtomicityMode atomicityMode, @Nullable CacheWriteSynchronizationMode writeSyncMode, @Nullable Integer backups, boolean ifNotExists, boolean encrypted) throws IgniteCheckedException
schemaName - Schema name to create table in.entity - Entity to create table from.templateName - Template name.cacheName - Cache name.cacheGroup - Cache group name.dataRegion - Data region name.affinityKey - Affinity key column name.atomicityMode - Atomicity mode.writeSyncMode - Write synchronization mode.backups - Backups.ifNotExists - Quietly ignore this command if table already exists.encrypted - Encrypted flag.IgniteCheckedException - If failed.public void dynamicTableDrop(String cacheName, String tblName, boolean ifExists) throws SchemaOperationException
cacheName - Cache name.tblName - Table name.ifExists - Quietly ignore this command if table does not exist.SchemaOperationException - if ifExists is false and cache was not found.public void onCacheStop0(GridCacheContext cctx, boolean destroy)
Use with busyLock where appropriate.
cctx - Cache context.destroy - Destroy flag.public boolean belongsToTable(GridCacheContext cctx, String expCacheName, String expTblName, KeyCacheObject key, CacheObject val) throws IgniteCheckedException
cctx - Target cache context.expCacheName - Expected cache name.expTblName - Expected table name.key - Key.val - Value.True if this key-value pair belongs to expected cache/table, false otherwise or
if cache or table doesn't exist.IgniteCheckedException - If failed.public IgniteInternalFuture<?> rebuildIndexesFromHash(Set<Integer> cacheIds)
cacheIds - Cache IDs.public void store(GridCacheContext cctx, CacheDataRow newRow, @Nullable CacheDataRow prevRow, boolean prevRowAvailable) throws IgniteCheckedException
cctx - Cache context.newRow - New row.prevRow - Previous row.IgniteCheckedException - In case of error.public UpdateSourceIterator<?> prepareDistributedUpdate(GridCacheContext<?,?> cctx, int[] cacheIds, int[] parts, String schema, String qry, Object[] params, int flags, int pageSize, int timeout, AffinityTopologyVersion topVer, MvccSnapshot mvccSnapshot, GridQueryCancel cancel) throws IgniteCheckedException
cctx - Cache context.cacheIds - Involved cache ids.parts - Partitions.schema - Schema name.qry - Query string.params - Query parameters.flags - Flags.pageSize - Fetch page size.timeout - Timeout.topVer - Topology version.mvccSnapshot - MVCC snapshot.cancel - Query cancel object.IgniteCheckedException - If failed.public List<FieldsQueryCursor<List<?>>> querySqlFields(SqlFieldsQuery qry, boolean keepBinary, boolean failOnMultipleStmts)
qry - Query.keepBinary - Keep binary flag.public FieldsQueryCursor<List<?>> querySqlFields(SqlFieldsQuery qry, boolean keepBinary)
qry - Query.keepBinary - Keep binary flag.public List<FieldsQueryCursor<List<?>>> querySqlFields(@Nullable GridCacheContext<?,?> cctx, SqlFieldsQuery qry, SqlClientContext cliCtx, boolean keepBinary, boolean failOnMultipleStmts)
cctx - Cache context.qry - Query.cliCtx - Client context.keepBinary - Keep binary flag.failOnMultipleStmts - If true the method must throws exception when query contains
more then one SQL statement.public long streamUpdateQuery(@Nullable
String cacheName,
String schemaName,
IgniteDataStreamer<?,?> streamer,
String qry,
Object[] args)
cacheName - Cache name.schemaName - Schema name.streamer - Data streamer.qry - Query.public List<Long> streamBatchedUpdateQuery(String schemaName, SqlClientContext cliCtx, String qry, List<Object[]> args)
schemaName - Schema name.cliCtx - Client context.qry - Query.args - Query arguments.public <K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> querySql(GridCacheContext<?,?> cctx, SqlQuery qry, boolean keepBinary)
cctx - Cache context.qry - Query.keepBinary - Keep binary flag.public Collection<GridRunningQueryInfo> runningQueries(long duration)
duration - Duration to check.public void cancelQueries(Collection<Long> queries)
queries - Queries ID's to cancel.public IgniteInternalFuture<?> dynamicIndexCreate(String cacheName, String schemaName, String tblName, QueryIndex idx, boolean ifNotExists, int parallel)
cacheName - Cache name.schemaName - Schema name.tblName - Table name.idx - Index.ifNotExists - When set to true operation will fail if index already exists.parallel - Index creation parallelism level.public IgniteInternalFuture<?> dynamicIndexDrop(String cacheName, String schemaName, String idxName, boolean ifExists)
cacheName - Cache name.schemaName - Schema name.idxName - Index name.ifExists - When set to true operation fill fail if index doesn't exists.public IgniteInternalFuture<?> dynamicColumnAdd(String cacheName, String schemaName, String tblName, List<QueryField> cols, boolean ifTblExists, boolean ifNotExists)
schemaName - Schema name.tblName - Target table name.cols - Columns to add.ifTblExists - Ignore operation if target table doesn't exist.ifNotExists - Ignore operation if column exists.public IgniteInternalFuture<?> dynamicColumnRemove(String cacheName, String schemaName, String tblName, List<String> cols, boolean ifTblExists, boolean ifExists)
schemaName - Schema name.tblName - Target table name.cols - Columns to drop.ifTblExists - Ignore operation if target table doesn't exist.ifExists - Ignore operation if column does not exist.public PreparedStatement prepareNativeStatement(String schemaName, String sql) throws SQLException
schemaName - Schema name.sql - Query.PreparedStatement from underlying engine to supply metadata to Prepared - most likely H2.SQLException - On error.public void remove(GridCacheContext cctx, CacheDataRow row) throws IgniteCheckedException
cctx - Cache context.row - Row removed from cache.IgniteCheckedException - Thrown in case of any errors.public <K,V> GridCloseableIterator<IgniteBiTuple<K,V>> queryText(String cacheName, String clause, String resType, IndexingQueryFilter filters) throws IgniteCheckedException
K - Key type.V - Value type.cacheName - Cache name.clause - Clause.resType - Result type.filters - Key and value filters.IgniteCheckedException - If failed.public Collection<GridQueryTypeDescriptor> types(@Nullable String cacheName)
cacheName - Cache name.public <R> R executeQuery(GridCacheQueryType qryType, String qry, @Nullable GridCacheContext<?,?> cctx, IgniteOutClosureX<R> clo, boolean complete) throws IgniteCheckedException
qryType - Query type.qry - Query description.cctx - Cache context.clo - Closure.complete - Complete.IgniteCheckedExceptionpublic void sendStatusMessage(UUID destNodeId, UUID opId, SchemaOperationException err)
destNodeId - Destination node ID.opId - Operation ID.err - Error.public CacheQueryObjectValueContext objectContext()
public void validateKeyAndValue(CacheObjectContext coctx, KeyCacheObject key, CacheObject val) throws IgniteCheckedException
coctx - Cache object context.key - Key.val - Value.IgniteCheckedException, - If error happens.IgniteCheckedExceptionpublic static void setRequestAffinityTopologyVersion(AffinityTopologyVersion ver)
ver - Version.public static AffinityTopologyVersion getRequestAffinityTopologyVersion()
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.5 Release Date : June 4 2019