Search in sources :

Example 36 with Tuple

use of org.bboxdb.storage.entity.Tuple in project bboxdb by jnidzwetzki.

the class TestTableCompactor method testCompactTestWithDeletedTuple.

/**
 * Run the compactification with one deleted tuple
 * @throws StorageManagerException
 */
@Test(timeout = 60000)
public void testCompactTestWithDeletedTuple() throws StorageManagerException {
    final List<Tuple> tupleList1 = new ArrayList<Tuple>();
    tupleList1.add(new Tuple("1", BoundingBox.FULL_SPACE, "abc".getBytes()));
    final SSTableKeyIndexReader reader1 = addTuplesToFileAndGetReader(tupleList1, 1);
    final List<Tuple> tupleList2 = new ArrayList<Tuple>();
    tupleList2.add(new DeletedTuple("2"));
    final SSTableKeyIndexReader reader2 = addTuplesToFileAndGetReader(tupleList2, 2);
    final SSTableKeyIndexReader ssTableIndexReader = exectuteCompactAndGetReader(reader1, reader2, false);
    int counter = 0;
    for (@SuppressWarnings("unused") final Tuple tuple : ssTableIndexReader) {
        counter++;
    }
    Assert.assertEquals(2, counter);
}
Also used : DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) SSTableKeyIndexReader(org.bboxdb.storage.sstable.reader.SSTableKeyIndexReader) ArrayList(java.util.ArrayList) Tuple(org.bboxdb.storage.entity.Tuple) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) Test(org.junit.Test)

Example 37 with Tuple

use of org.bboxdb.storage.entity.Tuple in project bboxdb by jnidzwetzki.

the class TestTableCompactor method testCompactTestMerge.

@Test(timeout = 60000)
public void testCompactTestMerge() throws StorageManagerException {
    final List<Tuple> tupleList1 = new ArrayList<Tuple>();
    tupleList1.add(new Tuple("1", BoundingBox.FULL_SPACE, "abc".getBytes()));
    final SSTableKeyIndexReader reader1 = addTuplesToFileAndGetReader(tupleList1, 1);
    final List<Tuple> tupleList2 = new ArrayList<Tuple>();
    tupleList2.add(new Tuple("2", BoundingBox.FULL_SPACE, "def".getBytes()));
    final SSTableKeyIndexReader reader2 = addTuplesToFileAndGetReader(tupleList2, 2);
    final SSTableKeyIndexReader ssTableIndexReader = exectuteCompactAndGetReader(reader1, reader2, false);
    int counter = 0;
    for (@SuppressWarnings("unused") final Tuple tuple : ssTableIndexReader) {
        counter++;
    }
    Assert.assertEquals(tupleList1.size() + tupleList2.size(), counter);
}
Also used : SSTableKeyIndexReader(org.bboxdb.storage.sstable.reader.SSTableKeyIndexReader) ArrayList(java.util.ArrayList) Tuple(org.bboxdb.storage.entity.Tuple) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) Test(org.junit.Test)

Example 38 with Tuple

use of org.bboxdb.storage.entity.Tuple in project bboxdb by jnidzwetzki.

the class TestTableCompactor method testCompactationMajor2.

/**
 * Test a major compactation
 * @throws StorageManagerException
 */
@Test(timeout = 60000)
public void testCompactationMajor2() throws StorageManagerException {
    final List<Tuple> tupleList1 = new ArrayList<>();
    final Tuple nonDeletedTuple = new Tuple("KEY", BoundingBox.FULL_SPACE, "abc".getBytes());
    tupleList1.add(nonDeletedTuple);
    for (int i = 0; i < 1000; i++) {
        tupleList1.add(new Tuple(Integer.toString(i), BoundingBox.FULL_SPACE, "abc".getBytes()));
    }
    final SSTableKeyIndexReader reader1 = addTuplesToFileAndGetReader(tupleList1, 1);
    final List<Tuple> tupleList2 = new ArrayList<Tuple>();
    for (int i = 0; i < 1000; i++) {
        tupleList2.add(new DeletedTuple(Integer.toString(i)));
    }
    final SSTableKeyIndexReader reader2 = addTuplesToFileAndGetReader(tupleList2, 2);
    final SSTableKeyIndexReader ssTableIndexReader = exectuteCompactAndGetReader(reader1, reader2, true);
    final Iterator<Tuple> iterator = ssTableIndexReader.iterator();
    List<Tuple> tupes = Lists.newArrayList(iterator);
    Assert.assertEquals(1, tupes.size());
    Assert.assertTrue(tupes.contains(nonDeletedTuple));
}
Also used : DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) SSTableKeyIndexReader(org.bboxdb.storage.sstable.reader.SSTableKeyIndexReader) ArrayList(java.util.ArrayList) Tuple(org.bboxdb.storage.entity.Tuple) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) Test(org.junit.Test)

