Package org.voltdb.catalog

Examples of org.voltdb.catalog.Procedure


        this.query_batches.get((Integer)query.getBatchId()).add(query);
    }
   
    @Override
    public String debug(Database catalog_db) {
        final Procedure catalog_proc = this.getCatalogItem(catalog_db);
        final String thick_line = StringUtil.DOUBLE_LINE;
        final String thin_line  = StringUtil.SINGLE_LINE;
       
        // Header Info
        StringBuilder sb = new StringBuilder();
        sb.append(thick_line)
          .append(catalog_proc.getName().toUpperCase() + " - Txn#" + this.txn_id + "\n")
          .append("Start Time:   " + this.start_timestamp + "\n")
          .append("Stop Time:    " + this.stop_timestamp + "\n")
          .append("Run Time:     " + (this.stop_timestamp != null ? this.stop_timestamp - this.start_timestamp : "???") + "\n")
          .append("Txn Aborted:  " + this.aborted + "\n")
          .append("Weight:       " + this.weight + "\n")
          .append("# of Queries: " + this.queries.size() + "\n")
          .append("# of Batches: " + this.query_batches.size() + "\n");
       
        // Params
        sb.append("Transasction Parameters: [" + this.params.length + "]\n");
        for (int i = 0; i < this.params.length; i++) {
            ProcParameter catalog_param = catalog_proc.getParameters().get(i);
            Object param = this.params[i];
            String type_name = VoltType.get(catalog_param.getType()).name();
            if (ClassUtil.isArray(param)) type_name += "[" + ((Object[])param).length + "]";
           
            sb.append("   [" + i + "] -> ")
View Full Code Here


        return (sb.toString());
    }

    public Map<Statement, Integer> getStatementCounts(Database catalog_db) {
        Map<Statement, Integer> counts = new HashMap<Statement, Integer>();
        Procedure catalog_proc = this.getCatalogItem(catalog_db);
        for (Statement stmt : catalog_proc.getStatements()) {
            counts.put(stmt, 0);
        }
        for (QueryTrace query : this.queries) {
            Statement stmt = query.getCatalogItem(catalog_db);
            assert(stmt != null) : "Invalid query name '" + query.getCatalogItemName() + "' for " + catalog_proc;
View Full Code Here

   
    @Override
    protected void fromJSONObject(JSONObject object, Database db) throws JSONException {
        super.fromJSONObject(object, db);
        this.txn_id = object.getLong(Members.TXN_ID.name());
        Procedure catalog_proc = (Procedure)db.getProcedures().get(this.catalog_item_name);
        assert(catalog_proc != null) : "Unexpected procedure '" + this.catalog_item_name + "'";
        try {
            super.paramsFromJSONObject(object, catalog_proc.getParameters(), "type");
        } catch (Exception ex) {
            LOG.fatal("Failed to extract procedure params for txn #" + this.txn_id, ex);
            throw new JSONException(ex);
        }
       
View Full Code Here

    @Override
    protected FilterResult filter(AbstractTraceElement<? extends CatalogType> element) {
        FilterResult result = FilterResult.ALLOW;
        if (element instanceof TransactionTrace) {
            TransactionTrace xact = (TransactionTrace)element;
            Procedure catalog_proc = xact.getCatalogItem(this.catalog_db);
           
            PartitionSet partitions = new PartitionSet();
            try {
                int base_partition = this.p_estimator.getBasePartition(catalog_proc, xact.getParams(), true);
                partitions.add(base_partition);
View Full Code Here

        // CONSUMERS
        for (int i = 0, cnt = ThreadUtil.getMaxGlobalThreads(); i < cnt; i++) {
            Consumer<TransactionTrace> c = new Consumer<TransactionTrace>() {
                @Override
                public void process(TransactionTrace txn_trace) {
                    Procedure catalog_proc = txn_trace.getCatalogItem(catalog_db);
                    if (target_procedures.contains(catalog_proc) == false) return;
                    Integer interval = (num_intervals != null ? workload.getTimeInterval(txn_trace, num_intervals) : null);
                    String signature = getTransactionTraceSignature(catalog_proc, txn_trace, interval);
                    assert(signature != null);
                    assert(signature.isEmpty() == false);
View Full Code Here

        for (int i = 0, cnt = ThreadUtil.getMaxGlobalThreads(); i < cnt; i++) {
            final DuplicateTraceElements<Statement, QueryTrace> duplicates = new DuplicateTraceElements<Statement, QueryTrace>();
            Consumer<TransactionTrace> c = new Consumer<TransactionTrace>() {
                @Override
                public void process(TransactionTrace txn_trace) {
                    Procedure catalog_proc = txn_trace.getCatalogItem(catalog_db);
                    if (target_procedures.contains(catalog_proc) == false) return;
                    duplicates.clear();           
                    for (QueryTrace query_trace : txn_trace.getQueries()) {
                        Statement catalog_stmt = query_trace.getCatalogItem(catalog_db);
                        String param_hashes = getQueryTraceSignature(catalog_stmt, query_trace);
View Full Code Here

                /**
                 * We need this wrapper so that when CatalogUtil tries to figure out what
                 * the index of partitioning parameter we can just use the column index of partitioning
                 * attribute of the table that we are inserting into
                 */
                private final Procedure proc = new Procedure() {
                    @Override
                    public int getPartitionparameter() {
                        return (catalog_tbl.getPartitioncolumn().getIndex());
                    }
                    @Override
View Full Code Here

       
        // Procedures to exclude in ConflictGraph
        if (args.hasParam(ArgumentsParser.PARAM_CONFLICTS_EXCLUDE_PROCEDURES)) {
            String param = args.getParam(ArgumentsParser.PARAM_CONFLICTS_EXCLUDE_PROCEDURES);
            for (String procName : param.split(",")) {
                Procedure catalog_proc = args.catalogContext.procedures.getIgnoreCase(procName);
                if (catalog_proc != null) {
                    calculator.ignoreProcedure(catalog_proc);
                } else {
                    LOG.warn("Invalid procedure name to exclude '" + procName + "'");
                }
            } // FOR
        }
       
        // Statements to exclude in ConflictGraph
        if (args.hasParam(ArgumentsParser.PARAM_CONFLICTS_EXCLUDE_STATEMENTS)) {
            String param = args.getParam(ArgumentsParser.PARAM_CONFLICTS_EXCLUDE_STATEMENTS);
            for (String name : param.split(",")) {
                String splits[] = name.split("\\.");
                if (splits.length != 2) {
                    LOG.warn("Invalid procedure name to exclude '" + name + "': " + Arrays.toString(splits));
                    continue;
                }
                Procedure catalog_proc = args.catalogContext.procedures.getIgnoreCase(splits[0]);
                if (catalog_proc == null) {
                    LOG.warn("Invalid procedure name to exclude '" + name + "'");
                    continue;
                }
                   
                Statement catalog_stmt = catalog_proc.getStatements().getIgnoreCase(splits[1]);
                if (catalog_stmt != null) {
                    calculator.ignoreStatement(catalog_stmt);
                } else {
                    LOG.warn("Invalid statement name to exclude '" + name + "'");
                }
            } // FOR
        }
       
        calculator.process();
        DumpGraph graph = new DumpGraph(args.catalogContext);
       
        // If we have a Procedure to "focus" on, then we need to remove any edges
        // that don't involve that Procedure
        if (args.hasParam(ArgumentsParser.PARAM_CONFLICTS_FOCUS_PROCEDURE)) {
            String procName = args.getParam(ArgumentsParser.PARAM_CONFLICTS_FOCUS_PROCEDURE);
            Procedure catalog_proc = args.catalogContext.procedures.getIgnoreCase(procName);
            if (catalog_proc != null) {
                if (graph.procXref.containsKey(catalog_proc)) {
                    Vertex vertices[] = graph.procXref.get(catalog_proc).toArray(new Vertex[0]);
                    LOG.debug("Remove Edges Without: " + Arrays.toString(vertices));
                    GraphUtil.removeEdgesWithoutVertex(graph, vertices);
                    GraphUtil.removeLoopEdges(graph);
                    GraphUtil.removeDisconnectedVertices(graph);
                }
            } else {
                LOG.warn("Invalid procedure name to focus '" + procName + "'");
            }
        }
       
        // Export!
        GraphvizExport<Vertex, Edge> gvx = new GraphvizExport<Vertex, Edge>(graph);
        gvx.setEdgeLabels(true);
       
        for (Vertex v : graph.getVertices()) {
            // Generate subgraphs based on procedure
            ProcedureTable procTbl = v.getCatalogItem();
            Procedure proc = procTbl.pair.getFirst();
            gvx.addSubgraph(proc.getName(), v);
        } // FOR
       
        String graphviz = gvx.export(args.catalog_type.name());
        if (!graphviz.isEmpty()) {
            String output = args.getOptParam(0);
View Full Code Here

                    exec_histogram[i].put(all_partitions, txn_weight);
                }
                if (debug.val) { // &&
                                   // txn_trace.getCatalogItemName().equalsIgnoreCase("DeleteCallForwarding"))
                                   // {
                    Procedure catalog_proc = txn_trace.getCatalogItem(catalogContext.database);
                    Map<String, Object> inner = new LinkedHashMap<String, Object>();
                    for (Statement catalog_stmt : catalog_proc.getStatements()) {
                        inner.put(catalog_stmt.fullName(), CatalogUtil.getReferencedTables(catalog_stmt));
                    }

                    Map<String, Object> m = new LinkedHashMap<String, Object>();
                    m.put(txn_trace.toString(), null);
                    m.put("Interval", i);
                    m.put("Single-Partition", txn_entry.isSinglePartitioned());
                    m.put("Base Partition", base_partition);
                    m.put("Touched Partitions", partitions);
                    m.put(catalog_proc.fullName(), inner);
                    LOG.debug(StringUtil.formatMaps(m));
                }

                // We need to keep a count of the number txns that didn't have
                // all of its queries estimated
View Full Code Here

       
        private void populateProcedure(Procedure proc0) {
            for (ConflictPair cp : ConflictSetUtil.getAllConflictPairs(proc0)) {
                Statement stmt0 = cp.getStatement0();
                Statement stmt1 = cp.getStatement1();
                Procedure proc1 = stmt1.getParent();
                LOG.debug(String.format("%s -> %s+%s", cp, stmt0, stmt1));
               
                for (Table tbl : CatalogUtil.getReferencedTables(stmt0)) {
                    Vertex v0 = this.getVertex(proc0, tbl);
                    if (v0 == null) {
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.