Package org.voltdb

Examples of org.voltdb.ParameterSet


                CatalogContext cc = this.getCatalogContext();
                String procName = VoltSystemProcedure.procCallName(SnapshotSave.class);
                Procedure catalog_proc = cc.procedures.getIgnoreCase(procName);

                ParameterSet params = new ParameterSet();
                params.setParameters(
                        path,  // snapshot dir
                        nonce, // nonce - timestamp
                        1      // block
                        );
View Full Code Here


        // PARAMETERSET INITIALIZATION
        // -------------------------------
       
        // Extract just the ParameterSet from the StoredProcedureInvocation
        // We will deserialize the rest of it later
        ParameterSet procParams = new ParameterSet();
        try {
            StoredProcedureInvocation.seekToParameterSet(buffer);
            incomingDeserializer.setBuffer(buffer);
            procParams.readExternal(incomingDeserializer);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
        assert(procParams != null) :
            "The parameters object is null for new txn from client #" + client_handle;
View Full Code Here

            // ----------------------------------
            else if (result instanceof AdHocPlannedStmt) {
                AdHocPlannedStmt plannedStmt = (AdHocPlannedStmt) result;

                // Modify the StoredProcedureInvocation
                ParameterSet params = result.ts.getProcedureParameters();
                assert(params != null) : "Unexpected null ParameterSet";
                params.setParameters(
                    plannedStmt.aggregatorFragment,
                    plannedStmt.collectorFragment,
                    plannedStmt.sql,
                    plannedStmt.isReplicatedTableDML ? 1 : 0
                );
View Full Code Here

            // the partitioning parameter actually matters
            if (stmt.getQuerytype() == QueryType.INSERT.getValue()) continue;
           
            Object params[] = this.randomStatementParameters(stmt);
            this.batch[i] = new SQLStmt(stmt);
            this.args[i] = new ParameterSet(params);
            i += 1;
        } // FOR
       
        this.planner = new BatchPlanner(this.batch, proc, p_estimator);
        this.plannerDebug = this.planner.getDebugContext();
View Full Code Here

            throw new RuntimeException("Unknown procedure id '" + procId + "'");
        }
       
        // Initialize the ParameterSet
        FastDeserializer incomingDeserializer = new FastDeserializer();
        ParameterSet procParams = new ParameterSet();
        try {
            incomingDeserializer.setBuffer(StoredProcedureInvocation.getParameterSet(paramsBuffer));
            procParams.readExternal(incomingDeserializer);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
        assert(procParams != null) :
            "The parameters object is null for new txn from client #" + client_handle;
View Full Code Here

        this.params = new ParameterSet[init_size][];
        this.paramsDirty = new BitSet(this.params.length);
        for (int i = 0; i < this.params.length; i++) {
            this.params[i] = new ParameterSet[i];
            for (int j = 0; j < i; j++) {
                this.params[i][j] = new ParameterSet(true);
            } // FOR
        } // FOR
    }
View Full Code Here

        }
        assert(size < this.params.length);
        if (this.params[size] == null) {
            this.params[size] = new ParameterSet[size];
            for (int i = 0; i < size; i++) {
                this.params[size][i] = new ParameterSet(true);
            } // FOR
        }
        this.paramsDirty.set(size);
        return (this.params[size]);
    }
View Full Code Here

    public void testTxnCacheGet() throws Exception {
        Long txnId = new Long(123456);
        int baseFragmentId = 1111;
        int partitionId = 1;
        long baseValue = 9900;
        ParameterSet params = new ParameterSet("Squirrels", 1981);
       
        Map<Integer, Long> expectedValues = new HashMap<Integer, Long>();
        for (int i = 0; i < 5; i++) {
            int fragmentId = baseFragmentId + i;
            long expected = baseValue + i;
            VoltTable result = new VoltTable(TARGET_RESULT);
            result.addRow(expected);
            expectedValues.put(fragmentId, expected);
       
            // First store it in the cache
            this.cache.addResult(txnId, fragmentId, partitionId, params, result);
        } // FOR
//        System.err.println(StringUtil.formatMaps(expectedValues));
//        System.err.println("---------------");
//        System.err.println(this.cache.toString());
       
        // Then ask for them back in a shuffled order
        List<Integer> fragmentIds = new ArrayList<Integer>(expectedValues.keySet());
        Collections.shuffle(fragmentIds);
        for (Integer fragmentId : fragmentIds) {
            long expected = expectedValues.get(fragmentId);
            VoltTable cacheResult = this.cache.getResult(txnId, fragmentId, partitionId, params);
            assertNotNull(fragmentId.toString(), cacheResult);
            assertEquals(1, cacheResult.getRowCount());
            assertEquals(expected, cacheResult.asScalarLong());
        } // FOR
       
        // If we change the params, we should never get back our results
        params = new ParameterSet("WuTang!", 1981);
        for (Integer fragmentId : fragmentIds) {
            VoltTable cacheResult = this.cache.getResult(txnId, fragmentId, partitionId, params);
            assertNull(fragmentId.toString(), cacheResult);
        } // FOR
       
        // Now create a new ParameteSet with the same values and make
        // sure get back the same results.
        params = new ParameterSet("Squi" + "rrels", 1981);
        for (Integer fragmentId : fragmentIds) {
            long expected = expectedValues.get(fragmentId);
            VoltTable cacheResult = this.cache.getResult(txnId, fragmentId, partitionId, params);
            assertNotNull(fragmentId.toString(), cacheResult);
            assertEquals(1, cacheResult.getRowCount());
View Full Code Here

                      ts, TransactionInitRequest.class.getSimpleName(),
                      ts.getPredictTouchedPartitions().size(), ts.getPredictTouchedPartitions()));
        assert(callback != null) :
            String.format("Trying to initialize %s with a null TransactionInitCallback", ts);
       
        ParameterSet procParams = ts.getProcedureParameters();
        FastSerializer fs = this.serializers.get();
       
        // Look at the Procedure to see whether it has prefetchable queries. If it does,
        // then embed them in the TransactionInitRequest. We will need to generate a separate
        // request for each site that we want to execute different queries on.
View Full Code Here

    public void testReplicatedInsert() throws Exception {
        Object params[] = new Object[]{ 9999, "FUCK", "YO", "COUCH" };
        Procedure proc = this.getProcedure("InsertCountry");
        Statement stmt = CollectionUtil.first(proc.getStatements());
        this.batch = new SQLStmt[]{ new SQLStmt(stmt) };
        this.args = new ParameterSet[]{ new ParameterSet(params) };
       
        BatchPlanner planner = new BatchPlanner(batch, catalog_proc, p_estimator);
        this.touched_partitions.clear();
        PartitionSet partitions = catalogContext.getPartitionSetSingleton(BASE_PARTITION);
        BatchPlan plan = planner.plan(TXN_ID,
View Full Code Here

TOP

Related Classes of org.voltdb.ParameterSet

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.