Package org.voltdb

Examples of org.voltdb.DependencyPair


            if (fragmentId == SysProcFragmentId.PF_quiesce_sites) {
                // tell each site to quiesce
                context.getSiteProcedureConnection().quiesce();
                VoltTable results = new VoltTable(new ColumnInfo("id", VoltType.BIGINT));
                results.addRow(context.getSiteId());
                return new DependencyPair(DEP_SITES, results);
            }
            else if (fragmentId == SysProcFragmentId.PF_quiesce_processed_sites) {
                VoltTable dummy = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA);
                dummy.addRow(VoltSystemProcedure.STATUS_OK);
                return new DependencyPair(DEP_PROCESSED_SITES, dummy);
            }
        }
        catch (Exception ex) {
            ex.printStackTrace();
        }
View Full Code Here


            VoltDB.instance().getHostMessenger().prepareForShutdown();
            if (!m_failsafeArmed.getAndSet(true)) {
                m_failsafe.start();
                new VoltLogger("HOST").warn("VoltDB shutdown operation requested and in progress.  Cluster will terminate shortly.");
            }
            return new DependencyPair(DEP_shutdownSync,
                    new VoltTable(new ColumnInfo[] { new ColumnInfo("HA", VoltType.STRING) } ));
        }
        else if (fragmentId == SysProcFragmentId.PF_shutdownSyncDone) {
            return new DependencyPair(DEP_shutdownSyncDone,
                    new VoltTable(new ColumnInfo[] { new ColumnInfo("HA", VoltType.STRING) } ));
        }
        else if (fragmentId == SysProcFragmentId.PF_shutdownCommand) {
            Thread shutdownThread = new Thread() {
                @Override
View Full Code Here

                // must continue and reply with dependency.
                e.printStackTrace();
                // report -1 rows inserted, though this might be false
                result.addRow(-1);
            }
            return new DependencyPair(DEP_distribute, result);

        } else if (fragmentId == SysProcFragmentId.PF_aggregate) {
            long[] modifiedTuples = new long[context.getNumberOfPartitions()];
            List<VoltTable> deps = dependencies.get(DEP_distribute);
            assert(deps.size() > 0);

            // go through all the deps and find one mod tuple count per partition
            for (VoltTable t : deps) {
                t.advanceRow();
                int partitionId = (int) t.getLong(0);
                t.advanceRow();
                long rowsModified = t.getLong(0);

                if (modifiedTuples[partitionId] == 0) {
                    modifiedTuples[partitionId] = rowsModified;
                }
                else {
                    if (modifiedTuples[partitionId] != rowsModified)
                        throw new RuntimeException(
                                "@LoadMultipartitionTable received different tuple mod counts from two replicas.");
                }
            }

            // sum up all the modified rows from all partitions
            long rowsModified = 0;
            for (long l : modifiedTuples)
                rowsModified += l;

            result.addRow(rowsModified);
            return new DependencyPair(DEP_aggregate, result);
        }

        // must handle every dependency id.
        assert (false);
        return null;
View Full Code Here

                    Longs.toArray(tableIds), (Integer)params.toArray()[0], (byte[])params.toArray()[1]);

            for (int ii = 0; ii < tableNames.size(); ii++) {
                results.addRow(context.getHostId(), CoreUtils.getSiteIdFromHSId(context.getSiteId()), context.getPartitionId(), tableNames.get(ii), mispartitionedCounts[ii]);
            }
            return new DependencyPair( DEP_validatePartitioning, results);

        } else if (fragmentId == SysProcFragmentId.PF_validatePartitioningResults) {

            assert (dependencies.size() > 0);
            final VoltTable results = VoltTableUtil.unionTables(dependencies.get(DEP_validatePartitioning));
            return new DependencyPair( DEP_validatePartitioningResults, results);

        } else if (fragmentId == SysProcFragmentId.PF_matchesHashinator) {

            final VoltTable matchesHashinator = constructHashinatorMatchesTable();

            byte [] configBytes = (byte[])params.toArray()[1];
            if (configBytes == null) {
                configBytes = LegacyHashinator.getConfigureBytes(0);
            }

            final long givenConfigurationSignature =
                    TheHashinator.computeConfigurationSignature(configBytes);

            matchesHashinator.addRow(
                    context.getHostId(),
                    CoreUtils.getSiteIdFromHSId(context.getSiteId()),
                    context.getPartitionId(),
                    givenConfigurationSignature == TheHashinator.getConfigurationSignature() ? (byte)1 : (byte)0);

            return new DependencyPair(DEP_matchesHashinator, matchesHashinator);

        } else if (fragmentId == SysProcFragmentId.PF_matchesHashinatorResults) {

            assert (dependencies.size() > 0);
            final VoltTable results = VoltTableUtil.unionTables(dependencies.get(DEP_matchesHashinator));
            return new DependencyPair( DEP_matchesHashinatorResults, results);

        }
        assert (false);
        return null;
    }
