Search in sources :

Example 6 with ClientConfiguration

use of herddb.client.ClientConfiguration in project herddb by diennea.

the class DownloadTableSpaceTest method downloadTablespaceTest.

@Test
public void downloadTablespaceTest() throws Exception {
    ServerConfiguration serverconfig_1 = new ServerConfiguration(folder.newFolder().toPath());
    serverconfig_1.set(ServerConfiguration.PROPERTY_NODEID, "server1");
    serverconfig_1.set(ServerConfiguration.PROPERTY_PORT, 7867);
    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_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);
        for (int i = 0; i < 1000; i++) {
            server_1.getManager().executeUpdate(new InsertStatement(TableSpace.DEFAULT, "t1", RecordSerializer.makeRecord(table, "c", i)), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        }
        List<Map<String, Object>> logical_data = new ArrayList<>();
        AtomicBoolean start = new AtomicBoolean();
        try (HDBClient client = new HDBClient(new ClientConfiguration(folder.newFolder().toPath()));
            HDBConnection con = client.openConnection()) {
            client.setClientSideMetadataProvider(new ZookeeperClientSideMetadataProvider(testEnv.getAddress(), testEnv.getTimeout(), testEnv.getPath()));
            CountDownLatch count = new CountDownLatch(1);
            con.dumpTableSpace(TableSpace.DEFAULT, new TableSpaceDumpReceiver() {

                Table table;

                @Override
                public void start(LogSequenceNumber logSequenceNumber) throws DataStorageManagerException {
                    System.out.println("start at " + logSequenceNumber);
                    start.set(true);
                }

                @Override
                public void finish(LogSequenceNumber logSequenceNumber) {
                    System.out.println("finish!");
                    count.countDown();
                }

                @Override
                public void endTable() {
                    System.out.println("endTable");
                    table = null;
                }

                @Override
                public void receiveTableDataChunk(List<Record> records) {
                    // System.out.println("receiveTableDataChunk " + records);
                    for (Record r : records) {
                        Map<String, Object> bean = r.toBean(table);
                        // System.out.println("received:" + bean);
                        logical_data.add(bean);
                    }
                }

                @Override
                public void beginTable(DumpedTableMetadata table, Map<String, Object> stats) {
                    System.out.println("beginTable " + table);
                    this.table = table.table;
                }
            }, 89, false);
            assertTrue(count.await(20, TimeUnit.SECONDS));
            assertEquals(1000, logical_data.size());
            assertTrue(start.get());
        }
    }
}
Also used : DataStorageManagerException(herddb.storage.DataStorageManagerException) ArrayList(java.util.ArrayList) InsertStatement(herddb.model.commands.InsertStatement) DumpedTableMetadata(herddb.backup.DumpedTableMetadata) HDBConnection(herddb.client.HDBConnection) TableSpaceDumpReceiver(herddb.client.TableSpaceDumpReceiver) HDBClient(herddb.client.HDBClient) Record(herddb.model.Record) Table(herddb.model.Table) CreateTableStatement(herddb.model.commands.CreateTableStatement) LogSequenceNumber(herddb.log.LogSequenceNumber) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ZookeeperClientSideMetadataProvider(herddb.client.ZookeeperClientSideMetadataProvider) Map(java.util.Map) ClientConfiguration(herddb.client.ClientConfiguration) Test(org.junit.Test)

Example 7 with ClientConfiguration

use of herddb.client.ClientConfiguration in project herddb by diennea.

the class EmbeddedBookieTest method test_boot_with_bookie.

