Search in sources :

Example 1 with SystemConfig

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);
    }
}
Also used : SystemConfig(com.actiontech.dble.config.model.SystemConfig) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder)

Example 2 with SystemConfig

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);
}
Also used : SystemConfig(com.actiontech.dble.config.model.SystemConfig)

Example 3 with SystemConfig

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");
}
Also used : SystemConfig(com.actiontech.dble.config.model.SystemConfig) VersionedFile(com.actiontech.dble.backend.mysql.xa.VersionedFile)

Example 4 with SystemConfig

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());
    }
}
Also used : ServerConfig(com.actiontech.dble.config.ServerConfig) SystemConfig(com.actiontech.dble.config.model.SystemConfig)

Example 5 with SystemConfig

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;
}
Also used : SystemConfig(com.actiontech.dble.config.model.SystemConfig) ServerLoadDataInfileHandler(com.actiontech.dble.server.handler.ServerLoadDataInfileHandler) ServerPrepareHandler(com.actiontech.dble.server.handler.ServerPrepareHandler)

Aggregations

SystemConfig (com.actiontech.dble.config.model.SystemConfig)8 VersionedFile (com.actiontech.dble.backend.mysql.xa.VersionedFile)1 DirectByteBufferPool (com.actiontech.dble.buffer.DirectByteBufferPool)1 CacheService (com.actiontech.dble.cache.CacheService)1 ServerConfig (com.actiontech.dble.config.ServerConfig)1 ConfigException (com.actiontech.dble.config.util.ConfigException)1 TxnLogProcessor (com.actiontech.dble.log.transaction.TxnLogProcessor)1 ManagerConnectionFactory (com.actiontech.dble.manager.ManagerConnectionFactory)1 EOFPacket (com.actiontech.dble.net.mysql.EOFPacket)1 FieldPacket (com.actiontech.dble.net.mysql.FieldPacket)1 RowDataPacket (com.actiontech.dble.net.mysql.RowDataPacket)1 RouteService (com.actiontech.dble.route.RouteService)1 ServerConnectionFactory (com.actiontech.dble.server.ServerConnectionFactory)1 ServerLoadDataInfileHandler (com.actiontech.dble.server.handler.ServerLoadDataInfileHandler)1 ServerPrepareHandler (com.actiontech.dble.server.handler.ServerPrepareHandler)1 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Element (org.w3c.dom.Element)1