public class GridQueryProcessor extends GridProcessorAdapter
GridComponent.DiscoveryDataExchangeType| Modifier and Type | Field and Description |
|---|---|
static Class<? extends GridQueryIndexing> |
idxCls
For tests.
|
ctx, log| Constructor and Description |
|---|
GridQueryProcessor(GridKernalContext ctx) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
belongsToTable(GridCacheContext cctx,
String expSpace,
String expTblName,
KeyCacheObject key,
CacheObject val)
Check whether provided key and value belongs to expected space 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. |
IgniteDataStreamer<?,?> |
createStreamer(String spaceName,
PreparedStatement nativeStmt,
long autoFlushFreq,
int nodeBufSize,
int nodeParOps,
boolean allowOverwrite) |
GridComponent.DiscoveryDataExchangeType |
discoveryDataType()
Gets unique component type to distinguish components providing discovery data.
|
IgniteInternalFuture<?> |
dynamicIndexCreate(String space,
String tblName,
QueryIndex idx,
boolean ifNotExists)
Entry point for index procedure.
|
IgniteInternalFuture<?> |
dynamicIndexDrop(String space,
String idxName,
boolean ifExists)
Entry point for index drop procedure
|
<R> R |
executeQuery(GridCacheQueryType qryType,
String qry,
GridCacheContext<?,?> cctx,
IgniteOutClosureX<R> clo,
boolean complete) |
GridQueryIndexing |
getIndexing() |
static AffinityTopologyVersion |
getRequestAffinityTopologyVersion() |
boolean |
moduleEnabled() |
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 space)
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 space,
String sql) |
void |
processIndexOperationLocal(SchemaAbstractOperation op,
QueryTypeDescriptorImpl type,
IgniteUuid depId,
SchemaIndexOperationCancellationToken cancelTok)
Process index operation.
|
<K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> |
queryLocal(GridCacheContext<?,?> cctx,
SqlQuery qry,
boolean keepBinary) |
QueryCursor<List<?>> |
queryLocalFields(GridCacheContext<?,?> cctx,
SqlFieldsQuery qry) |
<K,V> GridCloseableIterator<IgniteBiTuple<K,V>> |
queryText(String space,
String clause,
String resType,
IndexingQueryFilter filters) |
QueryCursor<List<?>> |
queryTwoStep(GridCacheContext<?,?> cctx,
SqlFieldsQuery qry) |
<K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> |
queryTwoStep(GridCacheContext<?,?> cctx,
SqlQuery qry) |
IgniteInternalFuture<?> |
rebuildIndexesFromHash(Collection<Integer> cacheIds)
Rebuilds indexes for provided caches from corresponding hash indexes.
|
void |
remove(String space,
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) |
String |
space(String schema) |
void |
start(boolean activeOnStart)
Starts grid component.
|
void |
stop(boolean cancel)
Stops grid component.
|
void |
store(String space,
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 spaceName,
IgniteDataStreamer<?,?> streamer,
String qry,
Object[] args) |
Collection<GridQueryTypeDescriptor> |
types(String space)
Gets types for space.
|
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(boolean activeOnStart)
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 onCacheStop0(String space)
Use with busyLock where appropriate.
space - Space.public boolean belongsToTable(GridCacheContext cctx, String expSpace, String expTblName, KeyCacheObject key, CacheObject val) throws IgniteCheckedException
cctx - Target cache context.expSpace - Expected space.expTblName - Expected table name.key - Key.val - Value.True if this key-value pair belongs to expected space/table, false otherwise or
if space or table doesn't exist.IgniteCheckedException - If failed.public IgniteInternalFuture<?> rebuildIndexesFromHash(Collection<Integer> cacheIds)
cacheIds - Cache IDs.public void store(String space, KeyCacheObject key, int partId, @Nullable CacheObject prevVal, @Nullable GridCacheVersion prevVer, CacheObject val, GridCacheVersion ver, long expirationTime, long link) throws IgniteCheckedException
space - Space.key - Key.val - Value.ver - Cache entry version.expirationTime - Expiration time or 0 if never expires.IgniteCheckedException - In case of error.public QueryCursor<List<?>> queryTwoStep(GridCacheContext<?,?> cctx, SqlFieldsQuery qry)
cctx - Cache context.qry - Query.public long streamUpdateQuery(@Nullable
String spaceName,
IgniteDataStreamer<?,?> streamer,
String qry,
Object[] args)
spaceName - Cache name.streamer - Data streamer.qry - Query.public <K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> queryTwoStep(GridCacheContext<?,?> cctx, SqlQuery qry)
cctx - Cache context.qry - Query.public <K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> queryLocal(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 space, String tblName, QueryIndex idx, boolean ifNotExists)
space - Space name.tblName - Table name.idx - Index.ifNotExists - When set to true operation will fail if index already exists.public IgniteInternalFuture<?> dynamicIndexDrop(String space, String idxName, boolean ifExists)
idxName - Index name.ifExists - When set to true operation fill fail if index doesn't exists.public PreparedStatement prepareNativeStatement(String space, String sql) throws SQLException
space - Space name.sql - Query.PreparedStatement from underlying engine to supply metadata to Prepared - most likely H2.SQLExceptionpublic String space(String schema) throws SQLException
schema - Schema name.SQLExceptionpublic IgniteDataStreamer<?,?> createStreamer(String spaceName, PreparedStatement nativeStmt, long autoFlushFreq, int nodeBufSize, int nodeParOps, boolean allowOverwrite)
spaceName - Space name.nativeStmt - Native statement.autoFlushFreq - Automatic data flushing frequency, disabled if 0.nodeBufSize - Per node buffer size - see IgniteDataStreamer.perNodeBufferSize(int)nodeParOps - Per node parallel ops count - see IgniteDataStreamer.perNodeParallelOperations(int)allowOverwrite - Overwrite existing cache values on key duplication.IgniteDataStreamer tailored to specific needs of given native statement based on its metadata.IgniteDataStreamer.allowOverwrite()public QueryCursor<List<?>> queryLocalFields(GridCacheContext<?,?> cctx, SqlFieldsQuery qry)
cctx - Cache context.qry - Query.public void remove(String space, KeyCacheObject key, int partId, CacheObject val, GridCacheVersion ver) throws IgniteCheckedException
space - Space.key - Key.IgniteCheckedException - Thrown in case of any errors.public <K,V> GridCloseableIterator<IgniteBiTuple<K,V>> queryText(String space, String clause, String resType, IndexingQueryFilter filters) throws IgniteCheckedException
K - Key type.V - Value type.space - Space.clause - Clause.resType - Result type.filters - Key and value filters.IgniteCheckedException - If failed.public Collection<GridQueryTypeDescriptor> types(@Nullable String space)
space - Space name.public <R> R executeQuery(GridCacheQueryType qryType, String qry, 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 static void setRequestAffinityTopologyVersion(AffinityTopologyVersion ver)
ver - Version.public static AffinityTopologyVersion getRequestAffinityTopologyVersion()
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017