Search in sources :

Example 1 with AbstractRow

use of org.apache.cassandra.db.rows.AbstractRow in project cassandra by apache.

the class RepairedDataTombstonesTest method verify2.

private void verify2(int key, int expectedRows, int minVal, int maxVal, boolean includePurgeable) {
    ReadCommand cmd = Util.cmd(getCurrentColumnFamilyStore(), Util.dk(ByteBufferUtil.bytes(key))).build();
    int foundRows = 0;
    try (ReadExecutionController executionController = cmd.executionController();
        UnfilteredPartitionIterator iterator = includePurgeable ? cmd.queryStorage(getCurrentColumnFamilyStore(), executionController) : cmd.executeLocally(executionController)) {
        while (iterator.hasNext()) {
            try (UnfilteredRowIterator rowIter = iterator.next()) {
                while (rowIter.hasNext()) {
                    AbstractRow row = (AbstractRow) rowIter.next();
                    for (int i = 0; i < row.clustering().size(); i++) {
                        foundRows++;
                        int val = ByteBufferUtil.toInt(row.clustering().get(i));
                        assertTrue("val=" + val, val >= minVal && val < maxVal);
                    }
                }
            }
        }
    }
    assertEquals(expectedRows, foundRows);
}
Also used : UnfilteredRowIterator(org.apache.cassandra.db.rows.UnfilteredRowIterator) AbstractRow(org.apache.cassandra.db.rows.AbstractRow) UnfilteredPartitionIterator(org.apache.cassandra.db.partitions.UnfilteredPartitionIterator)

Example 2 with AbstractRow

use of org.apache.cassandra.db.rows.AbstractRow in project cassandra by apache.

the class RepairedDataTombstonesTest method verify.

private void verify(int expectedRows, int minVal, int maxVal, boolean includePurgeable) {
    ReadCommand cmd = Util.cmd(getCurrentColumnFamilyStore()).build();
    int foundRows = 0;
    try (ReadExecutionController executionController = cmd.executionController();
        UnfilteredPartitionIterator iterator = includePurgeable ? cmd.queryStorage(getCurrentColumnFamilyStore(), executionController) : cmd.executeLocally(executionController)) {
        while (iterator.hasNext()) {
            try (UnfilteredRowIterator rowIter = iterator.next()) {
                if (// partition key 999 is 'live' and used to avoid sstables from being dropped
                !rowIter.partitionKey().equals(Util.dk(ByteBufferUtil.bytes(999)))) {
                    while (rowIter.hasNext()) {
                        AbstractRow row = (AbstractRow) rowIter.next();
                        for (int i = 0; i < row.clustering().size(); i++) {
                            foundRows++;
                            int val = ByteBufferUtil.toInt(row.clustering().get(i));
                            assertTrue("val=" + val, val >= minVal && val < maxVal);
                        }
                    }
                }
            }
        }
    }
    assertEquals(expectedRows, foundRows);
}
Also used : UnfilteredRowIterator(org.apache.cassandra.db.rows.UnfilteredRowIterator) AbstractRow(org.apache.cassandra.db.rows.AbstractRow) UnfilteredPartitionIterator(org.apache.cassandra.db.partitions.UnfilteredPartitionIterator)

Aggregations

UnfilteredPartitionIterator (org.apache.cassandra.db.partitions.UnfilteredPartitionIterator)2 AbstractRow (org.apache.cassandra.db.rows.AbstractRow)2 UnfilteredRowIterator (org.apache.cassandra.db.rows.UnfilteredRowIterator)2