Search in sources :

Example 1 with LOADED

use of org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.LOADED in project accumulo by apache.

the class BulkNewIT method verifyMetadata.

private void verifyMetadata(AccumuloClient client, String tableName, Map<String, Set<String>> expectedHashes) {
    Set<String> endRowsSeen = new HashSet<>();
    String id = client.tableOperations().tableIdMap().get(tableName);
    try (TabletsMetadata tablets = TabletsMetadata.builder(client).forTable(TableId.of(id)).fetch(FILES, LOADED, PREV_ROW).build()) {
        for (TabletMetadata tablet : tablets) {
            assertTrue(tablet.getLoaded().isEmpty());
            Set<String> fileHashes = tablet.getFiles().stream().map(f -> hash(f.getMetaUpdateDelete())).collect(Collectors.toSet());
            String endRow = tablet.getEndRow() == null ? "null" : tablet.getEndRow().toString();
            assertEquals(expectedHashes.get(endRow), fileHashes);
            endRowsSeen.add(endRow);
        }
        assertEquals(expectedHashes.keySet(), endRowsSeen);
    }
}
Also used : TableId(org.apache.accumulo.core.data.TableId) Arrays(java.util.Arrays) SortedSet(java.util.SortedSet) FileSystem(org.apache.hadoop.fs.FileSystem) TabletsMetadata(org.apache.accumulo.core.metadata.schema.TabletsMetadata) Text(org.apache.hadoop.io.Text) FsPermission(org.apache.hadoop.fs.permission.FsPermission) FileOperations(org.apache.accumulo.core.file.FileOperations) Map(java.util.Map) Configuration(org.apache.hadoop.conf.Configuration) Path(org.apache.hadoop.fs.Path) BigInteger(java.math.BigInteger) Value(org.apache.accumulo.core.data.Value) PREV_ROW(org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.PREV_ROW) Property(org.apache.accumulo.core.conf.Property) LoadPlan(org.apache.accumulo.core.data.LoadPlan) ServerType(org.apache.accumulo.minicluster.ServerType) AfterClass(org.junit.AfterClass) Set(java.util.Set) TimeType(org.apache.accumulo.core.client.admin.TimeType) MiniClusterConfigurationCallback(org.apache.accumulo.harness.MiniClusterConfigurationCallback) RangeType(org.apache.accumulo.core.data.LoadPlan.RangeType) LOADED(org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.LOADED) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) AccumuloClient(org.apache.accumulo.core.client.AccumuloClient) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) Entry(java.util.Map.Entry) Scanner(org.apache.accumulo.core.client.Scanner) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings) BeforeClass(org.junit.BeforeClass) MessageDigest(java.security.MessageDigest) Assert.assertThrows(org.junit.Assert.assertThrows) HashMap(java.util.HashMap) Accumulo(org.apache.accumulo.core.client.Accumulo) TreeSet(java.util.TreeSet) TabletMetadata(org.apache.accumulo.core.metadata.schema.TabletMetadata) MemoryUnit(org.apache.accumulo.minicluster.MemoryUnit) HashSet(java.util.HashSet) NewTableConfiguration(org.apache.accumulo.core.client.admin.NewTableConfiguration) FileSKVWriter(org.apache.accumulo.core.file.FileSKVWriter) FSDataOutputStream(org.apache.hadoop.fs.FSDataOutputStream) Key(org.apache.accumulo.core.data.Key) MiniAccumuloConfigImpl(org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl) FILES(org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.FILES) Before(org.junit.Before) Iterator(java.util.Iterator) Files(java.nio.file.Files) RawLocalFileSystem(org.apache.hadoop.fs.RawLocalFileSystem) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) Authorizations(org.apache.accumulo.core.security.Authorizations) CryptoServiceFactory(org.apache.accumulo.core.crypto.CryptoServiceFactory) AccumuloException(org.apache.accumulo.core.client.AccumuloException) AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration) ExecutionException(java.util.concurrent.ExecutionException) SharedMiniClusterBase(org.apache.accumulo.harness.SharedMiniClusterBase) RFile(org.apache.accumulo.core.file.rfile.RFile) Paths(java.nio.file.Paths) Assert.assertEquals(org.junit.Assert.assertEquals) TabletsMetadata(org.apache.accumulo.core.metadata.schema.TabletsMetadata) TabletMetadata(org.apache.accumulo.core.metadata.schema.TabletMetadata) HashSet(java.util.HashSet)

Aggregations

SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 BigInteger (java.math.BigInteger)1 Files (java.nio.file.Files)1 Paths (java.nio.file.Paths)1 MessageDigest (java.security.MessageDigest)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Set (java.util.Set)1 SortedSet (java.util.SortedSet)1 TreeSet (java.util.TreeSet)1 ExecutionException (java.util.concurrent.ExecutionException)1 Collectors (java.util.stream.Collectors)1 Accumulo (org.apache.accumulo.core.client.Accumulo)1