Package org.voltdb.catalog

Examples of org.voltdb.catalog.Procedure


        long evicted = evictResult.getLong("ANTICACHE_TUPLES_EVICTED");
        assertTrue("No tuples were evicted!"+evictResult, evicted > 0);
       
        // Execute multiple queries that try to access tuples the same block
        // Only one should get an evicted access exception
        Procedure proc = this.getProcedure("GetRecord"); // Special Single-Stmt Proc
        for (int i = 1; i < 10; i++) {
            long expected = i;
            ClientResponse cresponse = this.client.callProcedure(proc.getName(), expected);
            assertEquals(Status.OK, cresponse.getStatus());
           
            VoltTable results[] = cresponse.getResults();
            assertEquals(1, results.length);
            boolean adv = results[0].advanceRow();
View Full Code Here


     */
    public void reduce(final MapReduceTransaction mr_ts) {
        // Runtime

        int basePartition = mr_ts.getBasePartition();
        Procedure catalog_proc = mr_ts.getProcedure();

        // XXX: Why do we need to have a distinction between the base partition and all
        //      of the other partitions?
        if (hstore_site.isLocalPartition(basePartition) && mr_ts.isBasePartitionReduceExec() == false) {
            if (debug.val)
View Full Code Here

       
        // Loop through each of the procedures and measure how accurate we are in our predictions
        for (TransactionTrace xact : args.workload.getTransactions()) {
            LOG.info(xact.debug(args.catalog_db));
           
            Procedure catalog_proc = xact.getCatalogItem(args.catalog_db);
            if (skip.contains(catalog_proc.getName())) continue;
           
            int partition = HStoreConstants.NULL_PARTITION_ID;
            try {
                partition = p_estimator.getBasePartition(catalog_proc, xact.getParams(), true);
            } catch (Exception ex) {
                ex.printStackTrace();
                assert(false);
            }
            assert(partition >= 0);
            totals.get(catalog_proc).incrementAndGet();
           
            MarkovGraph markov = m.get(partition).getFromParams(xact.getTransactionId(), partition, xact.getParams(), catalog_proc);
            if (markov == null) {
                LOG.warn(String.format("No MarkovGraph for %s at partition %d", catalog_proc.getName(), partition));
                continue;
            }
           
            // Check whether we predict the same path
            List<MarkovVertex> actual_path = markov.processTransaction(xact, p_estimator);
            MarkovEstimate est = MarkovPathEstimator.predictPath(markov, t_estimators.get(partition), xact.getParams());
            assert(est != null);
            List<MarkovVertex> predicted_path = est.getMarkovPath();
            if (actual_path.equals(predicted_path)) correct_path_txns.get(catalog_proc).incrementAndGet();
           
            LOG.info("MarkovEstimate:\n" + est);
           
            // Check whether we predict the same partitions
            PartitionSet actual_partitions = MarkovUtil.getTouchedPartitions(actual_path);
            PartitionSet predicted_partitions = MarkovUtil.getTouchedPartitions(predicted_path);
            if (actual_partitions.equals(predicted_partitions)) correct_partitions_txns.get(catalog_proc).incrementAndGet();
            if (actual_partitions.size() > 1) multip_txns.get(catalog_proc).incrementAndGet();
           
               
//                System.err.println(xact.debug(args.catalog_db));
//                System.err.println(StringUtil.repeat("=", 120));
//                System.err.println(GraphUtil.comparePaths(markov, actual_path, predicted_path));
//               
//                String dotfile = "/home/pavlo/" + catalog_proc.getName() + ".dot";
//                GraphvizExport<Vertex, Edge> graphviz = MarkovUtil.exportGraphviz(markov, actual_path);
//                FileUtil.writeStringToFile(dotfile, graphviz.export(catalog_proc.getName()));
////                skip.add(catalog_proc.getName());
//                System.err.println("\n\n");
        } // FOR
       
//        if (args.hasParam(ArgumentsParser.PARAM_MARKOV_OUTPUT)) {
//            markovs.save(args.getParam(ArgumentsParser.PARAM_MARKOV_OUTPUT));
//        }
       
        System.err.println("Procedure\t\tTotal\tSingleP\tPartitions\tPaths");
        for (Entry<Procedure, AtomicInteger> entry : totals.entrySet()) {
            Procedure catalog_proc = entry.getKey();
            int total = entry.getValue().get();
            if (total == 0) continue;
           
            int valid_partitions = correct_partitions_txns.get(catalog_proc).get();
            double valid_partitions_p = (valid_partitions / (double)total) * 100;
           
            int valid_paths = correct_path_txns.get(catalog_proc).get();
            double valid_paths_p = (valid_paths / (double)total) * 100;           
           
            int singlep = total - multip_txns.get(catalog_proc).get();
            double singlep_p = (singlep / (double)total) * 100;
           
            System.err.println(String.format("%-25s %d\t%.02f\t%.02f\t%.02f", catalog_proc.getName(),
                    total,
                    singlep_p,
                    valid_partitions_p,
                    valid_paths_p
            ));
View Full Code Here

            //System.err.println("REDO :: PROC ID :" + entry.getProcedureId());

            Object[] entryParams = entry.getProcedureParams().toArray();
       
            String procName = cc.getProcedureById(entry.getProcedureId()).fullName();
            Procedure catalog_proc = cc.procedures.getIgnoreCase(procName);

            if(catalog_proc.getReadonly() == false){
                // System.out.println("Invoking procedure ::" + procName);

                cresponse = client.callProcedure(procName, entryParams);
                assertEquals(cresponse.getStatus(), Status.OK);
               
View Full Code Here

        CatalogContext catalogContext = this.getCatalogContext();
        Client client = this.getClient();
        TestSmallBankSuite.initializeSmallBankDatabase(catalogContext, client);
       
        // Check to make sure that we have some prefetch queries
        Procedure catalog_proc = catalogContext.procedures.getIgnoreCase(SendPayment.class.getSimpleName());
        assertNotNull(catalog_proc);
        int prefetch_ctr = 0;
        for (Statement catalog_stmt : catalog_proc.getStatements()) {
            assertNotNull(catalog_stmt);
            if (catalog_stmt.getPrefetchable()) prefetch_ctr++;
        } // FOR
        assertTrue(prefetch_ctr > 0);
       
        long acctIds[] = { 1l, 2l };
        double balances[] = { 100d, 0d };
        for (int i = 0; i < acctIds.length; i++) {
            TestSmallBankSuite.updateBalance(client, acctIds[i], balances[i]);
//            TestSmallBankSuite.checkBalance(client, acctIds[i], balances[i]);
        } // FOR
       
        // Run the SendPayment txn to send all the money from the first
        // account to the second account.
        ClientResponse cresponse = client.callProcedure(catalog_proc.getName(),
                                                        acctIds[0], acctIds[1], balances[0]);
        assertEquals(Status.OK, cresponse.getStatus());
        assertFalse(cresponse.toString(), cresponse.isSinglePartition());
        assertTrue(cresponse.toString(), cresponse.getDebug().hadPrefetchedQueries());
       
View Full Code Here

            //System.err.println("REDO :: PROC ID :" + entry.getProcedureId());

            Object[] entryParams = entry.getProcedureParams().toArray();
       
            String procName = cc.getProcedureById(entry.getProcedureId()).fullName();
            Procedure catalog_proc = cc.procedures.getIgnoreCase(procName);

            if(catalog_proc.getReadonly() == false){
                // System.out.println("Invoking procedure ::" + procName);

                cresponse = client.callProcedure(procName, entryParams);
                assertEquals(cresponse.getStatus(), Status.OK);
               
View Full Code Here

    /**
     * testPlanner
     */
    @Test
    public void testPlanner() throws Exception {
        Procedure catalog_proc = this.getProcedure(MockMapReduce.class);
        Statement catalog_stmt = this.getStatement(catalog_proc, catalog_proc.getMapinputquery());
       
        AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, false);
        assertNotNull(root);
        System.err.println(PlanNodeUtil.debug(root));
       
View Full Code Here

    /**
     * testProcedureId
     */
    public void testProcedureId() throws Exception {
        Procedure catalog_proc = this.getProcedure(TARGET_PROCEDURE);
        StoredProcedureInvocation invocation = new StoredProcedureInvocation(CLIENT_HANDLE, "@DatabaseDump", PARAMS);
        invocation.setProcedureId(catalog_proc.getId());
        byte[] invocation_bytes = FastSerializer.serialize(invocation);
        assertNotNull(invocation_bytes);
       
        ByteBuffer buffer = ByteBuffer.wrap(invocation_bytes);
        assertEquals(catalog_proc.getId(), StoredProcedureInvocation.getProcedureId(buffer));
    }
View Full Code Here

     * testInvalidQuery
     */
    public void testInvalidQuery() throws Exception {
        // Check to make sure that we don't try to update a query when we don't have
        // any vertical partitions defined
        Procedure catalog_proc = this.getProcedure("TestInvalid");
        Statement catalog_stmt = CollectionUtil.first(catalog_proc.getStatements());
        boolean ret = vp_planner.process(catalog_stmt);
        assertFalse(ret);
    }
View Full Code Here

        Map<Table, Table> m = new HashMap<Table, Table>();
        m.put(catalog_tbl, view_tbl);
       
        for (int i = 0; i < REWRITE_SQLS.length; i++) {
            String procName = String.format("TestRewrite%d", i);
            Procedure catalog_proc = this.getProcedure(procName);
            Statement catalog_stmt = CollectionUtil.first(catalog_proc.getStatements());
       
            String orig_sql = catalog_stmt.getSqltext();
            String new_sql = vp_planner.rewriteSQL(catalog_stmt, m);
            assertNotNull(new_sql);
            assertFalse(new_sql.isEmpty());
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Procedure

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.