當前位置: 首頁>>代碼示例>>Java>>正文


Java SnapshotRegistry.Snapshot方法代碼示例

本文整理匯總了Java中org.voltdb.sysprocs.SnapshotRegistry.Snapshot方法的典型用法代碼示例。如果您正苦於以下問題:Java SnapshotRegistry.Snapshot方法的具體用法?Java SnapshotRegistry.Snapshot怎麽用?Java SnapshotRegistry.Snapshot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.voltdb.sysprocs.SnapshotRegistry的用法示例。


在下文中一共展示了SnapshotRegistry.Snapshot方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.voltdb.sysprocs.SnapshotRegistry; //導入方法依賴的package包/類
@Override
public void run() {
    m_snapshotRecord.updateTable(m_tableName,
            new SnapshotRegistry.Snapshot.TableUpdater() {
                @Override
                public SnapshotRegistry.Snapshot.Table update(
                    SnapshotRegistry.Snapshot.Table registryTable) {
                    return m_snapshotRecord.new Table(
                        registryTable,
                        m_sdt.getBytesWritten(),
                        m_sdt.getLastWriteException());
                    }
            });
    int tablesLeft = m_numTables.decrementAndGet();
    if (tablesLeft == 0) {
        final SnapshotRegistry.Snapshot completed =
            SnapshotRegistry.finishSnapshot(m_snapshotRecord);
        final double duration =
            (completed.timeFinished - completed.timeStarted) / 1000.0;
        SNAP_LOG.info(
                "Snapshot " + m_snapshotRecord.nonce + " finished at " +
                completed.timeFinished + " and took " + duration
                + " seconds ");
    }
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:26,代碼來源:SnapshotWritePlan.java

示例2: createDataTargetForTable

import org.voltdb.sysprocs.SnapshotRegistry; //導入方法依賴的package包/類
private SnapshotDataTarget createDataTargetForTable(String file_path,
                                                    String file_nonce,
                                                    int hostId,
                                                    AtomicInteger numTables,
                                                    SnapshotRegistry.Snapshot snapshotRecord,
                                                    Table table)
        throws IOException
{
    SnapshotDataTarget sdt;
    File saveFilePath = SnapshotUtil.constructFileForTable(
            table,
            file_path,
            file_nonce,
            SnapshotFormat.CSV,
            hostId);

    sdt = new SimpleFileSnapshotDataTarget(saveFilePath, !table.getIsreplicated());

    m_targets.add(sdt);
    final Runnable onClose = new TargetStatsClosure(sdt, table.getTypeName(), numTables, snapshotRecord);
    sdt.setOnCloseHandler(onClose);

    return sdt;
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:25,代碼來源:CSVSnapshotWritePlan.java

示例3: TargetStatsClosure

import org.voltdb.sysprocs.SnapshotRegistry; //導入方法依賴的package包/類
TargetStatsClosure(SnapshotDataTarget sdt, String tableName,
        AtomicInteger numTables,
        SnapshotRegistry.Snapshot snapshotRecord)
{
    m_sdt = sdt;
    m_tableName = tableName;
    m_numTables = numTables;
    m_snapshotRecord = snapshotRecord;
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:10,代碼來源:SnapshotWritePlan.java

示例4: createTasksForTable

import org.voltdb.sysprocs.SnapshotRegistry; //導入方法依賴的package包/類
/**
 * For each site, generate a task for each target it has for this table.
 */
private void createTasksForTable(Table table,
                                 List<DataTargetInfo> dataTargets,
                                 AtomicInteger numTables,
                                 SnapshotRegistry.Snapshot snapshotRecord)
{
    // srcHSId -> tasks
    Multimap<Long, SnapshotTableTask> tasks = ArrayListMultimap.create();
    for (DataTargetInfo targetInfo : dataTargets) {
        final Runnable onClose = new TargetStatsClosure(targetInfo.dataTarget,
                                                        table.getTypeName(),
                                                        numTables,
                                                        snapshotRecord);
        targetInfo.dataTarget.setOnCloseHandler(onClose);

        final SnapshotTableTask task =
            new SnapshotTableTask(table,
                                  new SnapshotDataFilter[0], // This task no longer needs partition filtering
                                  null,
                                  false);
        task.setTarget(targetInfo.dataTarget);

        tasks.put(targetInfo.srcHSId, task);
        m_targets.add(targetInfo.dataTarget);
    }

    placeTasksForTable(table, tasks);
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:31,代碼來源:StreamSnapshotWritePlan.java

示例5: createTasksForTable

import org.voltdb.sysprocs.SnapshotRegistry; //導入方法依賴的package包/類
/**
 * For each site, generate a task for each target it has for this table.
 */
private void createTasksForTable(Table table,
                                 Collection<IndexSnapshotRequestConfig.PartitionRanges> partitionRanges,
                                 Map<Integer, Long> pidToLocalHSIDs,
                                 AtomicInteger numTables,
                                 SnapshotRegistry.Snapshot snapshotRecord)
{
    // no work on this node
    if (pidToLocalHSIDs.isEmpty()) {
        return;
    }

    // create a null data target
    final DevNullSnapshotTarget dataTarget = new DevNullSnapshotTarget();
    final Runnable onClose = new TargetStatsClosure(dataTarget,
                                                    table.getTypeName(),
                                                    numTables,
                                                    snapshotRecord);
    dataTarget.setOnCloseHandler(onClose);
    m_targets.add(dataTarget);

    // go over all local sites, create a task for each source site
    for (IndexSnapshotRequestConfig.PartitionRanges partitionRange : partitionRanges) {
        Long localHSId = pidToLocalHSIDs.get(partitionRange.partitionId);

        // The partition may not exist on this node. If so, keep calm and carry on
        if (localHSId != null) {
            // based on the source partition, the predicate is different
            final SnapshotTableTask task =
                new SnapshotTableTask(table,
                                      new SnapshotDataFilter[0],
                                      createIndexExpressionForTable(table, partitionRange.ranges),
                                      false);
            task.setTarget(dataTarget);

            placeTask(task, Arrays.asList(localHSId));
        }
    }
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:42,代碼來源:IndexSnapshotWritePlan.java


注:本文中的org.voltdb.sysprocs.SnapshotRegistry.Snapshot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。