Search in sources :

Example 6 with SQLJob

use of com.actiontech.dble.sqlengine.SQLJob in project dble by actiontech.

the class AbstractTableMetaHandler method execute.

public void execute() {
    for (String dataNode : dataNodes) {
        if (selfNode != null && selfNode.contains(dataNode)) {
            this.countdown();
            return;
        }
        OneRawSQLQueryResultHandler resultHandler = new OneRawSQLQueryResultHandler(MYSQL_SHOW_CREATE_TABLE_COLS, new MySQLTableStructureListener(dataNode, System.currentTimeMillis(), new ConcurrentHashMap<String, List<String>>()));
        PhysicalDBNode dn = DbleServer.getInstance().getConfig().getDataNodes().get(dataNode);
        SQLJob sqlJob = new SQLJob(SQL_PREFIX + tableName, dn.getDatabase(), resultHandler, dn.getDbPool().getSource());
        sqlJob.run();
    }
}
Also used : OneRawSQLQueryResultHandler(com.actiontech.dble.sqlengine.OneRawSQLQueryResultHandler) PhysicalDBNode(com.actiontech.dble.backend.datasource.PhysicalDBNode) SQLJob(com.actiontech.dble.sqlengine.SQLJob) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 7 with SQLJob

use of com.actiontech.dble.sqlengine.SQLJob in project dble by actiontech.

the class ShowTablesHandler method execute.

public void execute() {
    PhysicalDBNode dn = DbleServer.getInstance().getConfig().getDataNodes().get(config.getDataNode());
    String mysqlShowTableCol = "Tables_in_" + dn.getDatabase();
    String[] mysqlShowTableCols = new String[] { mysqlShowTableCol };
    MultiRowSQLQueryResultHandler resultHandler = new MultiRowSQLQueryResultHandler(mysqlShowTableCols, new MySQLShowTablesListener(mysqlShowTableCol));
    SQLJob sqlJob = new SQLJob(SQL, dn.getDatabase(), resultHandler, dn.getDbPool().getSource());
    sqlJob.run();
}
Also used : PhysicalDBNode(com.actiontech.dble.backend.datasource.PhysicalDBNode) MultiRowSQLQueryResultHandler(com.actiontech.dble.sqlengine.MultiRowSQLQueryResultHandler) SQLJob(com.actiontech.dble.sqlengine.SQLJob)

Example 8 with SQLJob

use of com.actiontech.dble.sqlengine.SQLJob in project dble by actiontech.

the class VarsExtractorHandler method execute.

public SystemVariables execute() {
    Map.Entry<String, PhysicalDBNode> entry = dataNodes.entrySet().iterator().next();
    OneRawSQLQueryResultHandler resultHandler = new OneRawSQLQueryResultHandler(MYSQL_SHOW_VARIABLES_COLS, new MysqlVarsListener(this));
    PhysicalDBNode dn = entry.getValue();
    SQLJob sqlJob = new SQLJob(MYSQL_SHOW_VARIABLES, dn.getDatabase(), resultHandler, dn.getDbPool().getSource());
    sqlJob.run();
    waitDone();
    return systemVariables;
}
Also used : PhysicalDBNode(com.actiontech.dble.backend.datasource.PhysicalDBNode) OneRawSQLQueryResultHandler(com.actiontech.dble.sqlengine.OneRawSQLQueryResultHandler) SQLJob(com.actiontech.dble.sqlengine.SQLJob) Map(java.util.Map)

Example 9 with SQLJob

use of com.actiontech.dble.sqlengine.SQLJob in project dble by actiontech.

the class MySQLConsistencyChecker method checkInnerColumnExist.

/**
 * check inner column exist or not
 */
public void checkInnerColumnExist() {
    // ["db3","db2","db1"]
    lock.lock();
    try {
        this.jobCount.set(0);
        beginTime = new Date().getTime();
        for (String dbName : physicalSchemas) {
            MySQLConsistencyHelper detector = new MySQLConsistencyHelper(this, null, 1);
            OneRawSQLQueryResultHandler resultHandler = new OneRawSQLQueryResultHandler(new String[] { GlobalTableUtil.INNER_COLUMN }, detector);
            String db = " and table_schema='" + dbName + "'";
            SQLJob sqlJob = new SQLJob(this.columnExistSQL + db, dbName, resultHandler, source);
            // table_schema='db1'
            detector.setSqlJob(sqlJob);
            LOGGER.debug(sqlJob.toString());
            sqlJob.run();
            this.jobCount.incrementAndGet();
        }
    } finally {
        lock.unlock();
    }
}
Also used : OneRawSQLQueryResultHandler(com.actiontech.dble.sqlengine.OneRawSQLQueryResultHandler) SQLJob(com.actiontech.dble.sqlengine.SQLJob) Date(java.util.Date)

Example 10 with SQLJob

use of com.actiontech.dble.sqlengine.SQLJob in project dble by actiontech.

the class MySQLConsistencyChecker method checkMaxTimeStamp.

public void checkMaxTimeStamp() {
    // ["db3","db2","db1"]
    lock.lock();
    try {
        this.jobCount.set(0);
        beginTime = new Date().getTime();
        for (String dbName : physicalSchemas) {
            MySQLConsistencyHelper detector = new MySQLConsistencyHelper(this, null);
            OneRawSQLQueryResultHandler resultHandler = new OneRawSQLQueryResultHandler(new String[] { GlobalTableUtil.MAX_COLUMN }, detector);
            SQLJob sqlJob = new SQLJob(this.getMaxSQL(), dbName, resultHandler, source);
            detector.setSqlJob(sqlJob);
            sqlJob.run();
            this.jobCount.incrementAndGet();
        }
    } finally {
        lock.unlock();
    }
}
Also used : OneRawSQLQueryResultHandler(com.actiontech.dble.sqlengine.OneRawSQLQueryResultHandler) SQLJob(com.actiontech.dble.sqlengine.SQLJob) Date(java.util.Date)

Aggregations

SQLJob (com.actiontech.dble.sqlengine.SQLJob)11 OneRawSQLQueryResultHandler (com.actiontech.dble.sqlengine.OneRawSQLQueryResultHandler)8 PhysicalDBNode (com.actiontech.dble.backend.datasource.PhysicalDBNode)4 Date (java.util.Date)3 PhysicalDBPool (com.actiontech.dble.backend.datasource.PhysicalDBPool)1 PhysicalDatasource (com.actiontech.dble.backend.datasource.PhysicalDatasource)1 MySQLDataSource (com.actiontech.dble.backend.mysql.nio.MySQLDataSource)1 SchemaConfig (com.actiontech.dble.config.model.SchemaConfig)1 TableConfig (com.actiontech.dble.config.model.TableConfig)1 MultiRowSQLQueryResultHandler (com.actiontech.dble.sqlengine.MultiRowSQLQueryResultHandler)1 SQLQueryResult (com.actiontech.dble.sqlengine.SQLQueryResult)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1