Examples of AkibanInformationSchema


Examples of com.foundationdb.ais.model.AkibanInformationSchema

    /** Drop the given sequence from the current AIS. */
    @Override
    public void dropSequence(Session session, Sequence sequence) {
        checkSequenceName(session, sequence.getSequenceName(), true);
        AkibanInformationSchema oldAIS = getAISForChange(session);
        AkibanInformationSchema newAIS = removeTablesFromAIS(oldAIS,
                                                             Collections.<TableName>emptyList(),
                                                             Collections.singleton(sequence.getSequenceName()));
        saveAISChange(session, newAIS, Collections.singleton(sequence.getSchemaName()));
    }
View Full Code Here

Examples of com.foundationdb.ais.model.AkibanInformationSchema

                                        Integer version, boolean memoryTable) {
        final TableName newName = newTable.getName();
        checkTableName(session, newName, false, isInternal);
        AISInvariants.checkJoinTo(newTable.getParentJoin(), newName, isInternal);

        AkibanInformationSchema oldAIS = getAISForChange(session, !isInternal);
        AISMerge merge = AISMerge.newForAddTable(aisCloner, getNameGenerator(session), oldAIS, newTable);
        merge.merge();
        AkibanInformationSchema newAIS = merge.getAIS();
        Table mergedTable = newAIS.getTable(newName);

        ensureUuids(mergedTable);

        if(version == null) {
            version = 0; // New user or memory table
View Full Code Here

Examples of com.foundationdb.ais.model.AkibanInformationSchema

    }

    private void dropTableCommon(Session session, TableName tableName, final DropBehavior dropBehavior,
                                 final boolean isInternal, final boolean mustBeMemory) {
        checkTableName(session, tableName, true, isInternal);
        final AkibanInformationSchema oldAIS = getAISForChange(session, !isInternal);
        final Table table = oldAIS.getTable(tableName);

        final List<TableName> tables = new ArrayList<>();
        final Set<String> schemas = new HashSet<>();
        final List<Integer> tableIDs = new ArrayList<>();
        final Set<TableName> sequences = new HashSet<>();

        // Collect all tables in branch below this point
        table.visit(new AbstractVisitor() {
            @Override
            public void visit(Table table) {
                if(mustBeMemory && !table.hasMemoryTableFactory()) {
                    throw new IllegalArgumentException("Cannot un-register non-memory table");
                }

                if((dropBehavior == DropBehavior.RESTRICT) && !table.getChildJoins().isEmpty()) {
                    throw new ReferencedTableException (table);
                }

                TableName name = table.getName();
                tables.add(name);
                schemas.add(name.getSchemaName());
                tableIDs.add(table.getTableId());
                for (Column column : table.getColumnsIncludingInternal()) {
                    if (column.getIdentityGenerator() != null) {
                        sequences.add(column.getIdentityGenerator().getSequenceName());
                    }
                }
            }
        });

        final AkibanInformationSchema newAIS = removeTablesFromAIS(oldAIS, tables, sequences);

        for(Integer tableID : tableIDs) {
            clearTableStatus(session, oldAIS.getTable(tableID));
        }
View Full Code Here

Examples of com.foundationdb.ais.model.AkibanInformationSchema

        }
    }

    private void createRoutineCommon(Session session, Routine routine,
                                     boolean inSystem, boolean replaceExisting) {
        final AkibanInformationSchema oldAIS = getAISForChange(session, !inSystem);
        checkSystemSchema(routine.getName(), inSystem);
        if (!replaceExisting && (oldAIS.getRoutine(routine.getName()) != null))
            throw new DuplicateRoutineNameException(routine.getName());
        // This may not be the generation that newAIS will receive,
        // but it will still be > than any previous routine, and in
        // particular any by the same name, whether replaced here or
        // dropped earlier.
        routine.setVersion(oldAIS.getGeneration() + 1);
        final AkibanInformationSchema newAIS = AISMerge.mergeRoutine(aisCloner, oldAIS, routine);
        if (inSystem)
            unStoredAISChange(session, newAIS);
        else {
            final String schemaName = routine.getName().getSchemaName();
            saveAISChange(session, newAIS, Collections.singleton(schemaName));
View Full Code Here

Examples of com.foundationdb.ais.model.AkibanInformationSchema

            saveAISChange(session, newAIS, Collections.singleton(schemaName));
        }
    }

    private void dropRoutineCommon(Session session, TableName routineName, boolean inSystem) {
        final AkibanInformationSchema oldAIS = getAISForChange(session, !inSystem);
        checkSystemSchema(routineName, inSystem);
        Routine routine = oldAIS.getRoutine(routineName);
        if (routine == null)
            throw new NoSuchRoutineException(routineName);
        final AkibanInformationSchema newAIS = aisCloner.clone(oldAIS);
        routine = newAIS.getRoutine(routineName);
        newAIS.removeRoutine(routineName);
        if (routine.getSQLJJar() != null)
            routine.getSQLJJar().removeRoutine(routine); // Keep accurate in memory.
        if (inSystem)
            unStoredAISChange(session, newAIS);
        else {
View Full Code Here

Examples of com.foundationdb.ais.model.AkibanInformationSchema

        }
    }

    private void createSQLJJarCommon(Session session, SQLJJar sqljJar,
                                     boolean inSystem, boolean replace) {
        final AkibanInformationSchema oldAIS = getAISForChange(session);
        checkSystemSchema(sqljJar.getName(), inSystem);
        if (replace) {
            if (oldAIS.getSQLJJar(sqljJar.getName()) == null)
                throw new NoSuchSQLJJarException(sqljJar.getName());
        }
        else {
            if (oldAIS.getSQLJJar(sqljJar.getName()) != null)
                throw new DuplicateSQLJJarNameException(sqljJar.getName());
        }
        sqljJar.setVersion(oldAIS.getGeneration() + 1);
        final AkibanInformationSchema newAIS;
        if (replace) {
            newAIS = aisCloner.clone(oldAIS);
            // Changing old state rather than actually replacing saves having to find
            // referencing routines, possibly in other schemas.
            final SQLJJar oldJar = newAIS.getSQLJJar(sqljJar.getName());
            assert (oldJar != null);
            oldJar.setURL(sqljJar.getURL());
            oldJar.setVersion(sqljJar.getVersion());
        }
        else {
View Full Code Here

Examples of com.foundationdb.ais.model.AkibanInformationSchema

        }
    }

    private void dropSQLJJarCommon(Session session, TableName jarName,
                                   boolean inSystem) {
        final AkibanInformationSchema oldAIS = getAISForChange(session);
        checkSystemSchema(jarName, inSystem);
        SQLJJar sqljJar = oldAIS.getSQLJJar(jarName);
        if (sqljJar == null)
            throw new NoSuchSQLJJarException(jarName);
        if (!sqljJar.getRoutines().isEmpty())
            throw new ReferencedSQLJJarException(sqljJar);
        final AkibanInformationSchema newAIS = aisCloner.clone(oldAIS);
        newAIS.removeSQLJJar(jarName);
        if (inSystem) {
            unStoredAISChange(session, newAIS);
        }
        else {
            final String schemaName = jarName.getSchemaName();
View Full Code Here

Examples of com.foundationdb.ais.model.AkibanInformationSchema

                               AkibanInformationSchema newAIS,
                               Collection<String> schemas,
                               Collection<Integer> tableIDs) {
        assert schemas != null;
        assert tableIDs != null;
        AkibanInformationSchema oldAIS = getAISForChange(session);
        OnlineSession onlineSession = getOnlineSession(session, null);
        OnlineCache onlineCache = getOnlineCache(session, oldAIS);

        for(Integer tid : tableIDs) {
            Long curOwner = onlineCache.tableToOnline.get(tid);
View Full Code Here

Examples of com.foundationdb.ais.model.AkibanInformationSchema

        this.store = store;
    }

    @Override
    public void start() {
        AkibanInformationSchema ais = createTablesToRegister(schemaManager.getTypesTranslator());
        // ERROR_CODES
        attach (ais, ERROR_CODES, ServerErrorCodes.class);
        // ERROR_CODE_CLASSES
        attach (ais, ERROR_CODE_CLASSES, ServerErrorCodeClasses.class);
        //SERVER_INSTANCE_SUMMARY
View Full Code Here

Examples of com.foundationdb.ais.model.AkibanInformationSchema

        }
    }

    private List<TableName> getTableNames(Session session, ServerSession server, String queryExpression, Table table ){

        AkibanInformationSchema ais = schemaManager().getAis(session);
        SQLParser parser = server.getParser();
        StatementNode stmt;
        try {
            stmt = parser.parseStatement(queryExpression);
        } catch (StandardException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.