@Test
public void test_boot_with_bookie() throws Exception {
    ServerConfiguration serverconfig_1 = new ServerConfiguration(folder.newFolder("server1").toPath());
    serverconfig_1.set(ServerConfiguration.PROPERTY_NODEID, "server1");
    serverconfig_1.set(ServerConfiguration.PROPERTY_PORT, 7867);
    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_BOOKKEEPER_START, true);
    serverconfig_1.set("bookie.allowLoopback", true);
    ServerConfiguration serverconfig_2 = serverconfig_1.copy().set(ServerConfiguration.PROPERTY_NODEID, "server2").set(ServerConfiguration.PROPERTY_BASEDIR, folder.newFolder("server2").toPath().toAbsolutePath()).set(ServerConfiguration.PROPERTY_PORT, 7868).set(ServerConfiguration.PROPERTY_BOOKKEEPER_BOOKIE_PORT, 3182);
    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);
        server_1.getManager().executeUpdate(new InsertStatement(TableSpace.DEFAULT, "t1", RecordSerializer.makeRecord(table, "c", 1)), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
        server_1.getManager().executeUpdate(new InsertStatement(TableSpace.DEFAULT, "t1", RecordSerializer.makeRecord(table, "c", 2)), 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", 2, 0), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
            assertTrue(server_2.getManager().waitForTablespace(TableSpace.DEFAULT, 60000, false));
            server_2.getManager().setErrorIfNotLeader(false);
            // 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());
            server_2.getManager().setErrorIfNotLeader(true);
            ClientConfiguration client_configuration = new ClientConfiguration(folder.newFolder().toPath());
            client_configuration.set(ClientConfiguration.PROPERTY_MODE, ServerConfiguration.PROPERTY_MODE_CLUSTER);
            client_configuration.set(ClientConfiguration.PROPERTY_ZOOKEEPER_ADDRESS, testEnv.getAddress());
            client_configuration.set(ClientConfiguration.PROPERTY_ZOOKEEPER_PATH, testEnv.getPath());
            client_configuration.set(ClientConfiguration.PROPERTY_ZOOKEEPER_SESSIONTIMEOUT, testEnv.getTimeout());
            try (HDBClient client = new HDBClient(client_configuration);
                HDBConnection connection = client.openConnection()) {
                try (ScanResultSet scan = connection.executeScan(TableSpace.DEFAULT, "SELECT * FROM t1 WHERE c=1", Collections.emptyList(), 0, 0, 10)) {
                    assertEquals(1, scan.consume().size());
                }
                // switch leader to server2
                server_2.getManager().executeStatement(new AlterTableSpaceStatement(TableSpace.DEFAULT, new HashSet<>(Arrays.asList("server1", "server2")), "server2", 2, 0), StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION);
                // wait that server_1 leaves leadership
                for (int i = 0; i < 100; i++) {
                    TableSpaceManager tManager = server_1.getManager().getTableSpaceManager(TableSpace.DEFAULT);
                    if (tManager != null && !tManager.isLeader()) {
                        break;
                    }
                    Thread.sleep(100);
                }
                TableSpaceManager tManager = server_1.getManager().getTableSpaceManager(TableSpace.DEFAULT);
                assertTrue(tManager != null && !tManager.isLeader());
                // the client MUST automatically look for the new leader
                try (ScanResultSet scan = connection.executeScan(TableSpace.DEFAULT, "SELECT * FROM t1 WHERE c=1", Collections.emptyList(), 0, 0, 10)) {
                    assertEquals(1, scan.consume().size());
                }
            }
            // assert  that server_1 is not accepting request any more
            try (HDBClient client_to_1 = new HDBClient(new ClientConfiguration(folder.newFolder().toPath()));
                HDBConnection connection = client_to_1.openConnection()) {
                client_to_1.setClientSideMetadataProvider(new StaticClientSideMetadataProvider(server_1));
                try (ScanResultSet scan = connection.executeScan(TableSpace.DEFAULT, "SELECT * FROM t1 WHERE c=1", Collections.emptyList(), 0, 0, 10)) {
                    fail("server_1 MUST not accept queries");
                } catch (ClientSideMetadataProviderException ok) {
                }
            }
            // assert that server_2 is accepting requests
            try (HDBClient client_to_2 = new HDBClient(new ClientConfiguration(folder.newFolder().toPath()));
                HDBConnection connection = client_to_2.openConnection()) {
                client_to_2.setClientSideMetadataProvider(new StaticClientSideMetadataProvider(server_2));
                try (ScanResultSet scan = connection.executeScan(TableSpace.DEFAULT, "SELECT * FROM t1 WHERE c=1", Collections.emptyList(), 0, 0, 10)) {
                    assertEquals(1, scan.consume().size());
                }
            }
        }
    }
}
Also used : AlterTableSpaceStatement(herddb.model.commands.AlterTableSpaceStatement) Table(herddb.model.Table) GetResult(herddb.model.GetResult) CreateTableStatement(herddb.model.commands.CreateTableStatement) ScanResultSet(herddb.client.ScanResultSet) ClientSideMetadataProviderException(herddb.client.ClientSideMetadataProviderException) InsertStatement(herddb.model.commands.InsertStatement) HDBConnection(herddb.client.HDBConnection) HDBClient(herddb.client.HDBClient) GetStatement(herddb.model.commands.GetStatement) TableSpaceManager(herddb.core.TableSpaceManager) ClientConfiguration(herddb.client.ClientConfiguration) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 8 with ClientConfiguration