Example 39 with Tuple

use of org.bboxdb.storage.entity.Tuple in project bboxdb by jnidzwetzki.

the class TestTableCompactor method testCompactTestFileOneEmptyfile2.

@Test(timeout = 60000)
public void testCompactTestFileOneEmptyfile2() throws StorageManagerException {
    final List<Tuple> tupleList1 = new ArrayList<Tuple>();
    final SSTableKeyIndexReader reader1 = addTuplesToFileAndGetReader(tupleList1, 1);
    final List<Tuple> tupleList2 = new ArrayList<Tuple>();
    tupleList2.add(new Tuple("2", BoundingBox.FULL_SPACE, "def".getBytes()));
    final SSTableKeyIndexReader reader2 = addTuplesToFileAndGetReader(tupleList2, 2);
    final SSTableKeyIndexReader ssTableIndexReader = exectuteCompactAndGetReader(reader1, reader2, false);
    int counter = 0;
    for (@SuppressWarnings("unused") final Tuple tuple : ssTableIndexReader) {
        counter++;
    }
    Assert.assertEquals(tupleList1.size() + tupleList2.size(), counter);
}
Also used : SSTableKeyIndexReader(org.bboxdb.storage.sstable.reader.SSTableKeyIndexReader) ArrayList(java.util.ArrayList) Tuple(org.bboxdb.storage.entity.Tuple) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) Test(org.junit.Test)

Example 40 with Tuple

use of org.bboxdb.storage.entity.Tuple in project bboxdb by jnidzwetzki.

the class TestTupleDuplicateRemover method testTupleDuplicateRemoverEqualKeyDiffVesion.

@Test(timeout = 60000)
public void testTupleDuplicateRemoverEqualKeyDiffVesion() {
    final EntityDuplicateTracker tupleDuplicateRemover = new EntityDuplicateTracker();
    final Tuple tuple1 = new Tuple("key1", BoundingBox.FULL_SPACE, "".getBytes(), 1);
    Assert.assertFalse(tupleDuplicateRemover.isElementAlreadySeen(tuple1));
    Assert.assertTrue(tupleDuplicateRemover.isElementAlreadySeen(tuple1));
    final Tuple tuple2 = new Tuple("key1", BoundingBox.FULL_SPACE, "".getBytes(), 2);
    Assert.assertFalse(tupleDuplicateRemover.isElementAlreadySeen(tuple2));
    Assert.assertTrue(tupleDuplicateRemover.isElementAlreadySeen(tuple2));
}
Also used : EntityDuplicateTracker(org.bboxdb.storage.util.EntityDuplicateTracker) JoinedTuple(org.bboxdb.storage.entity.JoinedTuple) Tuple(org.bboxdb.storage.entity.Tuple) Test(org.junit.Test)

Aggregations

Tuple (org.bboxdb.storage.entity.Tuple)198 Test (org.junit.Test)123 DeletedTuple (org.bboxdb.storage.entity.DeletedTuple)104 BoundingBox (org.bboxdb.commons.math.BoundingBox)62 JoinedTuple (org.bboxdb.storage.entity.JoinedTuple)58 ArrayList (java.util.ArrayList)41 TupleStoreConfiguration (org.bboxdb.storage.entity.TupleStoreConfiguration)25 TupleStoreName (org.bboxdb.storage.entity.TupleStoreName)24 TupleListFuture (org.bboxdb.network.client.future.TupleListFuture)18 TupleStoreManager (org.bboxdb.storage.tuplestore.manager.TupleStoreManager)18 ByteBuffer (java.nio.ByteBuffer)17 BBoxDBException (org.bboxdb.misc.BBoxDBException)16 EmptyResultFuture (org.bboxdb.network.client.future.EmptyResultFuture)15 SSTableKeyIndexReader (org.bboxdb.storage.sstable.reader.SSTableKeyIndexReader)13 IOException (java.io.IOException)11 List (java.util.List)11 JoinedTupleListFuture (org.bboxdb.network.client.future.JoinedTupleListFuture)11 InsertTupleRequest (org.bboxdb.network.packages.request.InsertTupleRequest)11 StorageManagerException (org.bboxdb.storage.StorageManagerException)11 TupleBuilder (org.bboxdb.tools.converter.tuple.TupleBuilder)11