Search in sources :

Example 6 with Schema

use of com.palantir.atlasdb.table.description.Schema in project atlasdb by palantir.

the class TransactionManagersInitializer method tryInitialize.

@Override
@Idempotent
public synchronized void tryInitialize() {
    TransactionTables.createTables(keyValueService);
    for (Schema schema : schemas) {
        Schemas.createTablesAndIndexes(schema, keyValueService);
        schemaMetadataService.putSchemaMetadata(schema.getName(), schema.getSchemaMetadata());
    }
    // Prime the key value service with logging information.
    // TODO (jkong): Needs to be changed if/when we support dynamic table creation.
    LoggingArgs.hydrate(keyValueService.getMetadataForTables());
}
Also used : Schema(com.palantir.atlasdb.table.description.Schema) Idempotent(com.palantir.common.annotation.Idempotent)

Example 7 with Schema

use of com.palantir.atlasdb.table.description.Schema in project atlasdb by palantir.

the class BenchmarksSchema method generateSchema.

private static Schema generateSchema() {
    Schema schema = new Schema("Benchmarks", BenchmarksSchema.class.getPackage().getName() + ".generated", NAMESPACE, OptionalType.JAVA8);
    createTables(schema);
    schema.validate();
    return schema;
}
Also used : AtlasSchema(com.palantir.atlasdb.schema.AtlasSchema) Schema(com.palantir.atlasdb.table.description.Schema)

Example 8 with Schema

use of com.palantir.atlasdb.table.description.Schema in project atlasdb by palantir.

the class KeyValueServiceModule method provideWrappedKeyValueService.

@Provides
@Singleton
@Named("kvs")
public KeyValueService provideWrappedKeyValueService(@Named("rawKvs") KeyValueService rawKvs, TimestampService tss, ServicesConfig config) {
    KvsProfilingLogger.setSlowLogThresholdMillis(config.atlasDbConfig().getKvsSlowLogThresholdMillis());
    KeyValueService kvs = ProfilingKeyValueService.create(rawKvs);
    kvs = TracingKeyValueService.create(kvs);
    kvs = AtlasDbMetrics.instrument(KeyValueService.class, kvs);
    kvs = ValidatingQueryRewritingKeyValueService.create(kvs);
    SweepConfig sweepConfig = config.atlasDbRuntimeConfig().sweep();
    kvs = SweepStatsKeyValueService.create(kvs, tss, sweepConfig::writeThreshold, sweepConfig::writeSizeThreshold);
    TransactionTables.createTables(kvs);
    ImmutableSet<Schema> schemas = ImmutableSet.<Schema>builder().add(SweepSchema.INSTANCE.getLatestSchema()).add(CompactSchema.INSTANCE.getLatestSchema()).addAll(config.schemas()).build();
    for (Schema schema : schemas) {
        Schemas.createTablesAndIndexes(schema, kvs);
    }
    return kvs;
}
Also used : SweepConfig(com.palantir.atlasdb.config.SweepConfig) ValidatingQueryRewritingKeyValueService(com.palantir.atlasdb.keyvalue.impl.ValidatingQueryRewritingKeyValueService) TracingKeyValueService(com.palantir.atlasdb.keyvalue.impl.TracingKeyValueService) ProfilingKeyValueService(com.palantir.atlasdb.keyvalue.impl.ProfilingKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) SweepStatsKeyValueService(com.palantir.atlasdb.keyvalue.impl.SweepStatsKeyValueService) SweepSchema(com.palantir.atlasdb.schema.SweepSchema) CompactSchema(com.palantir.atlasdb.schema.CompactSchema) Schema(com.palantir.atlasdb.table.description.Schema) Named(javax.inject.Named) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 9 with Schema

use of com.palantir.atlasdb.table.description.Schema in project atlasdb by palantir.

the class TodoSchema method generateSchema.

private static Schema generateSchema() {
    Schema schema = new Schema(TodoSchema.class.getSimpleName(), TodoSchema.class.getPackage().getName() + ".generated", Namespace.DEFAULT_NAMESPACE, OptionalType.JAVA8);
    schema.addTableDefinition(TODO_TABLE, new TableDefinition() {

        {
            rowName();
            rowComponent("id", ValueType.FIXED_LONG);
            columns();
            column(TEXT_COLUMN, "t", ValueType.STRING);
        }
    });
    return schema;
}
Also used : AtlasSchema(com.palantir.atlasdb.schema.AtlasSchema) Schema(com.palantir.atlasdb.table.description.Schema) TableDefinition(com.palantir.atlasdb.table.description.TableDefinition)

Example 10 with Schema

use of com.palantir.atlasdb.table.description.Schema in project atlasdb by palantir.

the class StreamTestSchema method generateSchema.

private static Schema generateSchema() {
    Schema schema = new Schema("StreamTest", StreamTestSchema.class.getPackage().getName() + ".generated", Namespace.DEFAULT_NAMESPACE, OptionalType.JAVA8);
    schema.addTableDefinition("blobs", new TableDefinition() {

        {
            javaTableName("KeyValue");
            rangeScanAllowed();
            rowName();
            rowComponent("key", ValueType.STRING);
            columns();
            column("streamId", "s", ValueType.VAR_LONG);
        }
    });
    schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder("blob", "Value", ValueType.VAR_LONG).inMemoryThreshold(1024 * 1024).tableNameLogSafety(TableMetadataPersistence.LogSafety.SAFE).build());
    return schema;
}
Also used : StreamStoreDefinitionBuilder(com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder) AtlasSchema(com.palantir.atlasdb.schema.AtlasSchema) Schema(com.palantir.atlasdb.table.description.Schema) TableDefinition(com.palantir.atlasdb.table.description.TableDefinition)

Aggregations

Schema (com.palantir.atlasdb.table.description.Schema)11 AtlasSchema (com.palantir.atlasdb.schema.AtlasSchema)8 TableDefinition (com.palantir.atlasdb.table.description.TableDefinition)8 StreamStoreDefinitionBuilder (com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder)3 IndexDefinition (com.palantir.atlasdb.table.description.IndexDefinition)2 SweepConfig (com.palantir.atlasdb.config.SweepConfig)1 KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)1 ProfilingKeyValueService (com.palantir.atlasdb.keyvalue.impl.ProfilingKeyValueService)1 SweepStatsKeyValueService (com.palantir.atlasdb.keyvalue.impl.SweepStatsKeyValueService)1 TracingKeyValueService (com.palantir.atlasdb.keyvalue.impl.TracingKeyValueService)1 ValidatingQueryRewritingKeyValueService (com.palantir.atlasdb.keyvalue.impl.ValidatingQueryRewritingKeyValueService)1 JsonNodePersister (com.palantir.atlasdb.persister.JsonNodePersister)1 CompactSchema (com.palantir.atlasdb.schema.CompactSchema)1 SweepSchema (com.palantir.atlasdb.schema.SweepSchema)1 Idempotent (com.palantir.common.annotation.Idempotent)1 Provides (dagger.Provides)1 Named (javax.inject.Named)1 Singleton (javax.inject.Singleton)1