use of io.mycat.sqlengine.SQLJob in project Mycat-Server by MyCATApache.
the class MySQLConsistencyChecker method checkRecordCout.
public void checkRecordCout() {
// ["db3","db2","db1"]
lock.lock();
try {
this.jobCount.set(0);
beginTime = new Date().getTime();
String[] physicalSchemas = source.getDbPool().getSchemas();
for (String dbName : physicalSchemas) {
MySQLConsistencyHelper detector = new MySQLConsistencyHelper(this, null);
OneRawSQLQueryResultHandler resultHandler = new OneRawSQLQueryResultHandler(new String[] { GlobalTableUtil.COUNT_COLUMN }, detector);
SQLJob sqlJob = new SQLJob(this.getCountSQL(), dbName, resultHandler, source);
detector.setSqlJob(sqlJob);
sqlJob.run();
this.jobCount.incrementAndGet();
}
} finally {
lock.unlock();
}
}
use of io.mycat.sqlengine.SQLJob in project Mycat-Server by MyCATApache.
the class MySQLDetector method close.
public void close(String msg) {
SQLJob curJob = sqlJob;
if (curJob != null && !curJob.isFinished()) {
curJob.teminate(msg);
sqlJob = null;
}
}
use of io.mycat.sqlengine.SQLJob in project Mycat-Server by MyCATApache.
the class PostgreSQLDetector method heartbeat.
public void heartbeat() {
lastSendQryTime = System.currentTimeMillis();
PostgreSQLDataSource ds = heartbeat.getSource();
String databaseName = ds.getDbPool().getSchemas()[0];
String[] fetchColms = {};
if (heartbeat.getSource().getHostConfig().isShowSlaveSql()) {
fetchColms = MYSQL_SLAVE_STAUTS_COLMS;
}
OneRawSQLQueryResultHandler resultHandler = new OneRawSQLQueryResultHandler(fetchColms, this);
sqlJob = new SQLJob(heartbeat.getHeartbeatSQL(), databaseName, resultHandler, ds);
sqlJob.run();
}
use of io.mycat.sqlengine.SQLJob in project Mycat-Server by MyCATApache.
the class MySQLTableStructureDetector method run.
@Override
public void run() {
for (SchemaConfig schema : MycatServer.getInstance().getConfig().getSchemas().values()) {
for (TableConfig table : schema.getTables().values()) {
for (String dataNode : table.getDataNodes()) {
try {
table.getReentrantReadWriteLock().writeLock().lock();
ConcurrentHashMap<String, List<String>> map = new ConcurrentHashMap<>();
table.setDataNodeTableStructureSQLMap(map);
} finally {
table.getReentrantReadWriteLock().writeLock().unlock();
}
OneRawSQLQueryResultHandler resultHandler = new OneRawSQLQueryResultHandler(MYSQL_SHOW_CREATE_TABLE_COLMS, new MySQLTableStructureListener(dataNode, table));
resultHandler.setMark("Table Structure");
PhysicalDBNode dn = MycatServer.getInstance().getConfig().getDataNodes().get(dataNode);
SQLJob sqlJob = new SQLJob(sqlPrefix + table.getName(), dn.getDatabase(), resultHandler, dn.getDbPool().getSource());
sqlJob.run();
}
}
}
}
use of io.mycat.sqlengine.SQLJob in project Mycat-Server by MyCATApache.
the class SqlExecuteListener method close.
public void close(String msg) {
SQLJob curJob = sqlJob;
if (curJob != null) {
curJob.teminate(msg);
sqlJob = null;
}
}
Aggregations