View Full Code Here

                result = new VoltTable(
                                       new ColumnInfo(CNAME_HOST_ID, CTYPE_ID),
                                       new ColumnInfo("KEY", VoltType.STRING),
                                       new ColumnInfo("VALUE", VoltType.STRING));
            }
            return new DependencyPair(DEP_DISTRIBUTE, result);
        }
        else if (fragmentId == SysProcFragmentId.PF_systemInformationOverviewAggregate)
        {
            VoltTable result = VoltTableUtil.unionTables(dependencies.get(DEP_DISTRIBUTE));
            return new DependencyPair(DEP_AGGREGATE, result);
        }
        else if (fragmentId == SysProcFragmentId.PF_systemInformationDeployment)
        {
            VoltTable result = null;
            // Choose the lowest site ID on this host to do the info gathering
            // All other sites should just return empty results tables.
            if (context.isLowestSiteId())
            {
                result = populateDeploymentProperties(context.getCluster(), context.getDatabase());
            }
            else
            {
                result = new VoltTable(clusterInfoSchema);
            }
            return new DependencyPair(DEP_systemInformationDeployment, result);
        }
        else if (fragmentId == SysProcFragmentId.PF_systemInformationAggregate)
        {
            VoltTable result = null;
            // Check for KEY/VALUE consistency
            List<VoltTable> answers =
                dependencies.get(DEP_systemInformationDeployment);
            for (VoltTable answer : answers)
            {
                // if we got an empty table from a non-lowest execution site ID,
                // ignore it
                if (answer.getRowCount() == 0)
                {
                    continue;
                }
                // Save the first real answer we got and compare all future
                // answers with it
                if (result == null)
                {
                    result = answer;
                }
                else
                {
                    if (!verifyReturnedTablesMatch(answer, result))
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.append("Inconsistent results returned for @SystemInformation: \n");
                        sb.append("Result #1: ");
                        sb.append(result.toString());
                        sb.append("\n");
                        sb.append("Result #2: ");
                        sb.append(answer.toString());
                        sb.append("\n");
                        hostLog.error(sb.toString());
                        throw new VoltAbortException(sb.toString());
                    }
                }
            }
            return new DependencyPair(DEP_systemInformationAggregate, result);
        }
        assert(false);
        return null;
    }
