public class IgniteH2Indexing extends Object implements GridQueryIndexing
For each registered GridQueryTypeDescriptor this SPI will create respective SQL table with
'_key' and '_val' fields for key and value, and fields from
GridQueryTypeDescriptor.fields().
For each table it will create indexes declared in GridQueryTypeDescriptor.indexes().
| Modifier and Type | Field and Description |
|---|---|
protected GridKernalContext |
ctx |
static List<GridQueryFieldMetadata> |
UPDATE_RESULT_META
Dummy metadata for update result.
|
protected CacheQueryObjectValueContext |
valCtx
Cache object value context.
|
| Constructor and Description |
|---|
IgniteH2Indexing() |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitForReadyTopologyVersion(AffinityTopologyVersion topVer) |
IndexingQueryFilter |
backupFilter(AffinityTopologyVersion topVer,
int[] parts) |
void |
bindParameters(PreparedStatement stmt,
Collection<Object> params)
Binds parameters to prepared statement.
|
GridSpinBusyLock |
busyLock() |
void |
cancelAllQueries() |
void |
cancelQueries(Collection<Long> queries) |
List<Integer> |
collectCacheIds(Integer mainCacheId,
GridCacheTwoStepQuery twoStepQry)
Collect cache identifiers from two-step query.
|
Connection |
connectionForSchema(String schema) |
GridH2IndexBase |
createSortedIndex(String name,
GridH2Table tbl,
boolean pk,
List<org.h2.table.IndexColumn> cols,
int inlineSize)
Create sorted index.
|
GridH2Table |
dataTable(QueryTable tbl)
Find table by it's identifier.
|
GridH2Table |
dataTable(String schemaName,
String tblName)
Find table by name in given schema.
|
GridH2Table |
dataTableForIndex(String schemaName,
String idxName)
Find table for index.
|
void |
dynamicAddColumn(String schemaName,
String tblName,
List<QueryField> cols,
boolean ifTblExists,
boolean ifColNotExists) |
void |
dynamicIndexCreate(String schemaName,
String tblName,
QueryIndexDescriptorImpl idxDesc,
boolean ifNotExists,
SchemaIndexCacheVisitor cacheVisitor) |
void |
dynamicIndexDrop(String schemaName,
String idxName,
boolean ifExists) |
ResultSet |
executeSqlQueryWithTimer(Connection conn,
String sql,
Collection<Object> params,
boolean useStmtCache,
int timeoutMillis,
GridQueryCancel cancel)
Executes sql query and prints warning if query is too slow..
|
void |
executeStatement(String schema,
String sql) |
boolean |
isInsertStatement(PreparedStatement nativeStmt) |
GridKernalContext |
kernalContext() |
UpdateResult |
mapDistributedUpdate(String schemaName,
SqlFieldsQuery fldsQry,
IndexingQueryFilter filter,
GridQueryCancel cancel,
boolean local)
Run DML request from other node.
|
GridMapQueryExecutor |
mapQueryExecutor() |
void |
markForRebuildFromHash(String cacheName) |
CacheObjectValueContext |
objectContext() |
void |
onDisconnected(IgniteFuture<?> reconnectFut) |
PreparedStatement |
prepareNativeStatement(String schemaName,
String sql) |
<K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> |
queryDistributedSql(String schemaName,
String cacheName,
SqlQuery qry,
boolean keepBinary,
int mainCacheId) |
List<FieldsQueryCursor<List<?>>> |
queryDistributedSqlFields(String schemaName,
SqlFieldsQuery qry,
boolean keepBinary,
GridQueryCancel cancel,
Integer mainCacheId,
boolean failOnMultipleStmts) |
<K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> |
queryLocalSql(String schemaName,
String cacheName,
SqlQuery qry,
IndexingQueryFilter filter,
boolean keepBinary) |
<K,V> GridCloseableIterator<IgniteBiTuple<K,V>> |
queryLocalSql(String schemaName,
String cacheName,
String qry,
String alias,
Collection<Object> params,
String type,
IndexingQueryFilter filter,
GridQueryCancel cancel)
Executes regular query.
|
FieldsQueryCursor<List<?>> |
queryLocalSqlFields(String schemaName,
SqlFieldsQuery qry,
boolean keepBinary,
IndexingQueryFilter filter,
GridQueryCancel cancel) |
GridQueryFieldsResult |
queryLocalSqlFields(String schemaName,
String qry,
Collection<Object> params,
IndexingQueryFilter filter,
boolean enforceJoinOrder,
int timeout,
GridQueryCancel cancel)
Queries individual fields (generally used by JDBC drivers).
|
<K,V> GridCloseableIterator<IgniteBiTuple<K,V>> |
queryLocalText(String schemaName,
String cacheName,
String qry,
String typeName,
IndexingQueryFilter filters) |
AffinityTopologyVersion |
readyTopologyVersion() |
void |
rebuildIndexesFromHash(String cacheName)
Rebuild indexes from hash index.
|
GridReduceQueryExecutor |
reduceQueryExecutor() |
void |
registerCache(String cacheName,
String schemaName,
GridCacheContext<?,?> cctx) |
boolean |
registerType(GridCacheContext cctx,
GridQueryTypeDescriptor type)
Registers new class description.
|
void |
remove(String cacheName,
GridQueryTypeDescriptor type,
KeyCacheObject key,
int partId,
CacheObject val,
GridCacheVersion ver) |
void |
removeDataTable(GridH2Table h2Tbl) |
Collection<GridRunningQueryInfo> |
runningQueries(long duration) |
String |
schema(String cacheName) |
boolean |
send(Object topic,
int topicOrd,
Collection<ClusterNode> nodes,
Message msg,
IgniteBiClosure<ClusterNode,Message,Message> specialize,
IgniteInClosure2X<ClusterNode,Message> locNodeHnd,
byte plc,
boolean runLocParallel) |
void |
start(GridKernalContext ctx,
GridSpinBusyLock busyLock) |
void |
stop() |
void |
store(String cacheName,
GridQueryTypeDescriptor type,
KeyCacheObject k,
int partId,
CacheObject v,
GridCacheVersion ver,
long expirationTime,
long link) |
long |
streamUpdateQuery(String schemaName,
String qry,
Object[] params,
IgniteDataStreamer<?,?> streamer) |
void |
unregisterCache(String cacheName,
boolean destroy) |
public static final List<GridQueryFieldMetadata> UPDATE_RESULT_META
protected volatile GridKernalContext ctx
protected CacheQueryObjectValueContext valCtx
public GridKernalContext kernalContext()
public Connection connectionForSchema(String schema)
schema - Schema.public PreparedStatement prepareNativeStatement(String schemaName, String sql) throws SQLException
prepareNativeStatement in interface GridQueryIndexingSQLExceptionpublic void executeStatement(String schema, String sql) throws IgniteCheckedException
schema - Schemasql - SQL statement.IgniteCheckedException - If failed.public void store(String cacheName, GridQueryTypeDescriptor type, KeyCacheObject k, int partId, CacheObject v, GridCacheVersion ver, long expirationTime, long link) throws IgniteCheckedException
store in interface GridQueryIndexingIgniteCheckedExceptionpublic void remove(String cacheName, GridQueryTypeDescriptor type, KeyCacheObject key, int partId, CacheObject val, GridCacheVersion ver) throws IgniteCheckedException
remove in interface GridQueryIndexingIgniteCheckedExceptionpublic void dynamicIndexCreate(String schemaName, String tblName, QueryIndexDescriptorImpl idxDesc, boolean ifNotExists, SchemaIndexCacheVisitor cacheVisitor) throws IgniteCheckedException
dynamicIndexCreate in interface GridQueryIndexingIgniteCheckedExceptionpublic void dynamicIndexDrop(String schemaName, String idxName, boolean ifExists) throws IgniteCheckedException
dynamicIndexDrop in interface GridQueryIndexingIgniteCheckedExceptionpublic void dynamicAddColumn(String schemaName, String tblName, List<QueryField> cols, boolean ifTblExists, boolean ifColNotExists) throws IgniteCheckedException
dynamicAddColumn in interface GridQueryIndexingIgniteCheckedExceptionpublic GridH2IndexBase createSortedIndex(String name, GridH2Table tbl, boolean pk, List<org.h2.table.IndexColumn> cols, int inlineSize)
name - Index name,tbl - Table.pk - Primary key flag.cols - Columns.public <K,V> GridCloseableIterator<IgniteBiTuple<K,V>> queryLocalText(String schemaName, String cacheName, String qry, String typeName, IndexingQueryFilter filters) throws IgniteCheckedException
queryLocalText in interface GridQueryIndexingIgniteCheckedExceptionpublic GridQueryFieldsResult queryLocalSqlFields(String schemaName, String qry, @Nullable Collection<Object> params, IndexingQueryFilter filter, boolean enforceJoinOrder, int timeout, GridQueryCancel cancel) throws IgniteCheckedException
schemaName - Schema name.qry - Query.params - Query parameters.filter - Cache name and key filter.enforceJoinOrder - Enforce join order of tables in the query.timeout - Query timeout in milliseconds.cancel - Query cancel.IgniteCheckedException - If failed.public long streamUpdateQuery(String schemaName, String qry, @Nullable Object[] params, IgniteDataStreamer<?,?> streamer) throws IgniteCheckedException
streamUpdateQuery in interface GridQueryIndexingIgniteCheckedExceptionpublic ResultSet executeSqlQueryWithTimer(Connection conn, String sql, @Nullable Collection<Object> params, boolean useStmtCache, int timeoutMillis, @Nullable GridQueryCancel cancel) throws IgniteCheckedException
conn - Connection,sql - Sql query.params - Parameters.useStmtCache - If true uses stmt cache.cancel - Query cancel.IgniteCheckedException - If failed.public void bindParameters(PreparedStatement stmt, @Nullable Collection<Object> params) throws IgniteCheckedException
stmt - Prepared statement.params - Parameters collection.IgniteCheckedException - If failed.public FieldsQueryCursor<List<?>> queryLocalSqlFields(String schemaName, SqlFieldsQuery qry, boolean keepBinary, IndexingQueryFilter filter, GridQueryCancel cancel) throws IgniteCheckedException
queryLocalSqlFields in interface GridQueryIndexingIgniteCheckedExceptionpublic <K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> queryLocalSql(String schemaName, String cacheName, SqlQuery qry, IndexingQueryFilter filter, boolean keepBinary) throws IgniteCheckedException
queryLocalSql in interface GridQueryIndexingIgniteCheckedExceptionpublic <K,V> GridCloseableIterator<IgniteBiTuple<K,V>> queryLocalSql(String schemaName, String cacheName, String qry, String alias, @Nullable Collection<Object> params, String type, IndexingQueryFilter filter, GridQueryCancel cancel) throws IgniteCheckedException
schemaName - Schema name.cacheName - Cache name.qry - Query.alias - Table alias.params - Query parameters.type - Query return type.filter - Cache name and key filter. @return Queried rows.IgniteCheckedException - If failed.public <K,V> QueryCursor<javax.cache.Cache.Entry<K,V>> queryDistributedSql(String schemaName, String cacheName, SqlQuery qry, boolean keepBinary, int mainCacheId)
queryDistributedSql in interface GridQueryIndexingpublic List<FieldsQueryCursor<List<?>>> queryDistributedSqlFields(String schemaName, SqlFieldsQuery qry, boolean keepBinary, GridQueryCancel cancel, @Nullable Integer mainCacheId, boolean failOnMultipleStmts)
queryDistributedSqlFields in interface GridQueryIndexingpublic UpdateResult mapDistributedUpdate(String schemaName, SqlFieldsQuery fldsQry, IndexingQueryFilter filter, GridQueryCancel cancel, boolean local) throws IgniteCheckedException
schemaName - Schema name.fldsQry - Query.filter - Filter.cancel - Cancel state.local - Locality flag.IgniteCheckedException - if failed.public boolean registerType(GridCacheContext cctx, GridQueryTypeDescriptor type) throws IgniteCheckedException
registerType in interface GridQueryIndexingtype - Type description.IgniteCheckedException - In case of error.public GridH2Table dataTable(String schemaName, String tblName)
schemaName - Schema name.tblName - Table name.null if none found.public GridH2Table dataTable(QueryTable tbl)
tbl - Identifier.null if none found.public void removeDataTable(GridH2Table h2Tbl)
h2Tbl - Remove data table.public GridH2Table dataTableForIndex(String schemaName, String idxName)
schemaName - Schema name.idxName - Index name.null if index is not found.public String schema(String cacheName)
schema in interface GridQueryIndexingpublic boolean isInsertStatement(PreparedStatement nativeStmt)
isInsertStatement in interface GridQueryIndexingpublic void rebuildIndexesFromHash(String cacheName) throws IgniteCheckedException
rebuildIndexesFromHash in interface GridQueryIndexingcacheName - Cache name.IgniteCheckedException - If failed.public void markForRebuildFromHash(String cacheName)
markForRebuildFromHash in interface GridQueryIndexingpublic GridSpinBusyLock busyLock()
public GridMapQueryExecutor mapQueryExecutor()
public GridReduceQueryExecutor reduceQueryExecutor()
public void start(GridKernalContext ctx, GridSpinBusyLock busyLock) throws IgniteCheckedException
start in interface GridQueryIndexingIgniteCheckedExceptionpublic CacheObjectValueContext objectContext()
public boolean send(Object topic, int topicOrd, Collection<ClusterNode> nodes, Message msg, @Nullable IgniteBiClosure<ClusterNode,Message,Message> specialize, @Nullable IgniteInClosure2X<ClusterNode,Message> locNodeHnd, byte plc, boolean runLocParallel)
topic - Topic.topicOrd - Topic ordinal for GridTopic.nodes - Nodes.msg - Message.specialize - Optional closure to specialize message for each node.locNodeHnd - Handler for local node.plc - Policy identifying the executor service which will process message.runLocParallel - Run local handler in parallel thread.true If all messages sent successfully.public void stop()
throws IgniteCheckedException
stop in interface GridQueryIndexingIgniteCheckedExceptionpublic void registerCache(String cacheName, String schemaName, GridCacheContext<?,?> cctx) throws IgniteCheckedException
registerCache in interface GridQueryIndexingIgniteCheckedExceptionpublic void unregisterCache(String cacheName, boolean destroy)
unregisterCache in interface GridQueryIndexingpublic IndexingQueryFilter backupFilter(@Nullable AffinityTopologyVersion topVer, @Nullable int[] parts)
backupFilter in interface GridQueryIndexingpublic AffinityTopologyVersion readyTopologyVersion()
public void awaitForReadyTopologyVersion(AffinityTopologyVersion topVer) throws IgniteCheckedException
topVer - Topology version.IgniteCheckedException - If failed.public void onDisconnected(IgniteFuture<?> reconnectFut)
onDisconnected in interface GridQueryIndexingpublic Collection<GridRunningQueryInfo> runningQueries(long duration)
runningQueries in interface GridQueryIndexingpublic void cancelQueries(Collection<Long> queries)
cancelQueries in interface GridQueryIndexingpublic void cancelAllQueries()
cancelAllQueries in interface GridQueryIndexingpublic List<Integer> collectCacheIds(@Nullable Integer mainCacheId, GridCacheTwoStepQuery twoStepQry)
mainCacheId - Id of main cache.twoStepQry - Two-step query.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.3.0 Release Date : October 28 2017