org.apache.hadoop.hbase.wal.WALKeyImpl.getReplicationScopes()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.apache.hadoop.hbase.wal.WALKeyImpl.getReplicationScopes()方法的一些代码示例,展示了WALKeyImpl.getReplicationScopes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WALKeyImpl.getReplicationScopes()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.wal.WALKeyImpl
类名称:WALKeyImpl
方法名:getReplicationScopes

WALKeyImpl.getReplicationScopes介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

  1. @Override
  2. public Cell filterCell(Entry entry, Cell cell) {
  3. NavigableMap<byte[], Integer> scopes = entry.getKey().getReplicationScopes();
  4. if (scopes == null || scopes.isEmpty()) {
  5. return null;
  6. }
  7. byte[] family = CellUtil.cloneFamily(cell);
  8. if (CellUtil.matchingColumn(cell, WALEdit.METAFAMILY, WALEdit.BULK_LOAD)) {
  9. return bulkLoadFilter.filterCell(cell, new Predicate<byte[]>() {
  10. @Override
  11. public boolean apply(byte[] family) {
  12. return !hasGlobalScope(scopes, family);
  13. }
  14. });
  15. }
  16. return hasGlobalScope(scopes, family) ? cell : null;
  17. }
  18. }

代码示例来源:origin: apache/hbase

  1. @Test
  2. public void testBulkLoadWALEditsWithoutBulkLoadReplicationEnabled() throws Exception {
  3. NavigableMap<byte[], Integer> scope = new TreeMap<>(Bytes.BYTES_COMPARATOR);
  4. // 1. Get the bulk load wal edit event
  5. WALEdit logEdit = getBulkLoadWALEdit(scope);
  6. // 2. Create wal key
  7. WALKeyImpl logKey = new WALKeyImpl(scope);
  8. // 3. Get the scopes for the key
  9. ReplicationSourceWALActionListener.scopeWALEdits(logKey, logEdit, conf);
  10. // 4. Assert that no bulk load entry scopes are added if bulk load hfile replication is disabled
  11. assertNull("No bulk load entries scope should be added if bulk load replication is disabled.",
  12. logKey.getReplicationScopes());
  13. }

代码示例来源:origin: apache/hbase

  1. @Test
  2. public void testBulkLoadWALEdits() throws Exception {
  3. // 1. Get the bulk load wal edit event
  4. NavigableMap<byte[], Integer> scope = new TreeMap<>(Bytes.BYTES_COMPARATOR);
  5. WALEdit logEdit = getBulkLoadWALEdit(scope);
  6. // 2. Create wal key
  7. WALKeyImpl logKey = new WALKeyImpl(scope);
  8. // 3. Enable bulk load hfile replication
  9. Configuration bulkLoadConf = HBaseConfiguration.create(conf);
  10. bulkLoadConf.setBoolean(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY, true);
  11. // 4. Get the scopes for the key
  12. ReplicationSourceWALActionListener.scopeWALEdits(logKey, logEdit, bulkLoadConf);
  13. NavigableMap<byte[], Integer> scopes = logKey.getReplicationScopes();
  14. // Assert family with replication scope global is present in the key scopes
  15. assertTrue("This family scope is set to global, should be part of replication key scopes.",
  16. scopes.containsKey(f1));
  17. // Assert family with replication scope local is not present in the key scopes
  18. assertFalse("This family scope is set to local, should not be part of replication key scopes",
  19. scopes.containsKey(f2));
  20. }

代码示例来源:origin: org.apache.hbase/hbase-server

  1. @Test
  2. public void testBulkLoadWALEditsWithoutBulkLoadReplicationEnabled() throws Exception {
  3. NavigableMap<byte[], Integer> scope = new TreeMap<>(Bytes.BYTES_COMPARATOR);
  4. // 1. Get the bulk load wal edit event
  5. WALEdit logEdit = getBulkLoadWALEdit(scope);
  6. // 2. Create wal key
  7. WALKeyImpl logKey = new WALKeyImpl(scope);
  8. // 3. Get the scopes for the key
  9. ReplicationSourceWALActionListener.scopeWALEdits(logKey, logEdit, conf);
  10. // 4. Assert that no bulk load entry scopes are added if bulk load hfile replication is disabled
  11. assertNull("No bulk load entries scope should be added if bulk load replication is disabled.",
  12. logKey.getReplicationScopes());
  13. }

代码示例来源:origin: org.apache.hbase/hbase-server

  1. @Test
  2. public void testBulkLoadWALEdits() throws Exception {
  3. // 1. Get the bulk load wal edit event
  4. NavigableMap<byte[], Integer> scope = new TreeMap<>(Bytes.BYTES_COMPARATOR);
  5. WALEdit logEdit = getBulkLoadWALEdit(scope);
  6. // 2. Create wal key
  7. WALKeyImpl logKey = new WALKeyImpl(scope);
  8. // 3. Enable bulk load hfile replication
  9. Configuration bulkLoadConf = HBaseConfiguration.create(conf);
  10. bulkLoadConf.setBoolean(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY, true);
  11. // 4. Get the scopes for the key
  12. ReplicationSourceWALActionListener.scopeWALEdits(logKey, logEdit, bulkLoadConf);
  13. NavigableMap<byte[], Integer> scopes = logKey.getReplicationScopes();
  14. // Assert family with replication scope global is present in the key scopes
  15. assertTrue("This family scope is set to global, should be part of replication key scopes.",
  16. scopes.containsKey(f1));
  17. // Assert family with replication scope local is not present in the key scopes
  18. assertFalse("This family scope is set to local, should not be part of replication key scopes",
  19. scopes.containsKey(f2));
  20. }

相关文章