View Full Code Here

                }
            } catch (Exception e) {
                Throwables.propagate(e);
            }

            return new DependencyPair(DEP_updateCatalogSync,
                    new VoltTable(new ColumnInfo[] { new ColumnInfo("UNUSED", VoltType.BIGINT) } ));
        }
        else if (fragmentId == SysProcFragmentId.PF_updateCatalogPrecheckAndSyncAggregate) {
            // Don't actually care about the returned table, just need to send something
            // back to the MPI scoreboard
            return new DependencyPair(DEP_updateCatalogSyncAggregate,
                    new VoltTable(new ColumnInfo[] { new ColumnInfo("UNUSED", VoltType.BIGINT) } ));
        }
        else if (fragmentId == SysProcFragmentId.PF_updateCatalog) {
            String catalogDiffCommands = (String)params.toArray()[0];
            String commands = Encoder.decodeBase64AndDecompress(catalogDiffCommands);
            int expectedCatalogVersion = (Integer)params.toArray()[1];
            boolean requiresSnapshotIsolation = ((Byte) params.toArray()[2]) != 0;

            CatalogAndIds catalogStuff = null;
            try {
                catalogStuff = CatalogUtil.getCatalogFromZK(VoltDB.instance().getHostMessenger().getZK());
            } catch (Exception e) {
                Throwables.propagate(e);
            }

            String replayInfo = m_runner.getTxnState().isForReplay() ? " (FOR REPLAY)" : "";

            // if this is a new catalog, do the work to update
            if (context.getCatalogVersion() == expectedCatalogVersion) {

                // update the global catalog if we get there first
                @SuppressWarnings("deprecation")
                Pair<CatalogContext, CatalogSpecificPlanner> p =
                VoltDB.instance().catalogUpdate(
                        commands,
                        catalogStuff.catalogBytes,
                        catalogStuff.getCatalogHash(),
                        expectedCatalogVersion,
                        getVoltPrivateRealTransactionIdDontUseMe(),
                        getUniqueId(),
                        catalogStuff.getDeploymentHash());

                // update the local catalog.  Safe to do this thanks to the check to get into here.
                context.updateCatalog(commands, p.getFirst(), p.getSecond(), requiresSnapshotIsolation);

                log.info(String.format("Site %s completed catalog update with catalog hash %s, deployment hash %s%s.",
                        CoreUtils.hsIdToString(m_site.getCorrespondingSiteId()),
                        Encoder.hexEncode(catalogStuff.getCatalogHash()).substring(0, 10),
                        Encoder.hexEncode(catalogStuff.getDeploymentHash()).substring(0, 10),
                        replayInfo));
            }
            // if seen before by this code, then check to see if this is a restart
            else if ((context.getCatalogVersion() == (expectedCatalogVersion + 1) &&
                     (Arrays.equals(context.getCatalogHash(), catalogStuff.getCatalogHash()) &&
                      Arrays.equals(context.getDeploymentHash(), catalogStuff.getDeploymentHash()))))
            {
                log.info(String.format("Site %s will NOT apply an assumed restarted and identical catalog update with catalog hash %s and deployment hash %s.",
                            CoreUtils.hsIdToString(m_site.getCorrespondingSiteId()),
                            Encoder.hexEncode(catalogStuff.getCatalogHash()),
                            Encoder.hexEncode(catalogStuff.getDeploymentHash())));
            }
            else {
                VoltDB.crashLocalVoltDB("Invalid catalog update.  Expected version: " + expectedCatalogVersion +
                        ", current version: " + context.getCatalogVersion(), false, null);
            }

            VoltTable result = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA);
            result.addRow(VoltSystemProcedure.STATUS_OK);
            return new DependencyPair(DEP_updateCatalog, result);
        } else if (fragmentId == SysProcFragmentId.PF_updateCatalogAggregate) {
            VoltTable result = VoltTableUtil.unionTables(dependencies.get(DEP_updateCatalog));
            return new DependencyPair(DEP_updateCatalogAggregate, result);
        } else {
            VoltDB.crashLocalVoltDB(
                    "Received unrecognized plan fragment id " + fragmentId + " in UpdateApplicationCatalog",
                    false,
                    null);
View Full Code Here

            ParameterSet params = m_fragmentMsg.getParameterSetForFragment(frag);

            try {
                // run the overloaded sysproc planfragment. pass an empty dependency
                // set since remote (non-aggregator) fragments don't receive dependencies.
                final DependencyPair dep
                    = siteConnection.executeSysProcPlanFragment(m_txnState,
                                                         m_inputDeps,
                                                         fragmentId,
                                                         params);
                // @Shutdown returns null, handle it here
View Full Code Here

TOP

Related Classes of org.voltdb.DependencyPair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.