Package org.apache.cassandra.db

Examples of org.apache.cassandra.db.TimestampClock


    private static final TimestampReconciler reconciler = new TimestampReconciler();

    @Test
    public void testReconcileNormal()
    {
        TimestampClock leftClock = new TimestampClock(1);
        TimestampClock rightClock = new TimestampClock(2);

        Column left = new Column(
                "x".getBytes(),
                new byte[] {},
                leftClock);
View Full Code Here


    }

    @Test
    public void testReconcileDeleted()
    {
        TimestampClock leftClock = new TimestampClock(2);
        TimestampClock rightClock = new TimestampClock(1);

        Column left = new DeletedColumn(
                "x".getBytes(),
                new byte[] {},
                leftClock);
View Full Code Here

    {
        AtomicReference<IClock> atomicClock = new AtomicReference<IClock>(null);
       
        // atomic < new
        atomicClock.set(TimestampClock.MIN_VALUE);
        FBUtilities.atomicSetMax(atomicClock, new TimestampClock(1L));
        assert ((TimestampClock)atomicClock.get()).timestamp() == 1L;
       
        // atomic == new
        atomicClock.set(new TimestampClock(3L));
        FBUtilities.atomicSetMax(atomicClock, new TimestampClock(3L));
        assert ((TimestampClock)atomicClock.get()).timestamp() == 3L;

        // atomic > new
        atomicClock.set(new TimestampClock(9L));
        FBUtilities.atomicSetMax(atomicClock, new TimestampClock(3L));
        assert ((TimestampClock)atomicClock.get()).timestamp() == 9L;
    }
View Full Code Here

        File tempSS = tempSSTableFile("Keyspace1", "Standard1");
        ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "Standard1");
        SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
       
        // Add rowA
        cfamily.addColumn(new QueryPath("Standard1", null, "colA".getBytes()), "valA".getBytes(), new TimestampClock(1));
        writer.append(Util.dk("rowA"), cfamily);
        cfamily.clear();
       
        // Add rowB
        cfamily.addColumn(new QueryPath("Standard1", null, "colB".getBytes()), "valB".getBytes(), new TimestampClock(1));
        writer.append(Util.dk("rowB"), cfamily);
        cfamily.clear();
    
        writer.closeAndOpenReader();
       
View Full Code Here

        File tempSS = tempSSTableFile("Keyspace1", "Standard1");
        ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "Standard1");
        SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
       
        // Add rowA
        cfamily.addColumn(new QueryPath("Standard1", null, "colA".getBytes()), "valA".getBytes(), new TimestampClock(1));
        writer.append(Util.dk("rowA"), cfamily);
        cfamily.clear();
       
        // Add rowB
        cfamily.addColumn(new QueryPath("Standard1", null, "colB".getBytes()), "valB".getBytes(), new TimestampClock(1));
        writer.append(Util.dk("rowB"), cfamily);
        cfamily.clear();

        // Add rowExclude
        cfamily.addColumn(new QueryPath("Standard1", null, "colX".getBytes()), "valX".getBytes(), new TimestampClock(1));
        writer.append(Util.dk("rowExclude"), cfamily);
        cfamily.clear();

        SSTableReader reader = writer.closeAndOpenReader();
       
View Full Code Here

        File tempSS = tempSSTableFile("Keyspace1", "Super4");
        ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "Super4");
        SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
       
        // Add rowA
        cfamily.addColumn(new QueryPath("Super4", "superA".getBytes(), "colA".getBytes()), "valA".getBytes(), new TimestampClock(1));
        writer.append(Util.dk("rowA"), cfamily);
        cfamily.clear();
       
        // Add rowB
        cfamily.addColumn(new QueryPath("Super4", "superB".getBytes(), "colB".getBytes()), "valB".getBytes(), new TimestampClock(1));
        writer.append(Util.dk("rowB"), cfamily);
        cfamily.clear();

        // Add rowExclude
        cfamily.addColumn(new QueryPath("Super4", "superX".getBytes(), "colX".getBytes()), "valX".getBytes(), new TimestampClock(1));
        writer.append(Util.dk("rowExclude"), cfamily);
        cfamily.clear();

        SSTableReader reader = writer.closeAndOpenReader();
       
View Full Code Here

        File tempSS = tempSSTableFile("Keyspace1", "Standard1");
        ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "Standard1");
        SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
       
        // Add rowA
        cfamily.addColumn(new QueryPath("Standard1", null, "name".getBytes()), "val".getBytes(), new TimestampClock(1));
        writer.append(Util.dk("rowA"), cfamily);
        cfamily.clear();

        // Add rowExclude
        cfamily.addColumn(new QueryPath("Standard1", null, "name".getBytes()), "val".getBytes(), new TimestampClock(1));
        writer.append(Util.dk("rowExclude"), cfamily);
        cfamily.clear();

        SSTableReader reader = writer.closeAndOpenReader();
       
View Full Code Here

    {
        AtomicReference<IClock> atomicClock = new AtomicReference<IClock>(null);
       
        // atomic < new
        atomicClock.set(TimestampClock.MIN_VALUE);
        FBUtilities.atomicSetMax(atomicClock, new TimestampClock(1L));
        assert ((TimestampClock)atomicClock.get()).timestamp() == 1L;
       
        // atomic == new
        atomicClock.set(new TimestampClock(3L));
        FBUtilities.atomicSetMax(atomicClock, new TimestampClock(3L));
        assert ((TimestampClock)atomicClock.get()).timestamp() == 3L;

        // atomic > new
        atomicClock.set(new TimestampClock(9L));
        FBUtilities.atomicSetMax(atomicClock, new TimestampClock(3L));
        assert ((TimestampClock)atomicClock.get()).timestamp() == 9L;
    }
View Full Code Here

{
    @Test
    public void testResolveSupersetNewer()
    {
        ColumnFamily cf1 = ColumnFamily.create("Keyspace1", "Standard1");
        cf1.addColumn(column("c1", "v1", new TimestampClock(0)));

        ColumnFamily cf2 = ColumnFamily.create("Keyspace1", "Standard1");
        cf2.addColumn(column("c1", "v2", new TimestampClock(1)));

        ColumnFamily resolved = ReadResponseResolver.resolveSuperset(Arrays.asList(cf1, cf2));
        assertColumns(resolved, "c1");
        assertColumns(ColumnFamily.diff(cf1, resolved), "c1");
        assertNull(ColumnFamily.diff(cf2, resolved));
View Full Code Here

    @Test
    public void testResolveSupersetDisjoint()
    {
        ColumnFamily cf1 = ColumnFamily.create("Keyspace1", "Standard1");
        cf1.addColumn(column("c1", "v1", new TimestampClock(0)));

        ColumnFamily cf2 = ColumnFamily.create("Keyspace1", "Standard1");
        cf2.addColumn(column("c2", "v2", new TimestampClock(1)));

        ColumnFamily resolved = ReadResponseResolver.resolveSuperset(Arrays.asList(cf1, cf2));
        assertColumns(resolved, "c1", "c2");
        assertColumns(ColumnFamily.diff(cf1, resolved), "c2");
        assertColumns(ColumnFamily.diff(cf2, resolved), "c1");
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.TimestampClock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.