当前位置: 首页>>代码示例>>Java>>正文


Java SSTableIdentityIterator.next方法代码示例

本文整理汇总了Java中org.apache.cassandra.io.sstable.SSTableIdentityIterator.next方法的典型用法代码示例。如果您正苦于以下问题:Java SSTableIdentityIterator.next方法的具体用法?Java SSTableIdentityIterator.next怎么用?Java SSTableIdentityIterator.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.io.sstable.SSTableIdentityIterator的用法示例。


在下文中一共展示了SSTableIdentityIterator.next方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cleanup

import org.apache.cassandra.io.sstable.SSTableIdentityIterator; //导入方法依赖的package包/类
@Override
public SSTableIdentityIterator cleanup(SSTableIdentityIterator row)
{
    if (Range.isInRanges(row.getKey().getToken(), ranges))
        return row;

    cfs.invalidateCachedRow(row.getKey());

    if (indexedColumnsInRow != null)
        indexedColumnsInRow.clear();

    while (row.hasNext())
    {
        OnDiskAtom column = row.next();

        if (column instanceof Cell && cfs.indexManager.indexes((Cell) column))
        {
            if (indexedColumnsInRow == null)
                indexedColumnsInRow = new ArrayList<>();

            indexedColumnsInRow.add((Cell) column);
        }
    }

    if (indexedColumnsInRow != null && !indexedColumnsInRow.isEmpty())
    {
        // acquire memtable lock here because secondary index deletion may cause a race. See CASSANDRA-3712
        try (OpOrder.Group opGroup = cfs.keyspace.writeOrder.start())
        {
            cfs.indexManager.deleteFromIndexes(row.getKey(), indexedColumnsInRow, opGroup);
        }
    }
    return null;
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:35,代码来源:CompactionManager.java

示例2: cleanup

import org.apache.cassandra.io.sstable.SSTableIdentityIterator; //导入方法依赖的package包/类
@Override
public SSTableIdentityIterator cleanup(SSTableIdentityIterator row)
{
    if (Range.isInRanges(row.getKey().token, ranges))
        return row;

    cfs.invalidateCachedRow(row.getKey());

    if (indexedColumnsInRow != null)
        indexedColumnsInRow.clear();

    while (row.hasNext())
    {
        OnDiskAtom column = row.next();

        if (column instanceof Cell && cfs.indexManager.indexes((Cell) column))
        {
            if (indexedColumnsInRow == null)
                indexedColumnsInRow = new ArrayList<>();

            indexedColumnsInRow.add((Cell) column);
        }
    }

    if (indexedColumnsInRow != null && !indexedColumnsInRow.isEmpty())
    {
        // acquire memtable lock here because secondary index deletion may cause a race. See CASSANDRA-3712
        try (OpOrder.Group opGroup = cfs.keyspace.writeOrder.start())
        {
            cfs.indexManager.deleteFromIndexes(row.getKey(), indexedColumnsInRow, opGroup);
        }
    }
    return null;
}
 
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:35,代码来源:CompactionManager.java

示例3: serializeColumns

import org.apache.cassandra.io.sstable.SSTableIdentityIterator; //导入方法依赖的package包/类
private void serializeColumns(StringBuilder sb, SSTableIdentityIterator rowIterator, Mapper.Context context) {
    while (rowIterator.hasNext()) {
        OnDiskAtom atom = rowIterator.next();
        if (atom instanceof IColumn) {
            IColumn column = (IColumn) atom;
            String cn = getColumnName(column.name(), columnNameConverter);
            sb.append("[\"");
            sb.append(cn);
            sb.append("\", \"");
            sb.append(JSONObject.escape(getColumnValueConvertor(handleCompositeColumnName(cn), BytesType.instance).getString(column.value())));
            sb.append("\", ");
            sb.append(column.timestamp());

            if (column instanceof DeletedColumn) {
                sb.append(", ");
                sb.append("\"d\"");
            } else if (column instanceof ExpiringColumn) {
                sb.append(", ");
                sb.append("\"e\"");
                sb.append(", ");
                sb.append(((ExpiringColumn) column).getTimeToLive());
                sb.append(", ");
                sb.append(column.getLocalDeletionTime());
            } else if (column instanceof CounterColumn) {
                sb.append(", ");
                sb.append("\"c\"");
                sb.append(", ");
                sb.append(((CounterColumn) column).timestampOfLastDelete());
            }
            sb.append("]");
            if (rowIterator.hasNext()) {
                sb.append(", ");
            }
        } else if (atom instanceof RangeTombstone) {
            context.getCounter("Columns", "Range Tombstone Found").increment(1L);
        }
    }
}
 
开发者ID:fullcontact,项目名称:hadoop-sstable,代码行数:39,代码来源:JsonColumnParser.java

示例4: next

import org.apache.cassandra.io.sstable.SSTableIdentityIterator; //导入方法依赖的package包/类
@Override
public boolean next() {
    if (!scanner.hasNext()) {
        try {
            scanner.close();
        } catch (Throwable t) {}
        return false;
    }
    SSTableIdentityIterator row = (SSTableIdentityIterator) scanner.next();
    this.partitionStats = new PartitionStatistics(row.getKey());
    DeletionInfo deletionInfo = row.getColumnFamily().deletionInfo();
    this.tableStats.partitionCount++;
    if (!deletionInfo.getTopLevelDeletion().isLive()) {
        this.tableStats.partitionDeleteCount++;
    }
    this.partitionStats.cellCount = 0;
    this.partitionStats.tombstoneCount = 0;
    while (row.hasNext()) {
        OnDiskAtom atom = row.next();
        if (atom instanceof Cell) {
            Cell cell = (Cell) atom;
            this.partitionStats.cellCount++;
            this.tableStats.cellCount++;
            if (cell.isLive(gcGrace)) {
                this.tableStats.liveCellCount++;
            }
        }
        if (atom instanceof DeletedCell) {
            this.tableStats.deleteCellCount++;
            this.partitionStats.tombstoneCount++;
            this.tableStats.tombstoneCount++;
            if (atom.getLocalDeletionTime() < gcGrace) {
                this.partitionStats.droppableTombstoneCount++;
                this.tableStats.droppableTombstoneCount++;
            }
        } else if (atom instanceof ExpiringCell) {
            this.tableStats.expiringCellCount++;
        } else if (atom instanceof CounterCell) {
            this.tableStats.counterCellCount++;
        } else if (atom instanceof RangeTombstone) {
            this.tableStats.rangeTombstoneCount++;
            this.partitionStats.tombstoneCount++;
            this.tableStats.tombstoneCount++;
            if (atom.getLocalDeletionTime() < gcGrace) {
                this.partitionStats.droppableTombstoneCount++;
                this.tableStats.droppableTombstoneCount++;
            }
        }
    }
    long currentPosition = scanner.getCurrentPosition();
    this.partitionStats.size = currentPosition - position;
    position = currentPosition;
    this.tableStats.maxPartitionSize = Math.max(this.partitionStats.size, this.tableStats.maxPartitionSize);
    return true;
}
 
开发者ID:instaclustr,项目名称:cassandra-sstable-tools,代码行数:56,代码来源:DataReader.java

示例5: next

import org.apache.cassandra.io.sstable.SSTableIdentityIterator; //导入方法依赖的package包/类
@Override
public boolean next() {
    if (!scanner.hasNext()) {
        try {
            scanner.close();
        } catch (Throwable t) {}
        return false;
    }
    SSTableIdentityIterator row = (SSTableIdentityIterator) scanner.next();
    this.partitionStats = new PartitionStatistics(row.getKey());
    DeletionInfo deletionInfo = row.getColumnFamily().deletionInfo();
    this.tableStats.partitionCount++;
    if (!deletionInfo.getTopLevelDeletion().isLive()) {
        this.tableStats.partitionDeleteCount++;
    }
    this.partitionStats.cellCount = 0;
    this.partitionStats.tombstoneCount = 0;
    while (row.hasNext()) {
        OnDiskAtom atom = row.next();
        if (atom instanceof Column) {
            Column cell = (Column) atom;
            this.partitionStats.cellCount++;
            this.tableStats.cellCount++;
            if (cell.isLive(gcGrace)) {
                this.tableStats.liveCellCount++;
            }
        }
        if (atom instanceof DeletedColumn) {
            this.tableStats.deleteCellCount++;
            this.partitionStats.tombstoneCount++;
            this.tableStats.tombstoneCount++;
            if (atom.getLocalDeletionTime() < gcGrace) {
                this.partitionStats.droppableTombstoneCount++;
                this.tableStats.droppableTombstoneCount++;
            }
        } else if (atom instanceof ExpiringColumn) {
            this.tableStats.expiringCellCount++;
        } else if (atom instanceof CounterColumn) {
            this.tableStats.counterCellCount++;
        } else if (atom instanceof RangeTombstone) {
            this.tableStats.rangeTombstoneCount++;
            this.partitionStats.tombstoneCount++;
            this.tableStats.tombstoneCount++;
            if (atom.getLocalDeletionTime() < gcGrace) {
                this.partitionStats.droppableTombstoneCount++;
                this.tableStats.droppableTombstoneCount++;
            }
        }
    }
    long currentPosition = scanner.getCurrentPosition();
    this.partitionStats.size = currentPosition - position;
    position = currentPosition;
    this.tableStats.maxPartitionSize = Math.max(this.partitionStats.size, this.tableStats.maxPartitionSize);
    return true;
}
 
开发者ID:instaclustr,项目名称:cassandra-sstable-tools,代码行数:56,代码来源:DataReader.java

示例6: run

import org.apache.cassandra.io.sstable.SSTableIdentityIterator; //导入方法依赖的package包/类
private static void run(Descriptor desc, CommandLine cmd, PrintStream out) throws IOException {
  // Since we don't have a schema, make one up!
  CFMetaData cfm = new CFMetaData(desc.ksname, desc.cfname, ColumnFamilyType.Standard,
                                  UTF8Type.instance, UTF8Type.instance);

  SSTableReader reader = SSTableReader.open(desc, cfm);
  SSTableScanner scanner = reader.getScanner();

  long totalTombstones = 0, totalColumns = 0;
  if (cmd.hasOption("l")) {
    out.printf(desc.baseFilename() + "\n");
    out.printf("rowkey #tombstones (#columns)\n");
  }
  while (scanner.hasNext()) {
    SSTableIdentityIterator row = (SSTableIdentityIterator) scanner.next();

    int tombstonesCount = 0, columnsCount = 0;
    while (row.hasNext())
    {
      OnDiskAtom column = row.next();
      long now = System.currentTimeMillis();
      if (column instanceof Column && ((Column) column).isMarkedForDelete(now)) {
        tombstonesCount++;
      }
      columnsCount++;
    }
    totalTombstones += tombstonesCount;
    totalColumns += columnsCount;

    if (tombstonesCount > 0) {
      String key;
      try {
        key = UTF8Type.instance.getString(row.getKey().key);
      } catch (RuntimeException e) {
        key = BytesType.instance.getString(row.getKey().key);
      }
      out.printf("%s %d (%d)%n", key, tombstonesCount, columnsCount);
    }

  }

  if (cmd.hasOption("l")) {
    out.printf("#total_tombstones (#total_columns)\n");
  }
  out.printf("%d (%d)%n", totalTombstones, totalColumns);

  scanner.close();
}
 
开发者ID:spotify,项目名称:cassandra-opstools,代码行数:49,代码来源:CountTombstones.java


注:本文中的org.apache.cassandra.io.sstable.SSTableIdentityIterator.next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。