Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.Table


        for(Table table : schema.getTables().values()) {
            groupsToDrop.add(table.getGroup());
            // Cannot drop entire group if parent is not in the same schema
            final Join parentJoin = table.getParentJoin();
            if(parentJoin != null) {
                final Table parentTable = parentJoin.getParent();
                if(!parentTable.getName().getSchemaName().equals(schemaName)) {
                    explicitlyDroppedTables.add(table);
                } else {
                    implicitlyDroppedTables.add(table);
                }
            } else {
View Full Code Here


                for(TableListener listener : listenerService.getTableListeners()) {
                    listener.onDrop(session, table);
                }
            }
        });
        Table root = group.getRoot();
        schemaManager().dropTableDefinition(session, root.getName().getSchemaName(), root.getName().getTableName(),
                                            SchemaManager.DropBehavior.CASCADE);
    }
View Full Code Here

    }

    @Override
    public int getTableId(Session session, TableName tableName) throws NoSuchTableException {
        logger.trace("getting table ID for {}", tableName);
        Table table = getAIS(session).getTable(tableName);
        if (table == null) {
            throw new NoSuchTableException(tableName);
        }
        return table.getTableId();
    }
View Full Code Here

    }

    @Override
    public Table getTable(Session session, int tableId) throws NoSuchTableIdException {
        logger.trace("getting AIS Table for {}", tableId);
        Table table = getAIS(session).getTable(tableId);
        if(table == null) {
            throw new NoSuchTableIdException(tableId);
        }
        return table;
    }
View Full Code Here

    @Override
    public Table getTable(Session session, TableName tableName) throws NoSuchTableException {
        logger.trace("getting AIS Table for {}", tableName);
        AkibanInformationSchema ais = getAIS(session);
        Table table = ais.getTable(tableName);
        if (table == null) {
            throw new NoSuchTableException(tableName);
        }
        return table;
    }
View Full Code Here

            return;
        }

        txnService.beginTransaction(session);
        try {
            final Table table = getTable(session, tableName);
            Collection<Index> tableIndexes = new HashSet<>();
            Collection<Index> allIndexes = tableIndexes;
            for(String indexName : indexNamesToDrop) {
                Index index = table.getIndex(indexName);
                if(index != null) {
                    tableIndexes.add(index);
                }
                else if ((index = table.getFullTextIndex(indexName)) != null) {
                    if (allIndexes == tableIndexes) {
                        allIndexes = new HashSet<>(allIndexes);
                    }
                }
                else {
                    throw new NoSuchIndexException(indexName);
                }
                // no primary key nor connected to a FK
                if(index.isPrimaryKey() || index.isConnectedToFK()) {
                    throw new ProtectedIndexException(indexName, table.getName());
                }
                if (allIndexes != tableIndexes) {
                    allIndexes.add(index);
                }
            }
View Full Code Here

        }
    }

    @Override
    public void updateTableStatistics(Session session, TableName tableName, Collection<String> indexesToUpdate) {
        final Table table = getTable(session, tableName);
        Collection<Index> indexes = new HashSet<>();
        if (indexesToUpdate == null) {
            indexes.addAll(table.getIndexes());
            for (Index index : table.getGroup().getIndexes()) {
                if (table == index.leafMostTable())
                    indexes.add(index);
            }
        }
        else {
            for (String indexName : indexesToUpdate) {
                Index index = table.getIndex(indexName);
                if (index == null) {
                    index = table.getGroup().getIndex(indexName);
                    if (index == null)
                        throw new NoSuchIndexException(indexName);
                }
                indexes.add(index);
            }
View Full Code Here

        }
        TableChangeValidator v = new TableChangeValidator(origTable, newDefinition, columnChanges, tableIndexChanges);
        v.compare();
        TableChangeValidatorState changeState = v.getState();
        dropGroupIndexDefinitions(session, origTable, changeState.droppedGI);
        Table newTable = schemaManager().getOnlineAIS(session).getTable(origTable.getTableId());
        dropGroupIndexDefinitions(session, newTable, changeState.affectedGI.keySet());
        schemaManager().alterTableDefinitions(session, changeState.descriptions);
        newTable = schemaManager().getOnlineAIS(session).getTable(origTable.getTableId());
        recreateGroupIndexes(session, changeState, origTable, newTable);
        return v;
View Full Code Here

            storageToRemove.add(origTable.getGroup());
        }

        // New parent's old group storage
        // but only if the storage location is different - metadata changes may not move the group data
        Table newParent = newTable.getParentTable();
        if(newParent != null) {
            Table newParentOldTable = origAIS.getTable(newParent.getTableId());
            if (!newParent.getGroup().getStorageDescription().getUniqueKey().equals(
                    newParentOldTable.getGroup().getStorageDescription().getUniqueKey()))
            {
                storageToRemove.add(newParentOldTable.getGroup());
            }
        }

        store().deleteIndexes(session, indexesToDrop);
        store().deleteSequences(session, sequencesToDrop);
View Full Code Here

        for(Entry<String, List<ColumnName>> entry : changeState.affectedGI.entrySet()) {
            GroupIndex origIndex = origGroup.getIndex(entry.getKey());
            GroupIndex tempIndex = GroupIndex.create(tempAIS, tempGroup, origIndex);
            int pos = 0;
            for(ColumnName cn : entry.getValue()) {
                Table tempTable = tempAIS.getTable(cn.getTableName());
                Column tempColumn = tempTable.getColumn(cn.getName());
                IndexColumn.create(tempIndex, tempColumn, pos++, true, null);
            }
            if(!changeState.dataAffectedGI.containsKey(entry.getKey())) {
                // TODO: Maybe need a way to say copy without the tree name part?
                tempIndex.copyStorageDescription(origIndex);
View Full Code Here

TOP

Related Classes of com.foundationdb.ais.model.Table

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.