use of com.actiontech.dble.config.model.SystemConfig in project dble by actiontech.
the class ProxyMetaManager method initMeta.
public void initMeta(ServerConfig config) {
Set<String> selfNode = getSelfNodes(config);
SchemaMetaHandler handler = new SchemaMetaHandler(this, config, selfNode);
handler.execute();
if (DbleServer.getInstance().isUseZK()) {
loadViewFromKV();
} else if (DbleServer.getInstance().isUseUcore()) {
loadViewFromCKV();
} else {
loadViewFromFile();
}
SystemConfig system = config.getSystem();
if (system.getCheckTableConsistency() == 1) {
scheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat("MetaDataChecker-%d").build());
checkTaskHandler = scheduler.scheduleWithFixedDelay(tableStructureCheckTask(selfNode), 0L, system.getCheckTableConsistencyPeriod(), TimeUnit.MILLISECONDS);
}
}
use of com.actiontech.dble.config.model.SystemConfig in project dble by actiontech.
the class AbstractConnection method setSocketParams.
public void setSocketParams(boolean isFrontChannel) throws IOException {
SystemConfig system = DbleServer.getInstance().getConfig().getSystem();
int soRcvBuf;
int soSndBuf;
int soNoDelay;
if (isFrontChannel) {
soRcvBuf = system.getFrontSocketSoRcvbuf();
soSndBuf = system.getFrontSocketSoSndbuf();
soNoDelay = system.getFrontSocketNoDelay();
} else {
soRcvBuf = system.getBackSocketSoRcvbuf();
soSndBuf = system.getBackSocketSoSndbuf();
soNoDelay = system.getBackSocketNoDelay();
}
channel.setOption(StandardSocketOptions.SO_RCVBUF, soRcvBuf);
channel.setOption(StandardSocketOptions.SO_SNDBUF, soSndBuf);
channel.setOption(StandardSocketOptions.TCP_NODELAY, soNoDelay == 1);
channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
channel.setOption(StandardSocketOptions.SO_KEEPALIVE, true);
this.setMaxPacketSize(system.getMaxPacketSize());
this.setIdleTimeout(system.getIdleTimeout());
this.setCharacterSet(system.getCharset());
this.setReadBufferChunk(soRcvBuf);
}
use of com.actiontech.dble.config.model.SystemConfig in project dble by actiontech.
the class FileSystemRepository method init.
@Override
public void init() {
SystemConfig systemConfig = DbleServer.getInstance().getConfig().getSystem();
String baseDir = systemConfig.getXaRecoveryLogBaseDir();
String baseName = systemConfig.getXaRecoveryLogBaseName();
LOGGER.debug("baseDir " + baseDir);
LOGGER.debug("baseName " + baseName);
// Judge whether exist the basedir
createBaseDir(baseDir);
file = new VersionedFile(baseDir, baseName, ".log");
}
use of com.actiontech.dble.config.model.SystemConfig in project dble by actiontech.
the class FileSystemRepository method init.
/**
* init the file read & create the viewMap
*/
public void init() {
try {
ServerConfig config = DbleServer.getInstance().getConfig();
SystemConfig systemConfig = config.getSystem();
baseDir = systemConfig.getViewPersistenceConfBaseDir();
baseName = systemConfig.getViewPersistenceConfBaseName();
// Judge whether exist the basedir
createBaseDir();
// open a channel of the view config file
RandomAccessFile randomAccessFile = new RandomAccessFile(baseDir + baseName, "rw");
rwChannel = randomAccessFile.getChannel();
viewCreateSqlMap = this.getObject();
} catch (Exception e) {
LOGGER.info("init view from file error make sure the file is correct :" + e.getMessage());
}
}
use of com.actiontech.dble.config.model.SystemConfig in project dble by actiontech.
the class ServerConnectionFactory method getConnection.
@Override
protected FrontendConnection getConnection(NetworkChannel channel) throws IOException {
ServerConnection c = new ServerConnection(channel);
c.setSocketParams(true);
c.setPrivileges(ServerPrivileges.instance());
c.setQueryHandler(new ServerQueryHandler(c));
c.setLoadDataInfileHandler(new ServerLoadDataInfileHandler(c));
c.setPrepareHandler(new ServerPrepareHandler(c));
SystemConfig sys = DbleServer.getInstance().getConfig().getSystem();
c.setTxIsolation(sys.getTxIsolation());
c.setSession2(new NonBlockingSession(c));
return c;
}
Aggregations