@Test(timeout = 100000) public void testBatchWithSameRow() throws Exception { String tableName = TABLE_NAME_PREFIX + "-testBatchWithSameRow"; table = createTable(tableName, basicSchema, new CreateTableOptions()); KuduSession session = syncClient.newSession(); session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH); // Insert 25 rows, one per batch, along with 50 updates for each, and a delete at the end, // while also clearing the cache between each batch half the time. The delete is added here // so that a misplaced update would fail if it happens later than its delete. for (int i = 0; i < 25; i++) { session.apply(createInsert(i)); for (int j = 0; j < 50; j++) { Update update = table.newUpdate(); PartialRow row = update.getRow(); row.addInt(basicSchema.getColumnByIndex(0).getName(), i); row.addInt(basicSchema.getColumnByIndex(1).getName(), 1000); session.apply(update); } Delete del = table.newDelete(); PartialRow row = del.getRow(); row.addInt(basicSchema.getColumnByIndex(0).getName(), i); session.apply(del); session.flush(); if (i % 2 == 0) { client.emptyTabletsCacheForTable(table.getTableId()); } } assertEquals(0, countRowsInScan(client.newScannerBuilder(table).build())); }
@Test public void testEmpty() { AlgebraicField field = new PentagonField(); Selection selection = new Selection(); RealizedModel realized = new RealizedModel(field, new Projection.Default(field)); assertEquals(0, realized.size()); assertTrue(selection.isEmpty()); AlgebraicVector loc = field.basisVector(3, 2); Connector ball = new Connector(loc); realized.add(ball); assertEquals(1, realized.size()); assertTrue(selection.isEmpty()); Delete cmd = new Delete(selection, realized); try { cmd.perform(); } catch (Failure e) { fail("Delete perform failed"); } assertEquals(1, realized.size()); assertTrue(selection.isEmpty()); }