Search in sources :

Example 86 with Server

use of herddb.server.Server in project herddb by diennea.

the class TablespaceReplicasStateTest method testCluster.

@Test
public void testCluster() throws Exception {
    ServerConfiguration serverconfig_1 = newServerConfigurationWithAutoPort(folder.newFolder().toPath());
    serverconfig_1.set(ServerConfiguration.PROPERTY_NODEID, "server1");
    serverconfig_1.set(ServerConfiguration.PROPERTY_MODE, ServerConfiguration.PROPERTY_MODE_CLUSTER);
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_ADDRESS, testEnv.getAddress());
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_PATH, testEnv.getPath());
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_SESSIONTIMEOUT, testEnv.getTimeout());
    serverconfig_1.set(ServerConfiguration.PROPERTY_ENFORCE_LEADERSHIP, false);
    ServerConfiguration serverconfig_2 = serverconfig_1.copy().set(ServerConfiguration.PROPERTY_NODEID, "server2").set(ServerConfiguration.PROPERTY_BASEDIR, folder.newFolder().toPath().toAbsolutePath());
    try (Server server_1 = new Server(serverconfig_1)) {
        server_1.start();
        server_1.waitForStandaloneBoot();
        Table table = Table.builder().name("t1").column("c", ColumnTypes.INTEGER).primaryKey("c").build();
        server_1.getManager().executeStatement(new CreateTableStatement(table), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        try (Server server_2 = new Server(serverconfig_2)) {
            server_2.start();
            server_1.getManager().executeStatement(new AlterTableSpaceStatement(TableSpace.DEFAULT, new HashSet<>(Arrays.asList("server1", "server2")), "server1", 1, 0), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
            assertTrue(server_2.getManager().waitForTablespace(TableSpace.DEFAULT, 60000, false));
            try (DataScanner scan = scan(server_1.getManager(), "SELECT * FROM systablespacereplicastate", Collections.emptyList())) {
                List<DataAccessor> results = scan.consume();
                assertEquals(2, results.size());
            }
            try (DataScanner scan = scan(server_1.getManager(), "SELECT * FROM systablespacereplicastate " + "where nodeId='" + server_2.getNodeId() + "' and mode='follower'", Collections.emptyList())) {
                assertEquals(1, scan.consume().size());
            }
            try (DataScanner scan = scan(server_2.getManager(), "SELECT * FROM systablespacereplicastate " + "where nodeId='" + server_2.getNodeId() + "' and mode='follower'", Collections.emptyList())) {
                assertEquals(1, scan.consume().size());
            }
            try (DataScanner scan = scan(server_1.getManager(), "SELECT * FROM systablespacereplicastate " + "where nodeId='" + server_1.getNodeId() + "' and mode='leader'", Collections.emptyList())) {
                assertEquals(1, scan.consume().size());
            }
            server_1.getManager().executeStatement(new AlterTableSpaceStatement(TableSpace.DEFAULT, new HashSet<>(Arrays.asList("server1")), "server1", 1, 0), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
            for (int i = 0; i < 100; i++) {
                try (DataScanner scan = scan(server_1.getManager(), "SELECT * FROM systablespacereplicastate where nodeId='" + server_2.getNodeId() + "' and mode='stopped'", Collections.emptyList())) {
                    if (scan.consume().size() > 0) {
                        break;
                    }
                }
            }
            try (DataScanner scan = scan(server_1.getManager(), "SELECT * FROM systablespacereplicastate where nodeId='" + server_2.getNodeId() + "' and mode='stopped'", Collections.emptyList())) {
                assertEquals(1, scan.consume().size());
            }
        }
    }
}
Also used : AlterTableSpaceStatement(herddb.model.commands.AlterTableSpaceStatement) Table(herddb.model.Table) DataScanner(herddb.model.DataScanner) Server(herddb.server.Server) DataAccessor(herddb.utils.DataAccessor) ServerConfiguration(herddb.server.ServerConfiguration) CreateTableStatement(herddb.model.commands.CreateTableStatement) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 87 with Server

use of herddb.server.Server in project herddb by diennea.

the class LedgerClosedTest method uselessLedgerDroppedError.

@Test
public void uselessLedgerDroppedError() throws Exception {
    ServerConfiguration serverconfig_1 = newServerConfigurationWithAutoPort(folder.newFolder().toPath());
    serverconfig_1.set(ServerConfiguration.PROPERTY_NODEID, "server1");
    serverconfig_1.set(ServerConfiguration.PROPERTY_MODE, ServerConfiguration.PROPERTY_MODE_CLUSTER);
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_ADDRESS, testEnv.getAddress());
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_PATH, testEnv.getPath());
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_SESSIONTIMEOUT, testEnv.getTimeout());
    try (Server server = new Server(serverconfig_1)) {
        server.start();
        server.waitForStandaloneBoot();
        Table table = Table.builder().name("t1").column("c", ColumnTypes.INTEGER).primaryKey("c").build();
        server.getManager().executeStatement(new CreateTableStatement(table), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        server.getManager().executeUpdate(new InsertStatement(TableSpace.DEFAULT, "t1", RecordSerializer.makeRecord(table, "c", 1)), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        server.getManager().executeUpdate(new InsertStatement(TableSpace.DEFAULT, "t1", RecordSerializer.makeRecord(table, "c", 2)), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        server.getManager().executeUpdate(new InsertStatement(TableSpace.DEFAULT, "t1", RecordSerializer.makeRecord(table, "c", 3)), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        TableSpaceManager tableSpaceManager = server.getManager().getTableSpaceManager(TableSpace.DEFAULT);
        BookkeeperCommitLog log = (BookkeeperCommitLog) tableSpaceManager.getLog();
        long ledgerId = log.getLastSequenceNumber().ledgerId;
        assertTrue(ledgerId >= 0);
    }
    // restart
    try (Server server = new Server(serverconfig_1)) {
        server.start();
        server.waitForStandaloneBoot();
    }
    // restart
    LedgersInfo actualLedgersList;
    try (Server server = new Server(serverconfig_1)) {
        server.start();
        server.waitForStandaloneBoot();
        TableSpaceManager tableSpaceManager = server.getManager().getTableSpaceManager(TableSpace.DEFAULT);
        BookkeeperCommitLog log = (BookkeeperCommitLog) tableSpaceManager.getLog();
        actualLedgersList = log.getActualLedgersList();
        assertEquals(3, actualLedgersList.getActiveLedgers().size());
        System.out.println("actualLedgersList: " + actualLedgersList);
        long lastLedgerId = log.getLastLedgerId();
        assertEquals(lastLedgerId, actualLedgersList.getActiveLedgers().get(actualLedgersList.getActiveLedgers().size() - 1).longValue());
        try (BookKeeper bk = createBookKeeper()) {
            long ledgerIdToDrop = actualLedgersList.getActiveLedgers().get(0);
            System.out.println("dropping " + ledgerIdToDrop);
            bk.newDeleteLedgerOp().withLedgerId(ledgerIdToDrop).execute().get();
        }
    }
    // the server should boot even if the ledger does not exist anymore
    try (Server server = new Server(serverconfig_1)) {
        server.start();
        server.waitForStandaloneBoot();
    }
}
Also used : LedgersInfo(herddb.cluster.LedgersInfo) Table(herddb.model.Table) Server(herddb.server.Server) ServerConfiguration(herddb.server.ServerConfiguration) CreateTableStatement(herddb.model.commands.CreateTableStatement) TableSpaceManager(herddb.core.TableSpaceManager) BookKeeper(org.apache.bookkeeper.client.BookKeeper) InsertStatement(herddb.model.commands.InsertStatement) BookkeeperCommitLog(herddb.cluster.BookkeeperCommitLog) Test(org.junit.Test)

Example 88 with Server

use of herddb.server.Server in project herddb by diennea.

the class BootAsNewLeaderTest method testLeaderOfflineLogAvailableForcedNewLeader.

@Test
public void testLeaderOfflineLogAvailableForcedNewLeader() throws Exception {
    ServerConfiguration serverconfig_1 = newServerConfigurationWithAutoPort(folder.newFolder().toPath());
    serverconfig_1.set(ServerConfiguration.PROPERTY_NODEID, "server1");
    serverconfig_1.set(ServerConfiguration.PROPERTY_MODE, ServerConfiguration.PROPERTY_MODE_CLUSTER);
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_ADDRESS, testEnv.getAddress());
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_PATH, testEnv.getPath());
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_SESSIONTIMEOUT, testEnv.getTimeout());
    serverconfig_1.set(ServerConfiguration.PROPERTY_ENFORCE_LEADERSHIP, false);
    // disabled
    serverconfig_1.set(ServerConfiguration.PROPERTY_BOOKKEEPER_MAX_IDLE_TIME, 0);
    ServerConfiguration serverconfig_2 = serverconfig_1.copy().set(ServerConfiguration.PROPERTY_NODEID, "server2").set(ServerConfiguration.PROPERTY_BASEDIR, folder.newFolder().toPath().toAbsolutePath());
    try (Server server_1 = new Server(serverconfig_1)) {
        server_1.start();
        server_1.waitForStandaloneBoot();
        Table table = Table.builder().name("t1").column("c", ColumnTypes.INTEGER).column("s", ColumnTypes.INTEGER).primaryKey("c").build();
        Index index = Index.builder().onTable(table).type(Index.TYPE_BRIN).column("s", ColumnTypes.STRING).build();
        server_1.getManager().executeStatement(new CreateTableStatement(table), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        server_1.getManager().executeStatement(new CreateIndexStatement(index), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        server_1.getManager().executeUpdate(new InsertStatement(TableSpace.DEFAULT, "t1", RecordSerializer.makeRecord(table, "c", 1, "s", "1")), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        server_1.getManager().executeUpdate(new InsertStatement(TableSpace.DEFAULT, "t1", RecordSerializer.makeRecord(table, "c", 2, "s", "2")), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        server_1.getManager().executeUpdate(new InsertStatement(TableSpace.DEFAULT, "t1", RecordSerializer.makeRecord(table, "c", 3, "s", "3")), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        server_1.getManager().executeUpdate(new InsertStatement(TableSpace.DEFAULT, "t1", RecordSerializer.makeRecord(table, "c", 4, "s", "4")), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        // set forcibly server2 as new leader
        server_1.getManager().executeStatement(new AlterTableSpaceStatement(TableSpace.DEFAULT, new HashSet<>(Arrays.asList("server1", "server2")), "server2", 1, 0), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
    }
    // it can recover from log
    try (Server server_2 = new Server(serverconfig_2)) {
        server_2.start();
        assertTrue(server_2.getManager().waitForTablespace(TableSpace.DEFAULT, 60000, true));
        // wait for data to arrive on server_2
        for (int i = 0; i < 100; i++) {
            GetResult found = server_2.getManager().get(new GetStatement(TableSpace.DEFAULT, "t1", Bytes.from_int(1), null, false), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
            if (found.found()) {
                break;
            }
            Thread.sleep(100);
        }
        assertTrue(server_2.getManager().get(new GetStatement(TableSpace.DEFAULT, "t1", Bytes.from_int(1), null, false), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION).found());
        TranslatedQuery translated = server_2.getManager().getPlanner().translate(TableSpace.DEFAULT, "SELECT * FROM " + TableSpace.DEFAULT + ".t1 WHERE s=1", Collections.emptyList(), true, true, false, -1);
        ScanStatement statement = translated.plan.mainStatement.unwrap(ScanStatement.class);
        assertTrue(statement.getPredicate().getIndexOperation() instanceof SecondaryIndexSeek);
        try (DataScanner scan = server_2.getManager().scan(statement, translated.context, TransactionContext.NO_TRANSACTION)) {
            assertEquals(1, scan.consume().size());
        }
    }
    // reboot server_2
    try (Server server_2 = new Server(serverconfig_2)) {
        server_2.start();
        assertTrue(server_2.getManager().waitForTablespace(TableSpace.DEFAULT, 60000, true));
        TranslatedQuery translated = server_2.getManager().getPlanner().translate(TableSpace.DEFAULT, "SELECT * FROM " + TableSpace.DEFAULT + ".t1 WHERE s=1", Collections.emptyList(), true, true, false, -1);
        ScanStatement statement = translated.plan.mainStatement.unwrap(ScanStatement.class);
        assertTrue(statement.getPredicate().getIndexOperation() instanceof SecondaryIndexSeek);
        try (DataScanner scan = server_2.getManager().scan(statement, translated.context, TransactionContext.NO_TRANSACTION)) {
            assertEquals(1, scan.consume().size());
        }
    }
}
Also used : AlterTableSpaceStatement(herddb.model.commands.AlterTableSpaceStatement) Table(herddb.model.Table) TranslatedQuery(herddb.sql.TranslatedQuery) Server(herddb.server.Server) GetResult(herddb.model.GetResult) ServerConfiguration(herddb.server.ServerConfiguration) CreateTableStatement(herddb.model.commands.CreateTableStatement) CreateIndexStatement(herddb.model.commands.CreateIndexStatement) Index(herddb.model.Index) InsertStatement(herddb.model.commands.InsertStatement) SecondaryIndexSeek(herddb.index.SecondaryIndexSeek) DataScanner(herddb.model.DataScanner) GetStatement(herddb.model.commands.GetStatement) HashSet(java.util.HashSet) ScanStatement(herddb.model.commands.ScanStatement) Test(org.junit.Test)

Example 89 with Server

use of herddb.server.Server in project herddb by diennea.

the class ExpectedReplicaCountTest method testDisklessClusterReplication.

@Test
public void testDisklessClusterReplication() throws Exception {
    TestStatsProvider statsProvider = new TestStatsProvider();
    ServerConfiguration serverconfig_1 = newServerConfigurationWithAutoPort(folder.newFolder().toPath());
    serverconfig_1.set(ServerConfiguration.PROPERTY_NODEID, "server1");
    serverconfig_1.set(ServerConfiguration.PROPERTY_MODE, ServerConfiguration.PROPERTY_MODE_DISKLESSCLUSTER);
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_ADDRESS, testEnv.getAddress());
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_PATH, testEnv.getPath());
    serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_SESSIONTIMEOUT, testEnv.getTimeout());
    try (Server server_1 = new Server(serverconfig_1)) {
        server_1.start();
        server_1.waitForStandaloneBoot();
        TestUtils.execute(server_1.getManager(), "CREATE TABLESPACE 'ttt','leader:" + server_1.getNodeId() + "','expectedreplicacount:2'", Collections.emptyList());
        // perform some writes
        ClientConfiguration clientConfiguration = new ClientConfiguration();
        clientConfiguration.set(ClientConfiguration.PROPERTY_MODE, ClientConfiguration.PROPERTY_MODE_CLUSTER);
        clientConfiguration.set(ClientConfiguration.PROPERTY_ZOOKEEPER_ADDRESS, testEnv.getAddress());
        clientConfiguration.set(ClientConfiguration.PROPERTY_ZOOKEEPER_PATH, testEnv.getPath());
        clientConfiguration.set(ClientConfiguration.PROPERTY_ZOOKEEPER_SESSIONTIMEOUT, testEnv.getTimeout());
        StatsLogger logger = statsProvider.getStatsLogger("ds");
        try (HDBClient client1 = new HDBClient(clientConfiguration, logger)) {
            try (HDBConnection connection = client1.openConnection()) {
                // create table and insert data
                connection.executeUpdate(TableSpace.DEFAULT, "CREATE TABLE ttt.t1(k1 int primary key, n1 int)", TransactionContext.NOTRANSACTION_ID, false, false, Collections.emptyList());
                connection.executeUpdate(TableSpace.DEFAULT, "INSERT INTO ttt.t1(k1,n1) values(1,1)", TransactionContext.NOTRANSACTION_ID, false, false, Collections.emptyList());
                connection.executeUpdate(TableSpace.DEFAULT, "INSERT INTO ttt.t1(k1,n1) values(2,1)", TransactionContext.NOTRANSACTION_ID, false, false, Collections.emptyList());
                connection.executeUpdate(TableSpace.DEFAULT, "INSERT INTO ttt.t1(k1,n1) values(3,1)", TransactionContext.NOTRANSACTION_ID, false, false, Collections.emptyList());
                // flush data pages to BK
                server_1.getManager().checkpoint();
                Set<Long> initialLedgers = new HashSet<>();
                // verify that every ledger has ensemble size 2
                try (BookKeeper bk = createBookKeeper()) {
                    BookKeeperAdmin admin = new BookKeeperAdmin(bk);
                    for (long lId : admin.listLedgers()) {
                        LedgerMetadata md = bk.getLedgerManager().readLedgerMetadata(lId).get().getValue();
                        if ("ttt".equals(new String(md.getCustomMetadata().get("tablespaceuuid"), StandardCharsets.UTF_8))) {
                            assertEquals(2, md.getEnsembleSize());
                            assertEquals(2, md.getWriteQuorumSize());
                            assertEquals(2, md.getAckQuorumSize());
                            initialLedgers.add(lId);
                        }
                    }
                }
                BookkeeperCommitLog log = (BookkeeperCommitLog) server_1.getManager().getTableSpaceManager("ttt").getLog();
                final long currentLedgerId = log.getWriter().getLedgerId();
                // downsize to expectedreplicacount = 1
                TestUtils.execute(server_1.getManager(), "ALTER TABLESPACE 'ttt','leader:" + server_1.getNodeId() + "','expectedreplicacount:1'", Collections.emptyList());
                // the TableSpaceManager will roll a new ledger
                herddb.utils.TestUtils.waitForCondition(() -> {
                    if (log.getWriter() == null) {
                        return false;
                    }
                    long newLedgerId = log.getWriter().getLedgerId();
                    return newLedgerId != currentLedgerId;
                }, herddb.utils.TestUtils.NOOP, 100);
                // write some other record
                connection.executeUpdate(TableSpace.DEFAULT, "INSERT INTO ttt.t1(k1,n1) values(4,1)", TransactionContext.NOTRANSACTION_ID, false, false, Collections.emptyList());
                // flush data pages
                server_1.getManager().checkpoint();
                // verify that every ledger has ensemble size 2 or 1
                try (BookKeeper bk = createBookKeeper()) {
                    BookKeeperAdmin admin = new BookKeeperAdmin(bk);
                    for (long lId : admin.listLedgers()) {
                        LedgerMetadata md = bk.getLedgerManager().readLedgerMetadata(lId).get().getValue();
                        if ("ttt".equals(new String(md.getCustomMetadata().get("tablespaceuuid"), StandardCharsets.UTF_8))) {
                            if (initialLedgers.contains(lId)) {
                                assertEquals(2, md.getEnsembleSize());
                                assertEquals(2, md.getWriteQuorumSize());
                                assertEquals(2, md.getAckQuorumSize());
                            } else {
                                assertEquals(1, md.getEnsembleSize());
                                assertEquals(1, md.getWriteQuorumSize());
                                assertEquals(1, md.getAckQuorumSize());
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : TestStatsProvider(org.apache.bookkeeper.test.TestStatsProvider) StatsLogger(org.apache.bookkeeper.stats.StatsLogger) Server(herddb.server.Server) ServerConfiguration(herddb.server.ServerConfiguration) BookKeeper(org.apache.bookkeeper.client.BookKeeper) HDBConnection(herddb.client.HDBConnection) HDBClient(herddb.client.HDBClient) LedgerMetadata(org.apache.bookkeeper.client.api.LedgerMetadata) ClientConfiguration(herddb.client.ClientConfiguration) BookKeeperAdmin(org.apache.bookkeeper.client.BookKeeperAdmin) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 90 with Server

use of herddb.server.Server in project herddb by diennea.

the class SimpleClientServerTest method testTimeoutDuringAuth.

@Test
public void testTimeoutDuringAuth() throws Exception {
    Path baseDir = folder.newFolder().toPath();
    ServerConfiguration config = newServerConfigurationWithAutoPort(baseDir);
    final AtomicBoolean suspendProcessing = new AtomicBoolean(false);
    try (Server server = new Server(config) {

        @Override
        protected ServerSideConnectionPeer buildPeer(Channel channel) {
            return new ServerSideConnectionPeer(channel, this) {

                @Override
                public void requestReceived(Pdu message, Channel channel) {
                    if (suspendProcessing.get()) {
                        LOG.log(Level.INFO, "dropping message type " + message.type + " id " + message.messageId);
                        message.close();
                        return;
                    }
                    super.requestReceived(message, channel);
                }
            };
        }
    }) {
        server.start();
        server.waitForStandaloneBoot();
        ClientConfiguration clientConfiguration = new ClientConfiguration(folder.newFolder().toPath());
        clientConfiguration.set(ClientConfiguration.PROPERTY_TIMEOUT, 2000);
        clientConfiguration.set(ClientConfiguration.PROPERTY_MAX_CONNECTIONS_PER_SERVER, 1);
        try (HDBClient client = new HDBClient(clientConfiguration);
            HDBConnection connection = client.openConnection()) {
            client.setClientSideMetadataProvider(new StaticClientSideMetadataProvider(server));
            assertTrue(connection.waitForTableSpace(TableSpace.DEFAULT, Integer.MAX_VALUE));
            long resultCreateTable = connection.executeUpdate(TableSpace.DEFAULT, "CREATE TABLE mytable (id int primary key, s1 string)", 0, false, true, Collections.emptyList()).updateCount;
            Assert.assertEquals(1, resultCreateTable);
            suspendProcessing.set(true);
            try (HDBConnection connection2 = client.openConnection()) {
                // auth will timeout
                try {
                    connection2.executeUpdate(TableSpace.DEFAULT, "INSERT INTO mytable (id,s1) values(?,?)", TransactionContext.NOTRANSACTION_ID, false, true, Arrays.asList(1, "test1"));
                    fail("insertion should fail");
                } catch (Exception e) {
                    TestUtils.assertExceptionPresentInChain(e, HDBOperationTimeoutException.class);
                }
                suspendProcessing.set(false);
                // new connection
                assertEquals(1, connection2.executeUpdate(TableSpace.DEFAULT, "INSERT INTO mytable (id,s1) values(?,?)", TransactionContext.NOTRANSACTION_ID, false, true, Arrays.asList(1, "test1")).updateCount);
            }
        }
    }
}
Also used : Path(java.nio.file.Path) Pdu(herddb.proto.Pdu) ServerSideConnectionPeer(herddb.server.ServerSideConnectionPeer) Server(herddb.server.Server) HDBOperationTimeoutException(herddb.client.impl.HDBOperationTimeoutException) ServerConfiguration(herddb.server.ServerConfiguration) Channel(herddb.network.Channel) NettyChannel(herddb.network.netty.NettyChannel) SocketChannel(io.netty.channel.socket.SocketChannel) HDBOperationTimeoutException(herddb.client.impl.HDBOperationTimeoutException) IOException(java.io.IOException) MissingJDBCParameterException(herddb.model.MissingJDBCParameterException) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) StaticClientSideMetadataProvider(herddb.server.StaticClientSideMetadataProvider) Test(org.junit.Test)

Aggregations

Server (herddb.server.Server)119 Test (org.junit.Test)111 ServerConfiguration (herddb.server.ServerConfiguration)60 ClientConfiguration (herddb.client.ClientConfiguration)56 StaticClientSideMetadataProvider (herddb.server.StaticClientSideMetadataProvider)56 Connection (java.sql.Connection)53 HDBClient (herddb.client.HDBClient)52 Statement (java.sql.Statement)47 ResultSet (java.sql.ResultSet)37 Table (herddb.model.Table)36 CreateTableStatement (herddb.model.commands.CreateTableStatement)35 InsertStatement (herddb.model.commands.InsertStatement)32 PreparedStatement (java.sql.PreparedStatement)30 HashSet (java.util.HashSet)24 AlterTableSpaceStatement (herddb.model.commands.AlterTableSpaceStatement)19 Path (java.nio.file.Path)19 DataScanner (herddb.model.DataScanner)18 TableSpaceManager (herddb.core.TableSpaceManager)15 HDBConnection (herddb.client.HDBConnection)14 Index (herddb.model.Index)14