Package com.foundationdb.ais.model.aisb2

Examples of com.foundationdb.ais.model.aisb2.NewAISGroupIndexStarter


        assertEquals(ROW_COUNT, getRowCount(tableId));
    }

    @Test
    public void autoIncrementInsertTest() throws Exception {
        NewAISBuilder builder = AISBBasedBuilder.create("test", ddl().getTypesTranslator());
        builder.table("A").autoIncInt("I", 1).colString("V", 255).pk("I");
        ddl().createTable(session(), builder.ais().getTable("test", "A"));

        int tableId = tableId("test", "A");
        for (int i = 1; i <= ROW_COUNT; i++) {
            writeRows(row(tableId, i, "This is record # " + 1));
        }
View Full Code Here


import static org.junit.Assert.assertNotNull;

public class TableIDCollisionIT extends ITBase {
    private Table simpleISTable() {
        final TableName FAKE_TABLE = new TableName(TableName.INFORMATION_SCHEMA, "fake_table");
        NewAISBuilder builder = AISBBasedBuilder.create(ddl().getTypesTranslator());
        builder.table(FAKE_TABLE).colInt("id").pk("id");
        Table table = builder.ais().getTable(FAKE_TABLE);
        assertNotNull("Found table", table);
        return table;
    }
View Full Code Here

     * Found from an actual case in the MTR test suite. Caused by recycled RowDefIDs and undeleted table statuses.
     * Really testing that table statuses get deleted, but about as direct as we can get from this level.
     */
    @Test
    public void dropThenCreateRowDefIDRecycled() throws InvalidOperationException {
        NewAISBuilder builder = AISBBasedBuilder.create("test", ddl().getTypesTranslator());
        builder.table("t1").autoIncInt("id", 1).pk("id").colString("name", 255);
        ddl().createTable(session(), builder.ais().getTable("test", "t1"));
        final int tidV1 = tableId("test", "t1");

        writeRow(tidV1, 1, "hello world");
        expectRowCount(tidV1, 1);
        ddl().dropTable(session(), tableName(tidV1));
View Full Code Here



    @Test(expected=UndeclaredColumnChangeException.class)
    public void unspecifiedColumnChange() {
        NewAISBuilder builder = AISBBasedBuilder.create(ddl().getTypesTranslator());
        builder.table(SCHEMA, "c").colInt("c1").pk("c1");
        Table table = builder.ais().getTable(SCHEMA, "c");

        ddl().createTable(session(),  table);

        builder = AISBBasedBuilder.create(ddl().getTypesTranslator());
        builder.table(SCHEMA, "c").colInt("c1").colInt("c2").colInt("c3").pk("c1");
        table = builder.ais().getTable(SCHEMA, "c");

        ddl().alterTable(session(), table.getName(), table,
                         Arrays.asList(TableChange.createAdd("c2")), NO_CHANGES,
                         null);
    }
View Full Code Here

    }

    @Test(expected=JoinToProtectedTableException.class)
    public void joinToISTable() throws Exception {
        TableName name = new TableName(TableName.INFORMATION_SCHEMA, "p");
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, schemaManager.getTypesTranslator());
        builder.table(name).colInt("id", false).pk("id");
        try {
            builder.table(T1_NAME).colInt("id", false).colInt("pid", true).pk("id").joinTo("information_schema", "p").on("pid", "id");
            registerISTable(builder.unvalidatedAIS().getTable(name), new MemoryTableFactoryMock());
            ddl().createTable(session(), builder.unvalidatedAIS().getTable(SCHEMA, T1_NAME));
        } finally {
            // ApiTestBase#tearDownAllTables skips IS tables
            unRegisterISTable(name);
        }
    }
View Full Code Here

    @Test
    public void onlineWithNewIndex() {
        createTable(SCHEMA, T1_NAME, "x int");

        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, schemaManager.getTypesTranslator());
        builder.table(SCHEMA, T1_NAME).colInt("x").key("x", "x");
        final Index index = builder.unvalidatedAIS().getTable(SCHEMA, T1_NAME).getIndex("x");

        transactionallyUnchecked( new Runnable() {
            @Override
            public void run() {
                schemaManager.startOnline(session());
View Full Code Here

    @Test
    public void onlineDiscardNewIndex() {
        final int tid = createTable(SCHEMA, T1_NAME, "x int");

        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, schemaManager.getTypesTranslator());
        builder.table(SCHEMA, T1_NAME).colInt("x").key("x", "x");
        final Index index = builder.unvalidatedAIS().getTable(SCHEMA, T1_NAME).getIndex("x");

        transactionallyUnchecked( new Runnable() {
            @Override
            public void run() {
                schemaManager.startOnline(session());
                schemaManager.createIndexes(session(), Collections.singleton(index), false);
                ChangeSet.Builder builder = ChangeSet.newBuilder();
                builder.setChangeLevel("INDEX")
                       .setTableId(tid)
                       .setOldSchema(SCHEMA)
                       .setOldName(T1_NAME)
                       .setNewSchema(SCHEMA)
                       .setNewName(T1_NAME);
                builder.addIndexChange(IndexChange.newBuilder()
                                                  .setIndexType("TABLE")
                                                  .setChange(Change.newBuilder().setChangeType("ADD").setNewName("x")));
                schemaManager.addOnlineChangeSet(session(), builder.build());
            }
        });
        transactionallyUnchecked(new Runnable() {
            @Override
            public void run() {
View Full Code Here

        }
        assertEquals("tables in: " + schema, expected, actual);
    }

    private static Table makeSimpleISTable(TableName name, TypesTranslator typesTranslator) {
        NewAISBuilder builder = AISBBasedBuilder.create(name.getSchemaName(), typesTranslator);
        builder.table(name.getTableName()).colInt("id", false).pk("id");
        return builder.ais().getTable(name);
    }
View Full Code Here

        schemaManager.unRegisterSystemRoutine(new TableName(SCHEMA, RESET));
     
    }
   
    protected AkibanInformationSchema buildSystemObjects() {
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, schemaManager.getTypesTranslator());
       
        builder.procedure(SET_ENABLED)
        .language("java", Routine.CallingConvention.JAVA)
        .paramStringIn("tap_names", 128)
        .paramStringIn("enable", 128)
        .externalName(Routines.class.getName(), "setEnabled");
       
        builder.procedure(RESET)
        .language("java", Routine.CallingConvention.JAVA)
        .paramStringIn("tap_names", 128)
        .externalName(Routines.class.getName(), "resetTaps");
       
        return builder.ais(true);
    }
View Full Code Here

        registerSummaryTable();
    }

    private void registerSummaryTable() {
        SchemaManagerSummaryFactory factory = new SchemaManagerSummaryFactory();
        NewAISBuilder builder = AISBBasedBuilder.create(getTypesTranslator());
        builder.table(factory.getName())
                .colBigInt("cache_misses", false)
                .colBigInt("delayed_tree_count", false)
                .colBigInt("latest_generation", true)
                .colBigInt("latest_timestamp", true)
                .colBigInt("load_count", false)
                .colBigInt("map_size", false)
                .colBigInt("outstanding_count", false)
                .colBigInt("task_queue_size", false);

        AkibanInformationSchema ais = builder.ais();
        Table table = ais.getTable(factory.getName());
        registerMemoryInformationSchemaTable(table, factory);
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.ais.model.aisb2.NewAISGroupIndexStarter

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.