use of herddb.client.ClientConfiguration in project herddb by diennea.

the class HistoryChangelogTest method test.

@Test
@Ignore
public void test() throws Exception {
    Path baseDir = folder.newFolder().toPath();
    ServerConfiguration serverConfiguration = new ServerConfiguration(baseDir);
    serverConfiguration.set(ServerConfiguration.PROPERTY_MAX_LOGICAL_PAGE_SIZE, 10 * 1024);
    serverConfiguration.set(ServerConfiguration.PROPERTY_MAX_DATA_MEMORY, 1024 * 1024);
    serverConfiguration.set(ServerConfiguration.PROPERTY_MAX_PK_MEMORY, 1024 * 1024);
    serverConfiguration.set(ServerConfiguration.PROPERTY_CHECKPOINT_PERIOD, 0);
    serverConfiguration.set(ServerConfiguration.PROPERTY_DATADIR, folder.newFolder().getAbsolutePath());
    serverConfiguration.set(ServerConfiguration.PROPERTY_LOGDIR, folder.newFolder().getAbsolutePath());
    ConcurrentSkipListSet<Long> doneElements = new ConcurrentSkipListSet<>();
    ConcurrentHashMap<Long, Element> elements = new ConcurrentHashMap<>();
    try (Server server = new Server(serverConfiguration)) {
        server.start();
        server.waitForStandaloneBoot();
        ClientConfiguration clientConfiguration = new ClientConfiguration(folder.newFolder().toPath());
        try (HDBClient client = new HDBClient(clientConfiguration);
            HDBConnection connection = client.openConnection()) {
            client.setClientSideMetadataProvider(new StaticClientSideMetadataProvider(server));
            long resultCreateTable = connection.executeUpdate(TableSpace.DEFAULT, "CREATE TABLE mytable (id long primary key, hid long, status integer)", 0, false, Collections.emptyList()).updateCount;
            Assert.assertEquals(1, resultCreateTable);
            long resultCreateTableHistory = connection.executeUpdate(TableSpace.DEFAULT, "CREATE TABLE history (id long, hid long, status integer, primary key (id,hid) )", 0, false, Collections.emptyList()).updateCount;
            Assert.assertEquals(1, resultCreateTableHistory);
            long tx = connection.beginTransaction(TableSpace.DEFAULT);
            for (long i = 0; i < TABLESIZE; i++) {
                int status = 0;
                connection.executeUpdate(TableSpace.DEFAULT, "INSERT INTO mytable (id,hid,status) values(?,?,?)", tx, false, Arrays.asList(i, 0, status));
                elements.put(i, new Element(0, status));
            }
            connection.commitTransaction(TableSpace.DEFAULT, tx);
            ExecutorService threadPool = Executors.newFixedThreadPool(THREADPOLSIZE);
            try {
                List<Future> futures = new ArrayList<>();
                AtomicLong updates = new AtomicLong();
                for (int i = 0; i < TABLESIZE * MULTIPLIER; i++) {
                    futures.add(threadPool.submit(new Runnable() {

                        @Override
                        public void run() {
                            try {
                                long id = ThreadLocalRandom.current().nextInt(TABLESIZE);
                                doneElements.add(id);
                                Element element = elements.remove(id);
                                if (element == null) {
                                    return;
                                }
                                int new_status = element.status + 1;
                                long next_hid = element.hid + 1;
                                long transactionId;
                                updates.incrementAndGet();
                                DMLResult updateResult = connection.executeUpdate(TableSpace.DEFAULT, "UPDATE mytable set hid=?,status=? WHERE id=?", TransactionContext.AUTOTRANSACTION_ID, false, Arrays.asList(next_hid, new_status, id));
                                transactionId = updateResult.transactionId;
                                if (updateResult.updateCount <= 0) {
                                    throw new RuntimeException("not updated ?");
                                }
                                DMLResult insertResult = connection.executeUpdate(TableSpace.DEFAULT, "INSERT INTO history (id,hid,status) values (?,?,?)", transactionId, false, Arrays.asList(id, next_hid, new_status));
                                if (insertResult.updateCount <= 0) {
                                    throw new RuntimeException("not inserted ?");
                                }
                                connection.commitTransaction(TableSpace.DEFAULT, transactionId);
                                // make the element available again
                                elements.put(id, new Element(new_status, next_hid));
                            } catch (Exception err) {
                                err.printStackTrace();
                                throw new RuntimeException(err);
                            }
                        }
                    }));
                }
                for (Future f : futures) {
                    f.get();
                }
                System.out.println("stats::updates:" + updates);
                assertTrue(updates.get() > 0);
                TableManagerStats stats = server.getManager().getTableSpaceManager(TableSpace.DEFAULT).getTableManager("mytable").getStats();
                System.out.println("stats::tablesize:" + stats.getTablesize());
                System.out.println("stats::dirty records:" + stats.getDirtyrecords());
                System.out.println("stats::unload count:" + stats.getUnloadedPagesCount());
                System.out.println("stats::load count:" + stats.getLoadedPagesCount());
                System.out.println("stats::buffers used mem:" + stats.getBuffersUsedMemory());
                assertEquals(TABLESIZE, stats.getTablesize());
                for (Map.Entry<Long, Element> entry : elements.entrySet()) {
                    {
                        GetResult res = connection.executeGet(TableSpace.DEFAULT, "SELECT status,hid FROM mytable where id=?", TransactionContext.NOTRANSACTION_ID, Arrays.asList(entry.getKey()));
                        assertNotNull(res.data);
                        assertEquals(entry.getValue().status, res.data.get("status"));
                        assertEquals(entry.getValue().hid, res.data.get("hid"));
                    }
                    if (doneElements.contains(entry.getKey())) {
                        ScanResultSet res = connection.executeScan(TableSpace.DEFAULT, "SELECT id, status, hid, (SELECT MAX(hid) as mm  from history where history.id=mytable.id) as maxhid " + "FROM mytable where id=?", Arrays.asList(entry.getKey()), TransactionContext.NOTRANSACTION_ID, -1, 10000);
                        List<Map<String, Object>> consume = res.consume();
                        assertEquals(1, consume.size());
                        Map<String, Object> data = consume.get(0);
                        System.out.println("data:" + data);
                        assertEquals(entry.getValue().status, data.get("status"));
                        assertEquals(entry.getValue().hid, data.get("hid"));
                        assertEquals(entry.getValue().hid, data.get("maxhid"));
                        assertEquals(entry.getKey(), data.get("id"));
                    }
                }
            } finally {
                threadPool.shutdown();
                threadPool.awaitTermination(1, TimeUnit.MINUTES);
            }
        }
    }
    // restart and recovery
    try (Server server = new Server(serverConfiguration)) {
        server.start();
        server.waitForStandaloneBoot();
        ClientConfiguration clientConfiguration = new ClientConfiguration(folder.newFolder().toPath());
        try (HDBClient client = new HDBClient(clientConfiguration);
            HDBConnection connection = client.openConnection()) {
            client.setClientSideMetadataProvider(new StaticClientSideMetadataProvider(server));
            for (Map.Entry<Long, Element> entry : elements.entrySet()) {
                {
                    GetResult res = connection.executeGet(TableSpace.DEFAULT, "SELECT status,hid FROM mytable where id=?", TransactionContext.NOTRANSACTION_ID, Arrays.asList(entry.getKey()));
                    assertNotNull(res.data);
                    assertEquals(entry.getValue().status, res.data.get("status"));
                    assertEquals(entry.getValue().hid, res.data.get("hid"));
                }
                if (doneElements.contains(entry.getKey())) {
                    ScanResultSet res = connection.executeScan(TableSpace.DEFAULT, "SELECT id, status, hid, (SELECT MAX(hid) as mm  from history where history.id=mytable.id) as maxhid " + "FROM mytable where id=?", Arrays.asList(entry.getKey()), TransactionContext.NOTRANSACTION_ID, -1, 10000);
                    List<Map<String, Object>> consume = res.consume();
                    assertEquals(1, consume.size());
                    Map<String, Object> data = consume.get(0);
                    System.out.println("data:" + data);
                    assertEquals(entry.getValue().status, data.get("status"));
                    assertEquals(entry.getValue().hid, data.get("hid"));
                    assertEquals(entry.getValue().hid, data.get("maxhid"));
                    assertEquals(entry.getKey(), data.get("id"));
                }
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) ScanResultSet(herddb.client.ScanResultSet) HDBConnection(herddb.client.HDBConnection) HDBClient(herddb.client.HDBClient) DMLResult(herddb.client.DMLResult) TableManagerStats(herddb.core.stats.TableManagerStats) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Path(java.nio.file.Path) GetResult(herddb.client.GetResult) ConcurrentSkipListSet(java.util.concurrent.ConcurrentSkipListSet) AtomicLong(java.util.concurrent.atomic.AtomicLong) AtomicLong(java.util.concurrent.atomic.AtomicLong) ExecutorService(java.util.concurrent.ExecutorService) Future(java.util.concurrent.Future) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ClientConfiguration(herddb.client.ClientConfiguration) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 9 with ClientConfiguration

use of herddb.client.ClientConfiguration in project herddb by diennea.

the class JAASMD5Test method test.

@Test
public void test() throws Exception {
    System.setProperty("java.security.auth.login.config", new File("src/test/resources/test_jaas_md5.conf").getAbsolutePath());
    try (Server server = new Server(new ServerConfiguration(folder.newFolder().toPath()))) {
        server.start();
        try (HDBClient client = new HDBClient(new ClientConfiguration(folder.newFolder().toPath()));
            HDBConnection connection = client.openConnection()) {
            client.setClientSideMetadataProvider(new StaticClientSideMetadataProvider(server));
            long resultCreateTable = connection.executeUpdate(TableSpace.DEFAULT, "CREATE TABLE mytable (id string primary key, n1 long, n2 integer)", 0, false, Collections.emptyList()).updateCount;
            Assert.assertEquals(1, resultCreateTable);
            Assert.assertEquals(1, connection.executeUpdate(TableSpace.DEFAULT, "INSERT INTO mytable (id,n1,n2) values(?,?,?)", 0, false, Arrays.asList("test_0", 1, 2)).updateCount);
            Map<String, Object> newValue = connection.executeUpdate(TableSpace.DEFAULT, "UPDATE mytable set n1= n1+1 where id=?", 0, true, Arrays.asList("test_0")).newvalue;
            assertEquals(Long.valueOf(2), newValue.get("n1"));
        }
    } finally {
        System.clearProperty("java.security.auth.login.config");
    }
}
Also used : HDBConnection(herddb.client.HDBConnection) HDBClient(herddb.client.HDBClient) File(java.io.File) ClientConfiguration(herddb.client.ClientConfiguration) Test(org.junit.Test)

Example 10 with ClientConfiguration

use of herddb.client.ClientConfiguration in project herddb by diennea.

the class SimpleClusterTest method test.

@Test
public void test() throws Exception {
    try (TestingServer zookeeperServer = new TestingServer(-1, folder.newFolder("zk"))) {
        File tmpConfFile = folder.newFile("test.server_cluster.properties");
        try (InputStream in = SimpleClusterTest.class.getResourceAsStream("/conf/test.server_cluster.properties")) {
            Properties props = new Properties();
            props.load(in);
            props.put(ServerConfiguration.PROPERTY_BASEDIR, folder.newFolder().getAbsolutePath());
            props.put(ServerConfiguration.PROPERTY_ZOOKEEPER_ADDRESS, zookeeperServer.getConnectString());
            try (FileOutputStream oo = new FileOutputStream(tmpConfFile)) {
                props.store(oo, "");
            }
        }
        Thread runner = new Thread(() -> {
            ServerMain.main(tmpConfFile.getAbsolutePath());
        });
        runner.start();
        while (ServerMain.getRunningInstance() == null || !ServerMain.getRunningInstance().isStarted()) {
            Thread.sleep(1000);
            System.out.println("waiting for boot");
        }
        ServerMain.getRunningInstance().getServer().waitForStandaloneBoot();
        try (HDBClient client = new HDBClient(new ClientConfiguration(folder.newFolder().toPath()))) {
            client.setClientSideMetadataProvider(new ZookeeperClientSideMetadataProvider(zookeeperServer.getConnectString(), 40000, "/herddb"));
            try (HDBConnection con = client.openConnection()) {
                try (ScanResultSet scan = con.executeScan(TableSpace.DEFAULT, "SELECT * FROM SYSTABLES", Collections.emptyList(), 0, 10, 10)) {
                    scan.consume();
                }
            }
        }
        ServerMain.getRunningInstance().close();
    } finally {
        if (ServerMain.getRunningInstance() != null) {
            ServerMain.getRunningInstance().close();
        }
    }
}
Also used : TestingServer(org.apache.curator.test.TestingServer) HDBConnection(herddb.client.HDBConnection) HDBClient(herddb.client.HDBClient) InputStream(java.io.InputStream) FileOutputStream(java.io.FileOutputStream) ZookeeperClientSideMetadataProvider(herddb.client.ZookeeperClientSideMetadataProvider) ScanResultSet(herddb.client.ScanResultSet) Properties(java.util.Properties) File(java.io.File) ClientConfiguration(herddb.client.ClientConfiguration) Test(org.junit.Test)

Aggregations

ClientConfiguration (herddb.client.ClientConfiguration)53 HDBClient (herddb.client.HDBClient)53 Test (org.junit.Test)49 HDBConnection (herddb.client.HDBConnection)26 Server (herddb.server.Server)26 ServerConfiguration (herddb.server.ServerConfiguration)26 StaticClientSideMetadataProvider (herddb.server.StaticClientSideMetadataProvider)26 Connection (java.sql.Connection)25 Statement (java.sql.Statement)24 PreparedStatement (java.sql.PreparedStatement)22 ResultSet (java.sql.ResultSet)19 Table (herddb.model.Table)11 CreateTableStatement (herddb.model.commands.CreateTableStatement)11 InsertStatement (herddb.model.commands.InsertStatement)10 ScanResultSet (herddb.client.ScanResultSet)8 HashSet (java.util.HashSet)7 Map (java.util.Map)7 ProgressListener (herddb.backup.ProgressListener)6 ByteArrayInputStream (java.io.ByteArrayInputStream)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6