Apache9 commented on code in PR #4808: URL: https://github.com/apache/hbase/pull/4808#discussion_r1003149647
########## hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/TableReplicationQueueStorage.java: ########## @@ -541,4 +538,58 @@ public boolean hasData() throws ReplicationException { throw new ReplicationException("failed to get replication queue table", e); } } + + @Override + public void batchUpdate(ServerName serverName, List<ReplicationQueueData> datas) + throws ReplicationException { + List<Put> puts = new ArrayList<>(); + for (ReplicationQueueData data : datas) { + if (data.getOffsets().isEmpty()) { + continue; + } + Put put = new Put(Bytes.toBytes(data.getId().toString())); + data.getOffsets().forEach((walGroup, offset) -> { + put.addColumn(QUEUE_FAMILY, Bytes.toBytes(walGroup), Bytes.toBytes(offset.toString())); + }); + puts.add(put); + } + try (Table table = conn.getTable(tableName)) { + table.put(puts); + } catch (IOException e) { + throw new ReplicationException("failed to batch update queues", e); + } + } + + @Override + public void batchUpdate(List<ZkLastPushedSeqId> lastPushedSeqIds) throws ReplicationException { + Map<String, Put> peerId2Put = new HashMap<>(); + for (ZkLastPushedSeqId lastPushedSeqId : lastPushedSeqIds) { + peerId2Put + .computeIfAbsent(lastPushedSeqId.getPeerId(), peerId -> new Put(Bytes.toBytes(peerId))) + .addColumn(LAST_SEQUENCE_ID_FAMILY, Bytes.toBytes(lastPushedSeqId.getEncodedRegionName()), + Bytes.toBytes(lastPushedSeqId.getLastPushedSeqId())); + } + try (Table table = conn.getTable(tableName)) { + table + .put(peerId2Put.values().stream().filter(p -> !p.isEmpty()).collect(Collectors.toList())); + } catch (IOException e) { + throw new ReplicationException("failed to batch update last pushed sequence ids", e); + } + } + + @Override + public void batchUpdate(String peerId, List<String> hfileRefs) throws ReplicationException { + if (hfileRefs.isEmpty()) { + return; + } + Put put = new Put(Bytes.toBytes(peerId)); + for (String ref : hfileRefs) { + put.addColumn(HFILE_REF_FAMILY, Bytes.toBytes(ref), HConstants.EMPTY_BYTE_ARRAY); + } + try (Table table = conn.getTable(tableName)) { + table.put(put); Review Comment: This is a single put, where it contains a lot column, but for the same row. ########## hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/TableReplicationQueueStorage.java: ########## @@ -541,4 +538,58 @@ public boolean hasData() throws ReplicationException { throw new ReplicationException("failed to get replication queue table", e); } } + + @Override + public void batchUpdate(ServerName serverName, List<ReplicationQueueData> datas) + throws ReplicationException { + List<Put> puts = new ArrayList<>(); + for (ReplicationQueueData data : datas) { + if (data.getOffsets().isEmpty()) { + continue; + } + Put put = new Put(Bytes.toBytes(data.getId().toString())); + data.getOffsets().forEach((walGroup, offset) -> { + put.addColumn(QUEUE_FAMILY, Bytes.toBytes(walGroup), Bytes.toBytes(offset.toString())); + }); + puts.add(put); Review Comment: This is a single put, where it contains a lot column, but for the same row. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org