Search in sources :

Example 6 with RowBaseIterator

use of io.mycat.api.collector.RowBaseIterator in project Mycat2 by MyCATApache.

the class MigrateUtil method register.

public static MigrateScheduler register(String name, List<MigrateJdbcInput> inputs, MigrateJdbcOutput output, MigrateController controller) {
    MigrateScheduler scheduler = MigrateScheduler.of(name, inputs, output, controller);
    schedulers.add(scheduler);
    controller.getFuture().onSuccess(event -> {
        RowBaseIterator list = list();
        LOGGER.info("----------------------------Migration-INFO-----------------------------------------------");
        List<Map<String, Object>> resultSetMap = list.getResultSetMap();
        for (Map<String, Object> stringObjectMap : resultSetMap) {
            LOGGER.info(stringObjectMap.toString());
        }
        LOGGER.info("-----------------------------------------------------------------------------------------");
        ScheduleUtil.getTimerFuture(() -> {
            schedulers.remove(scheduler);
            LOGGER.info("----------------------------Migration-REMOVE-{}---------------------------------------", scheduler.getName());
        }, 1, TimeUnit.HOURS);
    });
    return scheduler;
}
Also used : RowBaseIterator(io.mycat.api.collector.RowBaseIterator) ToString(groovy.transform.ToString)

Example 7 with RowBaseIterator

use of io.mycat.api.collector.RowBaseIterator in project Mycat2 by MyCATApache.

the class HeartbeatCollector method collect.

@Override
public List<MetricFamilySamples> collect() {
    try {
        RowBaseIterator rowBaseIterator = HintHandler.showHeatbeatStat();
        List<String> columnList = ImmutableList.of("NAME");
        List<Map<String, Object>> resultSetMap = rowBaseIterator.getResultSetMap();
        GaugeMetricFamily gaugeMetricFamily = new GaugeMetricFamily("heartbeat_stat", "heartbeat_stat", columnList);
        for (Map<String, Object> stringObjectMap : resultSetMap) {
            Timestamp LAST_SEND_QUERY_TIME = Timestamp.valueOf((java.time.LocalDateTime) stringObjectMap.get("LAST_SEND_QUERY_TIME"));
            Timestamp LAST_RECEIVED_QUERY_TIME = Timestamp.valueOf((java.time.LocalDateTime) stringObjectMap.get("LAST_RECEIVED_QUERY_TIME"));
            // 查询时间之差
            long l = LAST_RECEIVED_QUERY_TIME.getTime() - LAST_SEND_QUERY_TIME.getTime();
            List<String> collect = columnList.stream().map(i -> stringObjectMap.get(i)).map(i -> Objects.toString(i)).collect(Collectors.toList());
            gaugeMetricFamily.addMetric(collect, l);
        }
        return ImmutableList.of(gaugeMetricFamily);
    } catch (Throwable e) {
        LOGGER.error("", e);
        throw e;
    }
}
Also used : java.util(java.util) Collector(io.prometheus.client.Collector) Logger(org.slf4j.Logger) ImmutableList(com.google.common.collect.ImmutableList) Timestamp(java.sql.Timestamp) LoggerFactory(org.slf4j.LoggerFactory) RowBaseIterator(io.mycat.api.collector.RowBaseIterator) GaugeMetricFamily(io.prometheus.client.GaugeMetricFamily) HintHandler(io.mycat.sqlhandler.dql.HintHandler) Collectors(java.util.stream.Collectors) Timestamp(java.sql.Timestamp) GaugeMetricFamily(io.prometheus.client.GaugeMetricFamily) RowBaseIterator(io.mycat.api.collector.RowBaseIterator)

Example 8 with RowBaseIterator

use of io.mycat.api.collector.RowBaseIterator in project Mycat2 by MyCATApache.

the class PrototypeService method getCreateTableSQLByJDBC.

