Package org.apache.cassandra.db

Examples of org.apache.cassandra.db.DeletionInfo$Serializer


        // one CF with columns timestamped before a delete in another cf
        ColumnFamily cf1 = ColumnFamily.create("Keyspace1", "Standard1");
        cf1.addColumn(column("one", "A", 0));

        ColumnFamily cf2 = ColumnFamily.create("Keyspace1", "Standard1");
        cf2.delete(new DeletionInfo(1L, (int) (System.currentTimeMillis() / 1000)));

        ColumnFamily resolved = RowRepairResolver.resolveSuperset(Arrays.asList(cf1, cf2));
        // no columns in the cf
        assertColumns(resolved);
        assertTrue(resolved.isMarkedForDelete());
        assertEquals(1, resolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);

        ColumnFamily scf1 = ColumnFamily.create("Keyspace1", "Super1");
        scf1.addColumn(superColumn(scf1, "super-foo", column("one", "A", 0)));

        ColumnFamily scf2 = ColumnFamily.create("Keyspace1", "Super1");
        scf2.delete(new DeletionInfo(1L, (int) (System.currentTimeMillis() / 1000)));

        ColumnFamily superResolved = RowRepairResolver.resolveSuperset(Arrays.asList(scf1, scf2));
        // no columns in the cf
        assertColumns(superResolved);
        assertTrue(superResolved.isMarkedForDelete());
View Full Code Here


    public void testResolveDeletedSuper()
    {
        // subcolumn is newer than a tombstone on its parent, but not newer than the row deletion
        ColumnFamily scf1 = ColumnFamily.create("Keyspace1", "Super1");
        SuperColumn sc = superColumn(scf1, "super-foo", column("one", "A", 1));
        sc.delete(new DeletionInfo(0L, (int) (System.currentTimeMillis() / 1000)));
        scf1.addColumn(sc);

        ColumnFamily scf2 = ColumnFamily.create("Keyspace1", "Super1");
        scf2.delete(new DeletionInfo(2L, (int) (System.currentTimeMillis() / 1000)));

        ColumnFamily superResolved = RowRepairResolver.resolveSuperset(Arrays.asList(scf1, scf2));
        // no columns in the cf
        assertColumns(superResolved);
        assertTrue(superResolved.isMarkedForDelete());
View Full Code Here

    public void testResolveMultipleDeleted()
    {
        // deletes and columns with interleaved timestamp, with out of order return sequence

        ColumnFamily cf1 = ColumnFamily.create("Keyspace1", "Standard1");
        cf1.delete(new DeletionInfo(0L, (int) (System.currentTimeMillis() / 1000)));

        // these columns created after the previous deletion
        ColumnFamily cf2 = ColumnFamily.create("Keyspace1", "Standard1");
        cf2.addColumn(column("one", "A", 1));
        cf2.addColumn(column("two", "A", 1));

        //this column created after the next delete
        ColumnFamily cf3 = ColumnFamily.create("Keyspace1", "Standard1");
        cf3.addColumn(column("two", "B", 3));

        ColumnFamily cf4 = ColumnFamily.create("Keyspace1", "Standard1");
        cf4.delete(new DeletionInfo(2L, (int) (System.currentTimeMillis() / 1000)));

        ColumnFamily resolved = RowRepairResolver.resolveSuperset(Arrays.asList(cf1, cf2, cf3, cf4));
        // will have deleted marker and one column
        assertColumns(resolved, "two");
        assertColumn(resolved, "two", "B", 3);
        assertTrue(resolved.isMarkedForDelete());
        assertEquals(2, resolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);


        ColumnFamily scf1 = ColumnFamily.create("Keyspace1", "Super1");
        scf1.delete(new DeletionInfo(0L, (int) (System.currentTimeMillis() / 1000)));

        // these columns created after the previous deletion
        ColumnFamily scf2 = ColumnFamily.create("Keyspace1", "Super1");
        scf2.addColumn(superColumn(scf2, "super1", column("one", "A", 1), column("two", "A", 1)));

        //these columns created after the next delete
        ColumnFamily scf3 = ColumnFamily.create("Keyspace1", "Super1");
        scf3.addColumn(superColumn(scf3, "super1", column("two", "B", 3)));
        scf3.addColumn(superColumn(scf3, "super2", column("three", "A", 3), column("four", "A", 3)));

        ColumnFamily scf4 = ColumnFamily.create("Keyspace1", "Super1");
        scf4.delete(new DeletionInfo(2L, (int) (System.currentTimeMillis() / 1000)));

        ColumnFamily superResolved = RowRepairResolver.resolveSuperset(Arrays.asList(scf1, scf2, scf3, scf4));
        // will have deleted marker and two super cols
        assertColumns(superResolved, "super1", "super2");
View Full Code Here

        }

        if (columnContainer instanceof SuperColumn)
        {
            SuperColumn superColumn = (SuperColumn) columnContainer;
            DeletionInfo deletionInfo = new DeletionInfo(superColumn.getMarkedForDeleteAt(),
                    superColumn.getLocalDeletionTime());
            if (!deletionInfo.equals(DeletionInfo.LIVE))
            {
                writeKey(out, "metadata");
                writeDeletionInfo(out, deletionInfo.getTopLevelDeletion());
                out.print(",");
            }
            return;
        }
    }
