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);
}
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);
}
}
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());
}
}
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);
}
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);
}
Aggregations