public Optional<String> getCreateTableSQLByJDBC(String schemaName, String tableName, List<Partition> backends) {
    Optional<JdbcConnectionManager> jdbcConnectionManagerOptional = getPrototypeConnectionManager();
    if (!jdbcConnectionManagerOptional.isPresent()) {
        return Optional.empty();
    }
    JdbcConnectionManager jdbcConnectionManager = jdbcConnectionManagerOptional.get();
    backends = new ArrayList<>(backends);
    backends.add(new BackendTableInfo(PROTOTYPE, schemaName, tableName));
    if (backends == null || backends.isEmpty()) {
        return Optional.empty();
    }
    for (Partition backend : backends) {
        try {
            Partition backendTableInfo = backend;
            String targetName = backendTableInfo.getTargetName();
            String targetSchemaTable = backendTableInfo.getTargetSchemaTable();
            try (DefaultConnection connection = jdbcConnectionManager.getConnection(targetName)) {
                String sql = "SHOW CREATE TABLE `" + backendTableInfo.getSchema() + "`.`" + backendTableInfo.getTable() + "`";
                SQLStatement sqlStatement = null;
                try (RowBaseIterator rowBaseIterator = connection.executeQuery(sql)) {
                    rowBaseIterator.next();
                    String string = rowBaseIterator.getString(1);
                    sqlStatement = SQLUtils.parseSingleMysqlStatement(string);
                    if (sqlStatement instanceof MySqlCreateTableStatement) {
                        MySqlCreateTableStatement sqlStatement1 = (MySqlCreateTableStatement) sqlStatement;
                        sqlStatement1.setTableName("`" + SQLUtils.normalize(tableName) + "`");
                        // 顺序不能颠倒
                        sqlStatement1.setSchema("`" + SQLUtils.normalize(schemaName) + "`");
                        return Optional.of(sqlStatement1.toString());
                    }
                } catch (Exception e) {
                    LOGGER.error("", e);
                }
                if (sqlStatement == null || !(sqlStatement instanceof SQLCreateTableStatement)) {
                    try (RowBaseIterator rowBaseIterator = connection.executeQuery("select * from `" + backendTableInfo.getSchema() + "`.`" + backendTableInfo.getTable() + "` where 0 limit 0")) {
                        MycatRowMetaData metaData = rowBaseIterator.getMetaData();
                        String createTableSql = generateSql(schemaName, tableName, metaData.metaData());
                        return Optional.of(createTableSql);
                    }
                }
                continue;
            } catch (Exception e) {
                LOGGER.error("", e);
            }
            continue;
        } catch (Throwable e) {
            LOGGER.error("can not get create table sql from:" + backend.getTargetName() + backend.getTargetSchemaTable(), e);
            continue;
        }
    }
    return Optional.empty();
}
Also used : SQLStatement(com.alibaba.druid.sql.ast.SQLStatement) DefaultConnection(io.mycat.datasource.jdbc.datasource.DefaultConnection) JdbcConnectionManager(io.mycat.datasource.jdbc.datasource.JdbcConnectionManager) RowBaseIterator(io.mycat.api.collector.RowBaseIterator) MycatRowMetaData(io.mycat.beans.mycat.MycatRowMetaData) CopyMycatRowMetaData(io.mycat.beans.mycat.CopyMycatRowMetaData)

Example 9 with RowBaseIterator

use of io.mycat.api.collector.RowBaseIterator in project Mycat2 by MyCATApache.

the class HintHandler method showHeatbeatStat.