View Full Code Here

        ColumnFamily cf = rm.addOrGet(columnFamily());

        if (columns.isEmpty() && builder.componentCount() == 0)
        {
            // No columns, delete the row
            cf.delete(new DeletionInfo(params.timestamp, params.localDeletionTime));
        }
        else
        {
            if (isRange)
            {
View Full Code Here

        ColumnFamily cf = rm.addOrGet(columnFamily());

        if (toRemove.isEmpty() && builder.componentCount() == 0)
        {
            // No columns specified, delete the row
            cf.delete(new DeletionInfo(params.timestamp, params.localDeletionTime));
        }
        else
        {
            if (isRange)
            {
View Full Code Here

        }

        if (columnContainer instanceof SuperColumn)
        {
            SuperColumn superColumn = (SuperColumn) columnContainer;
            DeletionInfo deletionInfo = new DeletionInfo(superColumn.getMarkedForDeleteAt(),
                    superColumn.getLocalDeletionTime());
            if (!deletionInfo.equals(DeletionInfo.LIVE))
            {
                writeKey(out, "metadata");
                writeDeletionInfo(out, deletionInfo.getTopLevelDeletion());
                out.print(",");
            }
            return;
        }
    }
View Full Code Here

        {
            Map<?, ?> unparsedDeletionInfo = (Map<?, ?>) map.get("deletionInfo");
            Number number = (Number) unparsedDeletionInfo.get("markedForDeleteAt");
            long markedForDeleteAt = number instanceof Long ? (Long) number : ((Integer) number).longValue();
            int localDeletionTime = (Integer) unparsedDeletionInfo.get("localDeletionTime");
            columnContainer.setDeletionInfo(new DeletionInfo(markedForDeleteAt, localDeletionTime));
        }
    }
View Full Code Here

        {
            Map<?, ?> unparsedDeletionInfo = (Map<?, ?>) map.get("deletionInfo");
            Number number = (Number) unparsedDeletionInfo.get("markedForDeleteAt");
            long markedForDeleteAt = number instanceof Long ? (Long) number : ((Integer) number).longValue();
            int localDeletionTime = (Integer) unparsedDeletionInfo.get("localDeletionTime");
            columnContainer.setDeletionInfo(new DeletionInfo(markedForDeleteAt, localDeletionTime));
        }
    }
View Full Code Here

        }

        if (columnContainer instanceof SuperColumn)
        {
            SuperColumn superColumn = (SuperColumn) columnContainer;
            DeletionInfo deletionInfo = new DeletionInfo(superColumn.getMarkedForDeleteAt(),
                    superColumn.getLocalDeletionTime());
            if (!deletionInfo.equals(DeletionInfo.LIVE))
            {
                writeKey(out, "metadata");
                writeDeletionInfo(out, deletionInfo.getTopLevelDeletion());
                out.print(",");
            }
            return;
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.DeletionInfo$Serializer

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.