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<?> |
dynamicIndexCreate(String cacheName,
String schemaName,
String tblName,
QueryIndex idx,
boolean ifNotExists)
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 cacheGroup,
String affinityKey,
CacheAtomicityMode atomicityMode,
int backups,
boolean ifNotExists)
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) |
void |
onCacheStop0(String cacheName)
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.
|
PreparedStatement |
prepareNativeStatement(String cacheName,
String sql) |
void |
processIndexOperationLocal(SchemaAbstractOperation op,
QueryTypeDescriptorImpl type,
IgniteUuid depId,
SchemaIndexOperationCancellationToken cancelTok)
Process index operation.
|
<K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> |
querySql(GridCacheContext<?,?> cctx,
SqlQuery qry,
boolean keepBinary)
Execute distributed SQL query.
|
FieldsQueryCursor<List<?>> |
querySqlFields(GridCacheContext<?,?> cctx,
SqlFieldsQuery qry,
boolean keepBinary)
Query SQL fields.
|
FieldsQueryCursor<List<?>> |
querySqlFieldsNoCache(SqlFieldsQuery qry,
boolean keepBinary)
Query SQL fields without strict dependency on concrete cache.
|
<K,V> GridCloseableIterator<IgniteBiTuple<K,V>> |
queryText(String cacheName,
String clause,
String resType,
IndexingQueryFilter filters) |
IgniteInternalFuture<?> |
rebuildIndexesFromHash(Collection<Integer> cacheIds)
Rebuilds indexes for provided caches from corresponding hash indexes.
|
void |
remove(String cacheName,
KeyCacheObject key,
int partId,
CacheObject val,
GridCacheVersion ver) |
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(String cacheName,
KeyCacheObject key,
int partId,
CacheObject prevVal,
GridCacheVersion prevVer,
CacheObject val,
GridCacheVersion ver,
long expirationTime,
long link)
Writes key-value pair to index.
|
long |
streamUpdateQuery(String cacheName,
String schemaName,
IgniteDataStreamer<?,?> streamer,
String qry,
Object[] args) |
Collection<GridQueryTypeDescriptor> |
types(String cacheName)
Gets types for cache.
|
assertParameter, collectJoiningNodeData, onJoiningNodeDataReceived, onKernalStart, onReconnected, printMemoryStats, toString, 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)
cctx - Cache context.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 processIndexOperationLocal(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 cacheGroup, String affinityKey, @Nullable CacheAtomicityMode atomicityMode, int backups, boolean ifNotExists) throws IgniteCheckedException
schemaName - Schema name to create table in.entity - Entity to create table from.templateName - Template name.cacheGroup - Cache group name.affinityKey - Affinity key column name.atomicityMode - Atomicity mode.backups - Backups.ifNotExists - Quietly ignore this command if table already exists.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(String cacheName)
Use with busyLock where appropriate.
cacheName - Cache name.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(Collection<Integer> cacheIds)
cacheIds - Cache IDs.public void store(String cacheName, KeyCacheObject key, int partId, @Nullable CacheObject prevVal, @Nullable GridCacheVersion prevVer, CacheObject val, GridCacheVersion ver, long expirationTime, long link) throws IgniteCheckedException
cacheName - Cache name.key - Key.val - Value.ver - Cache entry version.expirationTime - Expiration time or 0 if never expires.IgniteCheckedException - In case of error.public FieldsQueryCursor<List<?>> querySqlFields(GridCacheContext<?,?> cctx, SqlFieldsQuery qry, boolean keepBinary)
cctx - Cache context.qry - Query.keepBinary - Keep binary flag.public FieldsQueryCursor<List<?>> querySqlFieldsNoCache(SqlFieldsQuery qry, boolean keepBinary)
qry - Query.keepBinary - Keep binary flag.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 <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)
cacheName - Cache name.schemaName - Schema name.tblName - Table name.idx - Index.ifNotExists - When set to true operation will fail if index already exists.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 PreparedStatement prepareNativeStatement(String cacheName, String sql) throws SQLException
cacheName - Cache name.sql - Query.PreparedStatement from underlying engine to supply metadata to Prepared - most likely H2.SQLExceptionpublic void remove(String cacheName, KeyCacheObject key, int partId, CacheObject val, GridCacheVersion ver) throws IgniteCheckedException
cacheName - Cache name.key - Key.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 static void setRequestAffinityTopologyVersion(AffinityTopologyVersion ver)
ver - Version.public static AffinityTopologyVersion getRequestAffinityTopologyVersion()
Follow @ApacheIgnite
Ignite Fabric : ver. 2.1.0 Release Date : July 20 2017