Search in sources :

Example 11 with TableReference

use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.

the class TableRemappingKeyValueService method truncateTables.

@Override
public void truncateTables(Set<TableReference> tableRefs) {
    Set<TableReference> tablesToTruncate = Sets.newHashSet();
    for (TableReference tableRef : tableRefs) {
        try {
            tablesToTruncate.add(tableMapper.getMappedTableName(tableRef));
        } catch (TableMappingNotFoundException e) {
            throw new IllegalArgumentException(e);
        }
    }
    delegate().truncateTables(tablesToTruncate);
}
Also used : TableReference(com.palantir.atlasdb.keyvalue.api.TableReference)

Example 12 with TableReference

use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.

the class TableRemappingKeyValueService method dropTables.

@Override
public void dropTables(Set<TableReference> tableRefs) {
    Set<TableReference> tableNames = getShortTableReferencesForExistingTables(tableRefs);
    delegate().dropTables(tableNames);
    // We're purposely updating the table mappings after all drops are complete
    for (TableReference tableRef : tableRefs) {
        // Handles the edge case of deleting _namespace when clearing the kvs
        if (tableRef.equals(AtlasDbConstants.NAMESPACE_TABLE)) {
            break;
        }
        tableMapper.removeTable(tableRef);
    }
}
Also used : TableReference(com.palantir.atlasdb.keyvalue.api.TableReference)

Example 13 with TableReference

use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.

the class TableSplittingKeyValueService method dropTables.

@Override
public void dropTables(Set<TableReference> tableRefs) {
    Map<KeyValueService, Set<TableReference>> tablesByKvs = Maps.newHashMap();
    for (TableReference tableRef : tableRefs) {
        KeyValueService delegate = getDelegate(tableRef);
        if (tablesByKvs.containsKey(delegate)) {
            tablesByKvs.get(delegate).add(tableRef);
        } else {
            Set<TableReference> tablesBelongingToThisDelegate = Sets.newHashSet(tableRef);
            tablesByKvs.put(delegate, tablesBelongingToThisDelegate);
        }
    }
    for (Entry<KeyValueService, Set<TableReference>> kvsEntry : tablesByKvs.entrySet()) {
        kvsEntry.getKey().dropTables(kvsEntry.getValue());
    }
}
Also used : KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) Set(java.util.Set)

Example 14 with TableReference

use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.

the class AbstractDbKvsKeyValueServiceTest method dontThrowWhenCreatingTheSameLongTable.

@Test
public void dontThrowWhenCreatingTheSameLongTable() throws Exception {
    TableReference longTableName = TableReference.create(TEST_NAMESPACE, TEST_LONG_TABLE_NAME);
    keyValueService.createTable(longTableName, AtlasDbConstants.GENERIC_TABLE_METADATA);
    keyValueService.createTable(longTableName, AtlasDbConstants.GENERIC_TABLE_METADATA);
    keyValueService.dropTable(longTableName);
}
Also used : TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) AbstractKeyValueServiceTest(com.palantir.atlasdb.keyvalue.impl.AbstractKeyValueServiceTest) Test(org.junit.Test)

Example 15 with TableReference

use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.

the class AtlasDbServiceImplTest method shouldTruncateSystemTables.

@Test
public void shouldTruncateSystemTables() throws Exception {
    atlasDbService.truncateTable("_locks");
    TableReference tableToTruncate = TableReference.createWithEmptyNamespace("_locks");
    verify(kvs, atLeastOnce()).truncateTable(tableToTruncate);
}
Also used : TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) Test(org.junit.Test)

Aggregations

TableReference (com.palantir.atlasdb.keyvalue.api.TableReference)112 Cell (com.palantir.atlasdb.keyvalue.api.Cell)41 Test (org.junit.Test)41 Map (java.util.Map)17 ImmutableMap (com.google.common.collect.ImmutableMap)13 Multimap (com.google.common.collect.Multimap)13 Entry (java.util.Map.Entry)13 Set (java.util.Set)13 RowResult (com.palantir.atlasdb.keyvalue.api.RowResult)12 Value (com.palantir.atlasdb.keyvalue.api.Value)12 Collection (java.util.Collection)12 List (java.util.List)12 ImmutableSet (com.google.common.collect.ImmutableSet)11 KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)11 RangeRequest (com.palantir.atlasdb.keyvalue.api.RangeRequest)11 SortedMap (java.util.SortedMap)11 Lists (com.google.common.collect.Lists)10 AtlasDbConstants (com.palantir.atlasdb.AtlasDbConstants)10 Sets (com.google.common.collect.Sets)9 InsufficientConsistencyException (com.palantir.atlasdb.keyvalue.api.InsufficientConsistencyException)9