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


Java UntypedResultSet.size方法代码示例

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


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

示例1: replayAllFailedBatches

import org.apache.cassandra.cql3.UntypedResultSet; //导入方法依赖的package包/类
private void replayAllFailedBatches() throws ExecutionException, InterruptedException
{
    logger.debug("Started replayAllFailedBatches");

    // rate limit is in bytes per second. Uses Double.MAX_VALUE if disabled (set to 0 in cassandra.yaml).
    // max rate is scaled by the number of nodes in the cluster (same as for HHOM - see CASSANDRA-5272).
    int throttleInKB = DatabaseDescriptor.getBatchlogReplayThrottleInKB() / StorageService.instance.getTokenMetadata().getAllEndpoints().size();
    RateLimiter rateLimiter = RateLimiter.create(throttleInKB == 0 ? Double.MAX_VALUE : throttleInKB * 1024);

    UntypedResultSet page = executeInternal(String.format("SELECT id, data, written_at, version FROM %s.%s LIMIT %d",
                                                          Keyspace.SYSTEM_KS,
                                                          SystemKeyspace.BATCHLOG_CF,
                                                          PAGE_SIZE));

    while (!page.isEmpty())
    {
        UUID id = processBatchlogPage(page, rateLimiter);

        if (page.size() < PAGE_SIZE)
            break; // we've exhausted the batchlog, next query would be empty.

        page = executeInternal(String.format("SELECT id, data, written_at, version FROM %s.%s WHERE token(id) > token(?) LIMIT %d",
                                             Keyspace.SYSTEM_KS,
                                             SystemKeyspace.BATCHLOG_CF,
                                             PAGE_SIZE),
                               id);
    }

    cleanup();

    logger.debug("Finished replayAllFailedBatches");
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:33,代码来源:BatchlogManager.java

示例2: run

import org.apache.cassandra.cql3.UntypedResultSet; //导入方法依赖的package包/类
public void run()
{
    UntypedResultSet res = processInternal("SELECT * FROM system." + SystemKeyspace.RANGE_XFERS_CF);

    if (res.size() < 1)
    {
        LOG.debug("No queued ranges to transfer");
        return;
    }

    if (!isReady())
        return;

    UntypedResultSet.Row row = res.iterator().next();

    Date requestedAt = row.getTimestamp("requested_at");
    ByteBuffer tokenBytes = row.getBytes("token_bytes");
    Token token = StorageService.getPartitioner().getTokenFactory().fromByteArray(tokenBytes);

    LOG.info("Initiating transfer of {} (scheduled at {})", token, requestedAt.toString());
    try
    {
        StorageService.instance.relocateTokens(Collections.singleton(token));
    }
    catch (Exception e)
    {
        LOG.error("Error removing {}: {}", token, e);
    }
    finally
    {
        LOG.debug("Removing queued entry for transfer of {}", token);
        processInternal(String.format("DELETE FROM system.%s WHERE token_bytes = '%s'",
                                      SystemKeyspace.RANGE_XFERS_CF,
                                      ByteBufferUtil.bytesToHex(tokenBytes)));
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:37,代码来源:ScheduledRangeTransferExecutorService.java

示例3: getNoOfHints

import org.apache.cassandra.cql3.UntypedResultSet; //导入方法依赖的package包/类
private int getNoOfHints()
{
    String req = "SELECT * FROM system.%s";
    UntypedResultSet resultSet = executeInternal(String.format(req, SystemKeyspace.HINTS_CF));
    return resultSet.size();
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:7,代码来源:HintedHandOffTest.java


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