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


Java SnapshotRegistry類代碼示例

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


SnapshotRegistry類屬於org.voltdb.sysprocs包,在下文中一共展示了SnapshotRegistry類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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

示例6: getStatsRowKeyIterator

import org.voltdb.sysprocs.SnapshotRegistry; //導入依賴的package包/類
@Override
protected Iterator<Object> getStatsRowKeyIterator(boolean interval) {
    return new StatusIterator(SnapshotRegistry.getSnapshotHistory().iterator());
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:5,代碼來源:SnapshotStatus.java

示例7: createSetupInternal

import org.voltdb.sysprocs.SnapshotRegistry; //導入依賴的package包/類
Callable<Boolean> createSetupInternal(String file_path,
                                                String file_nonce,
                                                long txnId,
                                                Map<Integer, Long> partitionTransactionIds,
                                                JSONObject jsData,
                                                SystemProcedureExecutionContext context,
                                                final VoltTable result,
                                                Map<String, Map<Integer, Pair<Long, Long>>> exportSequenceNumbers,
                                                SiteTracker tracker,
                                                HashinatorSnapshotData hashinatorData,
                                                long timestamp,
                                                int newPartitionCount)
{
    assert(SnapshotSiteProcessor.ExecutionSitesCurrentlySnapshotting.isEmpty());

    if (TheHashinator.getConfiguredHashinatorType() == HashinatorType.ELASTIC && hashinatorData == null) {
        throw new RuntimeException("No hashinator data provided for elastic hashinator type.");
    }

    final List<Table> tables = SnapshotUtil.getTablesToSave(context.getDatabase());
    m_snapshotRecord =
        SnapshotRegistry.startSnapshot(
                txnId,
                context.getHostId(),
                file_path,
                file_nonce,
                SnapshotFormat.NATIVE,
                tables.toArray(new Table[0]));

    final ArrayList<SnapshotTableTask> partitionedSnapshotTasks =
        new ArrayList<SnapshotTableTask>();
    final ArrayList<SnapshotTableTask> replicatedSnapshotTasks =
        new ArrayList<SnapshotTableTask>();
    for (final Table table : tables) {
        final SnapshotTableTask task =
                new SnapshotTableTask(
                        table,
                        new SnapshotDataFilter[0],
                        null,
                        false);

        SNAP_LOG.debug("ADDING TASK: " + task);

        if (table.getIsreplicated()) {
            replicatedSnapshotTasks.add(task);
        } else {
            partitionedSnapshotTasks.add(task);
        }

        result.addRow(context.getHostId(),
                CoreUtils.getHostnameOrAddress(),
                table.getTypeName(),
                "SUCCESS",
                "");
    }

    if (!tables.isEmpty() && replicatedSnapshotTasks.isEmpty() && partitionedSnapshotTasks.isEmpty()) {
        SnapshotRegistry.discardSnapshot(m_snapshotRecord);
    }

    // Native snapshots place the partitioned tasks on every site and round-robin the
    // replicated tasks across all the sites on every host
    placePartitionedTasks(partitionedSnapshotTasks, tracker.getSitesForHost(context.getHostId()));
    placeReplicatedTasks(replicatedSnapshotTasks, tracker.getSitesForHost(context.getHostId()));

    // All IO work will be deferred and be run on the dedicated snapshot IO thread
    return createDeferredSetup(file_path, file_nonce, txnId, partitionTransactionIds, context,
            exportSequenceNumbers, tracker, hashinatorData, timestamp,
            newPartitionCount, tables, m_snapshotRecord, partitionedSnapshotTasks,
            replicatedSnapshotTasks);
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:72,代碼來源:NativeSnapshotWritePlan.java


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