Package org.voltdb

Examples of org.voltdb.CatalogContext


        final int numStmts = batch.work.getStatementCount();
        final int numParams = batch.work.getParameterCount();
        final String readOnly = batch.readOnly ? "yes" : "no";
        final String singlePartition = batch.isSinglePartitionCompatible() ? "yes" : "no";
        final String user = batch.work.user.m_name;
        final CatalogContext context = (batch.work.catalogContext != null
                                            ? batch.work.catalogContext
                                            : VoltDB.instance().getCatalogContext());
        final String[] groupNames = context.authSystem.getGroupNamesForUser(user);
        final String groupList = StringUtils.join(groupNames, ',');
View Full Code Here


        retval.user = work.user;
        retval.tablesThatMustBeEmpty = new String[0]; // ensure non-null

        try {
            // catalog change specific boiler plate
            CatalogContext context = VoltDB.instance().getCatalogContext();
            // Start by assuming we're doing an @UpdateApplicationCatalog.  If-ladder below
            // will complete with newCatalogBytes actually containing the bytes of the
            // catalog to be applied, and deploymentString will contain an actual deployment string,
            // or null if it still needs to be filled in.
            byte[] newCatalogBytes = work.operationBytes;
            String deploymentString = work.operationString;
            if (work.invocationName.equals("@UpdateApplicationCatalog")) {
                // Do the straight-forward thing with the args, filling in nulls as appropriate
                // Grab the current catalog bytes if @UAC had a null catalog
                // (deployment-only update)
                if (newCatalogBytes == null) {
                    try {
                        newCatalogBytes = context.getCatalogJarBytes();
                    }
                    catch (IOException ioe) {
                        retval.errorMsg = "Unexpected exception retrieving internal catalog bytes: " +
                            ioe.getMessage();
                        return retval;
                    }
                }
                // If the deploymentString is null, we'll fill it in with current deployment later
                // Otherwise, deploymentString has the right contents, don't need to touch it
            }
            else if (work.invocationName.equals("@UpdateClasses")) {
                // Need the original catalog bytes, then delete classes, then add
                try {
                    newCatalogBytes = context.getCatalogJarBytes();
                }
                catch (IOException ioe) {
                    retval.errorMsg = "Unexpected exception retrieving internal catalog bytes: " +
                        ioe.getMessage();
                    return retval;
                }
                // provided operationString is really a String with class patterns to delete,
                // provided operationBytes is the jarfile with the upsertable classes
                try {
                    newCatalogBytes = modifyCatalogClasses(newCatalogBytes, work.operationString,
                            work.operationBytes);
                }
                catch (IOException e) {
                    retval.errorMsg = "Unexpected exception @UpdateClasses modifying classes " +
                        "from catalog: " + e.getMessage();
                    return retval;
                }
                // Real deploymentString should be the current deployment, just set it to null
                // here and let it get filled in correctly later.
                deploymentString = null;
            }
            else if (work.invocationName.startsWith("@AdHoc")) {
                // newCatalogBytes and deploymentString should be null.
                // work.adhocDDLStmts should be applied to the current catalog
                try {
                    newCatalogBytes = addDDLToCatalog(context.getCatalogJarBytes(),
                            work.adhocDDLStmts);
                }
                catch (IOException ioe) {
                    retval.errorMsg = "Unexpected exception applying DDL statements to " +
                        " original catalog: " + ioe.getMessage();
View Full Code Here

        byte[] bytes = MiscUtils.fileToBytes(new File("tpcc-oop.jar"));
        String serializedCatalog = CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes).getFirst());
        Catalog catalog = new Catalog();
        catalog.execute(serializedCatalog);
        CatalogContext context = new CatalogContext(0, 0, catalog, bytes, null, 0, 0);

        m_pt = new PlannerTool(context.cluster, context.database, 0);

        AdHocPlannedStatement result = null;
        result = m_pt.planSqlForTest("select * from warehouse;");
View Full Code Here

        byte[] bytes = MiscUtils.fileToBytes(new File("testbadddl-oop.jar"));
        String serializedCatalog = CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes).getFirst());
        assertNotNull(serializedCatalog);
        Catalog c = new Catalog();
        c.execute(serializedCatalog);
        CatalogContext context = new CatalogContext(0, 0, c, bytes, null, 0, 0);

        m_pt = new PlannerTool(context.cluster, context.database, 0);

        // Bad DDL would kill the planner before it starts and this query
        // would return a Stream Closed error
View Full Code Here

            // Compile and save the file to voltdbroot. Assume it's a test environment if there
            // is no catalog context available.
            String jarName = String.format("catalog-%s.jar", versionFromVoltDB);
            String textName = String.format("catalog-%s.out", versionFromVoltDB);
            CatalogContext catalogContext = VoltDB.instance().getCatalogContext();
            final String outputJarPath = (catalogContext != null
                    ? new File(catalogContext.cluster.getVoltroot(), jarName).getPath()
                    : VoltDB.Configuration.getPathToCatalogForTest(jarName));
            // Place the compiler output in a text file in the same folder.
            final String outputTextPath = (catalogContext != null
View Full Code Here

        VoltDB.Configuration config = setUpSPDB();
        byte[] bytes = MiscUtils.fileToBytes(new File(config.m_pathToCatalog));
        String serializedCatalog = CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes).getFirst());
        Catalog catalog = new Catalog();
        catalog.execute(serializedCatalog);
        CatalogContext context = new CatalogContext(0, 0, catalog, bytes, null, 0, 0);
        m_pt = new PlannerTool(context.cluster, context.database, 0);
    }
View Full Code Here

TOP

Related Classes of org.voltdb.CatalogContext

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.