public class IgniteH2Indexing extends Object
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 Pattern |
INTERNAL_CMD_RE
A pattern for commands having internal implementation in Ignite.
|
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 |
|---|---|
boolean |
autoStartTx(SqlFieldsQuery qry) |
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) |
void |
checkStatementStreamable(PreparedStatement nativeStmt) |
List<Integer> |
collectCacheIds(Integer mainCacheId,
GridCacheTwoStepQuery twoStepQry)
Collect cache identifiers from two-step query.
|
Connection |
connectionForSchema(String schema) |
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.
|
ThreadLocalObjectPool.Reusable<H2ConnectionWrapper> |
detach()
Removes from cache and returns associated with current thread connection.
|
void |
dynamicAddColumn(String schemaName,
String tblName,
List<QueryField> cols,
boolean ifTblExists,
boolean ifColNotExists) |
void |
dynamicDropColumn(String schemaName,
String tblName,
List<String> cols,
boolean ifTblExists,
boolean ifColExists) |
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..
|
ResultSet |
executeSqlQueryWithTimer(PreparedStatement stmt,
Connection conn,
String sql,
Collection<Object> params,
int timeoutMillis,
GridQueryCancel cancel)
Executes sql query and prints warning if query is too slow.
|
void |
executeStatement(String schema,
String sql) |
void |
executeSystemStatement(String sql)
Execute statement on H2 INFORMATION_SCHEMA.
|
GridKernalContext |
kernalContext() |
UpdateResult |
mapDistributedUpdate(String schemaName,
SqlFieldsQuery fldsQry,
IndexingQueryFilter filter,
GridQueryCancel cancel,
boolean local)
Run DML request from other node.
|
GridMapQueryExecutor |
mapQueryExecutor() |
CacheObjectValueContext |
objectContext() |
void |
onClientDisconnect() |
void |
onDisconnected(<any> reconnectFut) |
static int |
operationTimeout(int qryTimeout,
IgniteTxAdapter tx) |
Map<Thread,?> |
perThreadConnections() |
<any> |
prepareDistributedUpdate(<any> cctx,
int[] ids,
int[] parts,
String schema,
String qry,
Object[] params,
int flags,
int pageSize,
int timeout,
AffinityTopologyVersion topVer,
MvccSnapshot mvccSnapshot,
GridQueryCancel cancel) |
PreparedStatement |
preparedStatementWithParams(Connection conn,
String sql,
Collection<Object> params,
boolean useStmtCache)
Prepares sql statement.
|
PreparedStatement |
prepareNativeStatement(String schemaName,
String sql) |
PreparedStatement |
prepareStatement(Connection c,
String sql,
boolean useStmtCache) |
<K,V> <any> |
queryDistributedSql(String schemaName,
String cacheName,
SqlQuery qry,
boolean keepBinary) |
<K,V> <any> |
queryLocalSql(String schemaName,
String cacheName,
SqlQuery qry,
IndexingQueryFilter filter,
boolean keepBinary) |
<any> |
queryLocalSqlFields(String schemaName,
SqlFieldsQuery qry,
boolean keepBinary,
IndexingQueryFilter filter,
GridQueryCancel cancel) |
GridQueryFieldsResult |
queryLocalSqlFields(String schemaName,
String qry,
Collection<Object> params,
IndexingQueryFilter filter,
boolean enforceJoinOrder,
boolean startTx,
int timeout,
GridQueryCancel cancel)
Queries individual fields (generally used by JDBC drivers).
|
<K,V> <any> |
queryLocalText(String schemaName,
String cacheName,
String qry,
String typeName,
IndexingQueryFilter filters) |
List<<any>> |
querySqlFields(String schemaName,
SqlFieldsQuery qry,
SqlClientContext cliCtx,
boolean keepBinary,
boolean failOnMultipleStmts,
MvccQueryTracker tracker,
GridQueryCancel cancel) |
AffinityTopologyVersion |
readyTopologyVersion() |
<any> |
rebuildIndexesFromHash(GridCacheContext cctx) |
protected void |
rebuildIndexesFromHash0(GridCacheContext cctx,
SchemaIndexCacheVisitorClosure clo)
Do index rebuild.
|
GridReduceQueryExecutor |
reduceQueryExecutor() |
void |
registerCache(String cacheName,
String schemaName,
<any> cctx) |
boolean |
registerType(GridCacheContext cctx,
GridQueryTypeDescriptor type)
Registers new class description.
|
void |
remove(GridCacheContext cctx,
GridQueryTypeDescriptor type,
CacheDataRow row) |
void |
removeDataTable(GridH2Table h2Tbl) |
GridQueryRowCacheCleaner |
rowCacheCleaner(int grpId) |
Collection<GridRunningQueryInfo> |
runningQueries(long duration) |
String |
schema(String cacheName) |
boolean |
send(Object topic,
int topicOrd,
Collection<ClusterNode> nodes,
Message msg,
<any> specialize,
<any> locNodeHnd,
byte plc,
boolean runLocParallel) |
boolean |
serverTopologyChanged(AffinityTopologyVersion readyVer) |
void |
start(GridKernalContext ctx,
GridSpinBusyLock busyLock) |
void |
stop() |
void |
store(GridCacheContext cctx,
GridQueryTypeDescriptor type,
CacheDataRow row,
CacheDataRow prevRow,
boolean prevRowAvailable) |
List<Long> |
streamBatchedUpdateQuery(String schemaName,
String qry,
List<Object[]> params,
SqlClientContext cliCtx) |
long |
streamUpdateQuery(String schemaName,
String qry,
Object[] params,
<any> streamer) |
Collection<SqlSystemView> |
systemViews(GridKernalContext ctx) |
void |
unregisterCache(GridCacheContext cctx,
boolean rmvIdx) |
public static final Pattern INTERNAL_CMD_RE
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 prepareStatement(Connection c, String sql, boolean useStmtCache) throws SQLException
c - Connection.sql - SQL.useStmtCache - If true uses statement cache.SQLException - If failed.public PreparedStatement prepareNativeStatement(String schemaName, String sql)
public void executeStatement(String schema, String sql) throws IgniteCheckedException
schema - Schemasql - SQL statement.IgniteCheckedException - If failed.public void executeSystemStatement(String sql)
sql - SQL statement.public void store(GridCacheContext cctx,
GridQueryTypeDescriptor type,
CacheDataRow row,
CacheDataRow prevRow,
boolean prevRowAvailable)
throws IgniteCheckedException
IgniteCheckedExceptionpublic void remove(GridCacheContext cctx,
GridQueryTypeDescriptor type,
CacheDataRow row)
throws IgniteCheckedException
IgniteCheckedExceptionpublic void dynamicIndexCreate(String schemaName, String tblName, QueryIndexDescriptorImpl idxDesc, boolean ifNotExists, SchemaIndexCacheVisitor cacheVisitor) throws IgniteCheckedException
IgniteCheckedExceptionpublic void dynamicIndexDrop(String schemaName, String idxName, boolean ifExists) throws IgniteCheckedException
IgniteCheckedExceptionpublic void dynamicAddColumn(String schemaName, String tblName, List<QueryField> cols, boolean ifTblExists, boolean ifColNotExists) throws IgniteCheckedException
IgniteCheckedExceptionpublic void dynamicDropColumn(String schemaName, String tblName, List<String> cols, boolean ifTblExists, boolean ifColExists) throws IgniteCheckedException
IgniteCheckedExceptionpublic <K,V> <any> queryLocalText(String schemaName, String cacheName, String qry, String typeName, IndexingQueryFilter filters) throws IgniteCheckedException
IgniteCheckedExceptionpublic GridQueryFieldsResult queryLocalSqlFields(String schemaName, String qry, Collection<Object> params, IndexingQueryFilter filter, boolean enforceJoinOrder, boolean startTx, 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.startTx - Start transaction flag.timeout - Query timeout in milliseconds.cancel - Query cancel.IgniteCheckedException - If failed.public static int operationTimeout(int qryTimeout,
IgniteTxAdapter tx)
qryTimeout - Query timeout in milliseconds.tx - Transaction.public long streamUpdateQuery(String schemaName, String qry, Object[] params, <any> streamer) throws IgniteCheckedException
IgniteCheckedExceptionpublic List<Long> streamBatchedUpdateQuery(String schemaName, String qry, List<Object[]> params, SqlClientContext cliCtx) throws IgniteCheckedException
IgniteCheckedExceptionpublic PreparedStatement preparedStatementWithParams(Connection conn, String sql, Collection<Object> params, boolean useStmtCache) throws IgniteCheckedException
conn - Connection.sql - Sql.params - Params.useStmtCache - If true use stmt cache.IgniteCheckedException - If failed.public ResultSet executeSqlQueryWithTimer(Connection conn, String sql, Collection<Object> params, boolean useStmtCache, int timeoutMillis, GridQueryCancel cancel) throws IgniteCheckedException
conn - Connection,sql - Sql query.params - Parameters.useStmtCache - If true uses stmt cache.timeoutMillis - Query timeout.cancel - Query cancel.IgniteCheckedException - If failed.public ResultSet executeSqlQueryWithTimer(PreparedStatement stmt, Connection conn, String sql, Collection<Object> params, int timeoutMillis, GridQueryCancel cancel) throws IgniteCheckedException
stmt - Prepared statement for query.conn - Connection.sql - Sql query.params - Parameters.timeoutMillis - Query timeout.cancel - Query cancel.IgniteCheckedException - If failed.public void bindParameters(PreparedStatement stmt, Collection<Object> params) throws IgniteCheckedException
stmt - Prepared statement.params - Parameters collection.IgniteCheckedException - If failed.public <any> queryLocalSqlFields(String schemaName, SqlFieldsQuery qry, boolean keepBinary, IndexingQueryFilter filter, GridQueryCancel cancel) throws IgniteCheckedException
IgniteCheckedExceptionpublic <K,V> <any> queryLocalSql(String schemaName, String cacheName, SqlQuery qry, IndexingQueryFilter filter, boolean keepBinary) throws IgniteCheckedException
IgniteCheckedExceptionpublic <K,V> <any> queryDistributedSql(String schemaName, String cacheName, SqlQuery qry, boolean keepBinary)
public List<<any>> querySqlFields(String schemaName, SqlFieldsQuery qry, SqlClientContext cliCtx, boolean keepBinary, boolean failOnMultipleStmts, MvccQueryTracker tracker, GridQueryCancel cancel)
public boolean autoStartTx(SqlFieldsQuery qry)
qry - Sql fields query.autoStartTx(qry)True if need to start transaction.public <any> prepareDistributedUpdate(<any> cctx,
int[] ids,
int[] parts,
String schema,
String qry,
Object[] params,
int flags,
int pageSize,
int timeout,
AffinityTopologyVersion topVer,
MvccSnapshot mvccSnapshot,
GridQueryCancel cancel)
throws IgniteCheckedException
IgniteCheckedExceptionpublic 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
type - 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 void checkStatementStreamable(PreparedStatement nativeStmt)
public GridQueryRowCacheCleaner rowCacheCleaner(int grpId)
public ThreadLocalObjectPool.Reusable<H2ConnectionWrapper> detach()
public <any> rebuildIndexesFromHash(GridCacheContext cctx)
protected void rebuildIndexesFromHash0(GridCacheContext cctx,
SchemaIndexCacheVisitorClosure clo)
throws IgniteCheckedException
cctx - Cache context.clo - Closure.IgniteCheckedException - If failed.public GridSpinBusyLock busyLock()
public GridMapQueryExecutor mapQueryExecutor()
public GridReduceQueryExecutor reduceQueryExecutor()
public void start(GridKernalContext ctx,
GridSpinBusyLock busyLock)
throws IgniteCheckedException
IgniteCheckedExceptionpublic Collection<SqlSystemView> systemViews(GridKernalContext ctx)
ctx - Context.public CacheObjectValueContext objectContext()
public boolean send(Object topic, int topicOrd, Collection<ClusterNode> nodes, Message msg, <any> specialize, <any> 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()
public void onClientDisconnect()
throws IgniteCheckedException
IgniteCheckedExceptionpublic void registerCache(String cacheName, String schemaName, <any> cctx) throws IgniteCheckedException
IgniteCheckedExceptionpublic void unregisterCache(GridCacheContext cctx,
boolean rmvIdx)
public IndexingQueryFilter backupFilter(AffinityTopologyVersion topVer,
int[] parts)
public AffinityTopologyVersion readyTopologyVersion()
public boolean serverTopologyChanged(AffinityTopologyVersion readyVer)
readyVer - Ready topology version.true If pending distributed exchange exists because server topology is changed.public void awaitForReadyTopologyVersion(AffinityTopologyVersion topVer)
throws IgniteCheckedException
topVer - Topology version.IgniteCheckedException - If failed.public void onDisconnected(<any> reconnectFut)
public Collection<GridRunningQueryInfo> runningQueries(long duration)
public void cancelQueries(Collection<Long> queries)
public void cancelAllQueries()
public List<Integer> collectCacheIds(Integer mainCacheId, GridCacheTwoStepQuery twoStepQry)
mainCacheId - Id of main cache.twoStepQry - Two-step query.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2-p3 Release Date : April 25 2019