public static RowBaseIterator showHeatbeatStat() {
    ResultSetBuilder resultSetBuilder = ResultSetBuilder.create();
    resultSetBuilder.addColumnInfo("NAME", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("TYPE", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("READABLE", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("SESSION_COUNT", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("WEIGHT", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("ALIVE", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("MASTER", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("LIMIT_SESSION_COUNT", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("REPLICA", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("SLAVE_THRESHOLD", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("IS_HEARTBEAT_TIMEOUT", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("HB_ERROR_COUNT", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("HB_LAST_SWITCH_TIME", JDBCType.TIMESTAMP);
    resultSetBuilder.addColumnInfo("HB_MAX_RETRY", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("IS_CHECKING", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("MIN_SWITCH_TIME_INTERVAL", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("HEARTBEAT_TIMEOUT", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("SYNC_DS_STATUS", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("HB_DS_STATUS", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("IS_SLAVE_BEHIND_MASTER", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("LAST_SEND_QUERY_TIME", JDBCType.TIMESTAMP);
    resultSetBuilder.addColumnInfo("LAST_RECEIVED_QUERY_TIME", JDBCType.TIMESTAMP);
    if (MetaClusterCurrent.exist(MycatRouterConfig.class) && MetaClusterCurrent.exist(ReplicaSelectorManager.class)) {
        MycatRouterConfig routerConfig = MetaClusterCurrent.wrapper(MycatRouterConfig.class);
        ReplicaSelectorManager replicaSelectorRuntime = MetaClusterCurrent.wrapper(ReplicaSelectorManager.class);
        Map<String, DatasourceConfig> dataSourceConfig = routerConfig.getDatasources().stream().collect(Collectors.toMap(k -> k.getName(), v -> v));
        for (HeartbeatFlow heartbeatFlow : replicaSelectorRuntime.getHeartbeatDetectorMap().values()) {
            PhysicsInstance instance = heartbeatFlow.instance();
            String NAME = instance.getName();
            String TYPE = instance.getType().name();
            boolean READABLE = instance.asSelectRead();
            int SESSION_COUNT = instance.getSessionCounter();
            int WEIGHT = instance.getWeight();
            boolean ALIVE = instance.isAlive();
            boolean MASTER = instance.isMaster();
            double SLAVE_THRESHOLD = heartbeatFlow.getSlaveThreshold();
            boolean IS_HEARTBEAT_TIMEOUT = heartbeatFlow.isHeartbeatTimeout();
            final HeartBeatStatus HEART_BEAT_STATUS = heartbeatFlow.getHbStatus();
            int HB_ERROR_COUNT = HEART_BEAT_STATUS.getErrorCount();
            LocalDateTime HB_LAST_SWITCH_TIME = new Timestamp(HEART_BEAT_STATUS.getLastSwitchTime()).toLocalDateTime();
            int HB_MAX_RETRY = HEART_BEAT_STATUS.getMaxRetry();
            boolean IS_CHECKING = HEART_BEAT_STATUS.isChecking();
            long MIN_SWITCH_TIME_INTERVAL = HEART_BEAT_STATUS.getMinSwitchTimeInterval();
            final long HEARTBEAT_TIMEOUT = (heartbeatFlow.getHeartbeatTimeout());
            DatasourceStatus DS_STATUS_OBJECT = heartbeatFlow.getDsStatus();
            String SYNC_DS_STATUS = DS_STATUS_OBJECT.getDbSynStatus().name();
            String HB_DS_STATUS = DS_STATUS_OBJECT.getStatus().name();
            boolean IS_SLAVE_BEHIND_MASTER = DS_STATUS_OBJECT.isSlaveBehindMaster();
            LocalDateTime LAST_SEND_QUERY_TIME = new Timestamp(heartbeatFlow.getLastSendQryTime()).toLocalDateTime();
            LocalDateTime LAST_RECEIVED_QUERY_TIME = new Timestamp(heartbeatFlow.getLastReceivedQryTime()).toLocalDateTime();
            Optional<DatasourceConfig> e = Optional.ofNullable(dataSourceConfig.get(NAME));
            String replicaDataSourceSelectorList = String.join(",", replicaSelectorRuntime.getReplicaNameListByInstanceName(NAME));
            resultSetBuilder.addObjectRowPayload(Arrays.asList(NAME, TYPE, READABLE, SESSION_COUNT, WEIGHT, ALIVE, MASTER, e.map(i -> i.getMaxCon()).orElse(-1), replicaDataSourceSelectorList, SLAVE_THRESHOLD, IS_HEARTBEAT_TIMEOUT, HB_ERROR_COUNT, HB_LAST_SWITCH_TIME, HB_MAX_RETRY, IS_CHECKING, MIN_SWITCH_TIME_INTERVAL, HEARTBEAT_TIMEOUT, SYNC_DS_STATUS, HB_DS_STATUS, IS_SLAVE_BEHIND_MASTER, LAST_SEND_QUERY_TIME, LAST_RECEIVED_QUERY_TIME));
        }
    }
    RowBaseIterator rowBaseIterator = resultSetBuilder.build();
    return rowBaseIterator;
}
Also used : ReplicaSelectorManager(io.mycat.replica.ReplicaSelectorManager) MycatdbCommand(io.mycat.commands.MycatdbCommand) io.mycat(io.mycat) CSVRecord(org.apache.commons.csv.CSVRecord) JdbcDataSource(io.mycat.datasource.jdbc.datasource.JdbcDataSource) CSVFormat(org.apache.commons.csv.CSVFormat) HeartbeatFlow(io.mycat.replica.heartbeat.HeartbeatFlow) Duration(java.time.Duration) MySQLErrorCode(io.mycat.beans.mysql.MySQLErrorCode) JsonUtil(io.mycat.util.JsonUtil) MySqlHintStatement(com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlHintStatement) io.mycat.config(io.mycat.config) Timestamp(java.sql.Timestamp) Reader(java.io.Reader) Future(io.vertx.core.Future) Collectors(java.util.stream.Collectors) ArrayBindable(org.apache.calcite.runtime.ArrayBindable) MycatSQLLogMonitor(io.mycat.monitor.MycatSQLLogMonitor) io.mycat.sqlhandler(io.mycat.sqlhandler) NormalTable(io.mycat.calcite.table.NormalTable) Nullable(org.jetbrains.annotations.Nullable) ReplicaSelector(io.mycat.replica.ReplicaSelector) UpdateSQLHandler(io.mycat.sqlhandler.dml.UpdateSQLHandler) Stream(java.util.stream.Stream) ReplicaSelectorManager(io.mycat.replica.ReplicaSelectorManager) DrdsRunnerHelper(io.mycat.calcite.DrdsRunnerHelper) PhysicsInstance(io.mycat.replica.PhysicsInstance) NotNull(org.jetbrains.annotations.NotNull) ShardingTable(io.mycat.calcite.table.ShardingTable) VertxExecuter(io.mycat.vertx.VertxExecuter) SqlEntry(io.mycat.monitor.SqlEntry) java.util(java.util) ResultSetBuilder(io.mycat.beans.mycat.ResultSetBuilder) SQLIdentifierExpr(com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr) LocalDateTime(java.time.LocalDateTime) XaLog(cn.mycat.vertx.xa.XaLog) DefaultConnection(io.mycat.datasource.jdbc.datasource.DefaultConnection) Supplier(java.util.function.Supplier) Iterators(com.google.common.collect.Iterators) SqlResultSetService(io.mycat.commands.SqlResultSetService) MycatSQLExprTableSourceUtil(io.mycat.util.MycatSQLExprTableSourceUtil) Schedulers(io.reactivex.rxjava3.schedulers.Schedulers) JDBCType(java.sql.JDBCType) PrepareExecutor(io.mycat.calcite.PrepareExecutor) SchemaHandler(io.mycat.calcite.table.SchemaHandler) MySqlInsertStatement(com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlInsertStatement) ImmutableList(com.google.common.collect.ImmutableList) DatasourceStatus(io.mycat.replica.heartbeat.DatasourceStatus) Observable(io.reactivex.rxjava3.core.Observable) JdbcConnectionManager(io.mycat.datasource.jdbc.datasource.JdbcConnectionManager) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) RowBaseIterator(io.mycat.api.collector.RowBaseIterator) StreamSupport(java.util.stream.StreamSupport) GlobalTable(io.mycat.calcite.table.GlobalTable) SQLVariantRefExpr(com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr) SQLUtils(com.alibaba.druid.sql.SQLUtils) Flowable(io.reactivex.rxjava3.core.Flowable) PromiseInternal(io.vertx.core.impl.future.PromiseInternal) io.mycat.hint(io.mycat.hint) VertxUpdateExecuter(io.mycat.vertx.VertxUpdateExecuter) StringWriter(java.io.StringWriter) SQLInsertStatement(com.alibaba.druid.sql.ast.statement.SQLInsertStatement) ExecutorProvider(io.mycat.calcite.ExecutorProvider) IOException(java.io.IOException) QuoteMode(org.apache.commons.csv.QuoteMode) SQLCommentHint(com.alibaba.druid.sql.ast.SQLCommentHint) SqlRecorderRuntime(io.mycat.exporter.SqlRecorderRuntime) VertxUtil(io.mycat.util.VertxUtil) ReplicaSwitchType(io.mycat.replica.ReplicaSwitchType) SQLCharExpr(com.alibaba.druid.sql.ast.expr.SQLCharExpr) MycatInsertRel(io.mycat.calcite.physical.MycatInsertRel) io.mycat.calcite.spm(io.mycat.calcite.spm) NameMap(io.mycat.util.NameMap) MysqlPayloadObject(io.mycat.api.collector.MysqlPayloadObject) JdbcUtils(com.alibaba.druid.util.JdbcUtils) CodeExecuterContext(io.mycat.calcite.CodeExecuterContext) HeartBeatStatus(io.mycat.replica.heartbeat.HeartBeatStatus) SQLStatement(com.alibaba.druid.sql.ast.SQLStatement) UnmodifiableIterator(com.google.common.collect.UnmodifiableIterator) FileReader(java.io.FileReader) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource) StorageManager(io.mycat.sqlhandler.config.StorageManager) LocalDateTime(java.time.LocalDateTime) ResultSetBuilder(io.mycat.beans.mycat.ResultSetBuilder) HeartbeatFlow(io.mycat.replica.heartbeat.HeartbeatFlow) Timestamp(java.sql.Timestamp) io.mycat.hint(io.mycat.hint) SQLCommentHint(com.alibaba.druid.sql.ast.SQLCommentHint) HeartBeatStatus(io.mycat.replica.heartbeat.HeartBeatStatus) DatasourceStatus(io.mycat.replica.heartbeat.DatasourceStatus) PhysicsInstance(io.mycat.replica.PhysicsInstance) RowBaseIterator(io.mycat.api.collector.RowBaseIterator)

Example 10 with RowBaseIterator

use of io.mycat.api.collector.RowBaseIterator in project Mycat2 by MyCATApache.

the class HintHandler method showInstances.

public static RowBaseIterator showInstances() {
    MycatRouterConfig routerConfig = MetaClusterCurrent.wrapper(MycatRouterConfig.class);
    ReplicaSelectorManager replicaSelectorRuntime = MetaClusterCurrent.wrapper(ReplicaSelectorManager.class);
    ResultSetBuilder resultSetBuilder = ResultSetBuilder.create();
    resultSetBuilder.addColumnInfo("NAME", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("ALIVE", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("READABLE", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("TYPE", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("SESSION_COUNT", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("WEIGHT", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("MASTER", JDBCType.VARCHAR);
    resultSetBuilder.addColumnInfo("LIMIT_SESSION_COUNT", JDBCType.BIGINT);
    resultSetBuilder.addColumnInfo("REPLICA", JDBCType.VARCHAR);
    Collection<PhysicsInstance> values = replicaSelectorRuntime.getPhysicsInstances();
    Map<String, DatasourceConfig> dataSourceConfig = routerConfig.getDatasources().stream().collect(Collectors.toMap(k -> k.getName(), v -> v));
    for (PhysicsInstance instance : values) {
        String NAME = instance.getName();
        String TYPE = instance.getType().name();
        boolean READABLE = instance.asSelectRead();
        int SESSION_COUNT = instance.getSessionCounter();
        int WEIGHT = instance.getWeight();
        boolean ALIVE = instance.isAlive();
        boolean MASTER = instance.isMaster();
        Optional<DatasourceConfig> e = Optional.ofNullable(dataSourceConfig.get(NAME));
        String replicaDataSourceSelectorList = String.join(",", replicaSelectorRuntime.getReplicaNameListByInstanceName(NAME));
        resultSetBuilder.addObjectRowPayload(Arrays.asList(NAME, ALIVE, READABLE, TYPE, SESSION_COUNT, WEIGHT, MASTER, e.map(i -> i.getMaxCon()).orElse(-1), replicaDataSourceSelectorList));
    }
    RowBaseIterator rowBaseIterator = resultSetBuilder.build();
    return rowBaseIterator;
}
Also used : ReplicaSelectorManager(io.mycat.replica.ReplicaSelectorManager) MycatdbCommand(io.mycat.commands.MycatdbCommand) io.mycat(io.mycat) CSVRecord(org.apache.commons.csv.CSVRecord) JdbcDataSource(io.mycat.datasource.jdbc.datasource.JdbcDataSource) CSVFormat(org.apache.commons.csv.CSVFormat) HeartbeatFlow(io.mycat.replica.heartbeat.HeartbeatFlow) Duration(java.time.Duration) MySQLErrorCode(io.mycat.beans.mysql.MySQLErrorCode) JsonUtil(io.mycat.util.JsonUtil) MySqlHintStatement(com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlHintStatement) io.mycat.config(io.mycat.config) Timestamp(java.sql.Timestamp) Reader(java.io.Reader) Future(io.vertx.core.Future) Collectors(java.util.stream.Collectors) ArrayBindable(org.apache.calcite.runtime.ArrayBindable) MycatSQLLogMonitor(io.mycat.monitor.MycatSQLLogMonitor) io.mycat.sqlhandler(io.mycat.sqlhandler) NormalTable(io.mycat.calcite.table.NormalTable) Nullable(org.jetbrains.annotations.Nullable) ReplicaSelector(io.mycat.replica.ReplicaSelector) UpdateSQLHandler(io.mycat.sqlhandler.dml.UpdateSQLHandler) Stream(java.util.stream.Stream) ReplicaSelectorManager(io.mycat.replica.ReplicaSelectorManager) DrdsRunnerHelper(io.mycat.calcite.DrdsRunnerHelper) PhysicsInstance(io.mycat.replica.PhysicsInstance) NotNull(org.jetbrains.annotations.NotNull) ShardingTable(io.mycat.calcite.table.ShardingTable) VertxExecuter(io.mycat.vertx.VertxExecuter) SqlEntry(io.mycat.monitor.SqlEntry) java.util(java.util) ResultSetBuilder(io.mycat.beans.mycat.ResultSetBuilder) SQLIdentifierExpr(com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr) LocalDateTime(java.time.LocalDateTime) XaLog(cn.mycat.vertx.xa.XaLog) DefaultConnection(io.mycat.datasource.jdbc.datasource.DefaultConnection) Supplier(java.util.function.Supplier) Iterators(com.google.common.collect.Iterators) SqlResultSetService(io.mycat.commands.SqlResultSetService) MycatSQLExprTableSourceUtil(io.mycat.util.MycatSQLExprTableSourceUtil) Schedulers(io.reactivex.rxjava3.schedulers.Schedulers) JDBCType(java.sql.JDBCType) PrepareExecutor(io.mycat.calcite.PrepareExecutor) SchemaHandler(io.mycat.calcite.table.SchemaHandler) MySqlInsertStatement(com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlInsertStatement) ImmutableList(com.google.common.collect.ImmutableList) DatasourceStatus(io.mycat.replica.heartbeat.DatasourceStatus) Observable(io.reactivex.rxjava3.core.Observable) JdbcConnectionManager(io.mycat.datasource.jdbc.datasource.JdbcConnectionManager) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) RowBaseIterator(io.mycat.api.collector.RowBaseIterator) StreamSupport(java.util.stream.StreamSupport) GlobalTable(io.mycat.calcite.table.GlobalTable) SQLVariantRefExpr(com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr) SQLUtils(com.alibaba.druid.sql.SQLUtils) Flowable(io.reactivex.rxjava3.core.Flowable) PromiseInternal(io.vertx.core.impl.future.PromiseInternal) io.mycat.hint(io.mycat.hint) VertxUpdateExecuter(io.mycat.vertx.VertxUpdateExecuter) StringWriter(java.io.StringWriter) SQLInsertStatement(com.alibaba.druid.sql.ast.statement.SQLInsertStatement) ExecutorProvider(io.mycat.calcite.ExecutorProvider) IOException(java.io.IOException) QuoteMode(org.apache.commons.csv.QuoteMode) SQLCommentHint(com.alibaba.druid.sql.ast.SQLCommentHint) SqlRecorderRuntime(io.mycat.exporter.SqlRecorderRuntime) VertxUtil(io.mycat.util.VertxUtil) ReplicaSwitchType(io.mycat.replica.ReplicaSwitchType) SQLCharExpr(com.alibaba.druid.sql.ast.expr.SQLCharExpr) MycatInsertRel(io.mycat.calcite.physical.MycatInsertRel) io.mycat.calcite.spm(io.mycat.calcite.spm) NameMap(io.mycat.util.NameMap) MysqlPayloadObject(io.mycat.api.collector.MysqlPayloadObject) JdbcUtils(com.alibaba.druid.util.JdbcUtils) CodeExecuterContext(io.mycat.calcite.CodeExecuterContext) HeartBeatStatus(io.mycat.replica.heartbeat.HeartBeatStatus) SQLStatement(com.alibaba.druid.sql.ast.SQLStatement) UnmodifiableIterator(com.google.common.collect.UnmodifiableIterator) FileReader(java.io.FileReader) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource) StorageManager(io.mycat.sqlhandler.config.StorageManager) ResultSetBuilder(io.mycat.beans.mycat.ResultSetBuilder) io.mycat.hint(io.mycat.hint) SQLCommentHint(com.alibaba.druid.sql.ast.SQLCommentHint) PhysicsInstance(io.mycat.replica.PhysicsInstance) RowBaseIterator(io.mycat.api.collector.RowBaseIterator)

Aggregations

RowBaseIterator (io.mycat.api.collector.RowBaseIterator)29 ResultSetBuilder (io.mycat.beans.mycat.ResultSetBuilder)13 java.util (java.util)12 Collectors (java.util.stream.Collectors)12 DefaultConnection (io.mycat.datasource.jdbc.datasource.DefaultConnection)11 JdbcConnectionManager (io.mycat.datasource.jdbc.datasource.JdbcConnectionManager)11 ReplicaSelectorManager (io.mycat.replica.ReplicaSelectorManager)10 Future (io.vertx.core.Future)9 JDBCType (java.sql.JDBCType)9 Timestamp (java.sql.Timestamp)9 LocalDateTime (java.time.LocalDateTime)9 NotNull (org.jetbrains.annotations.NotNull)9 SQLStatement (com.alibaba.druid.sql.ast.SQLStatement)8 io.mycat.config (io.mycat.config)8 IOException (java.io.IOException)8 Logger (org.slf4j.Logger)8 LoggerFactory (org.slf4j.LoggerFactory)8 ImmutableList (com.google.common.collect.ImmutableList)7 SQLUtils (com.alibaba.druid.sql.SQLUtils)6 SneakyThrows (lombok.SneakyThrows)6