Apache9 commented on code in PR #6260:
URL: https://github.com/apache/hbase/pull/6260#discussion_r1804926334


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java:
##########
@@ -649,6 +655,40 @@ public void 
logPositionAndCleanOldLogs(ReplicationSourceInterface source,
     cleanOldLogs(walName, entryBatch.isEndOfFile(), source);
   }
 
+  public void postAppend(final long size, final long time, final WALKey logkey,
+    final WALEdit logEdit) {
+    try {
+      long walReplAppendSize = 0;
+      List<ReplicationSourceInterface> replicationSources = getSources();
+      for (ReplicationSourceInterface replicationSourceI : replicationSources) 
{
+        if (replicationSourceI instanceof ReplicationSource) {
+          MetricsSource source = replicationSourceI.getSourceMetrics();
+          ReplicationSource replicationSource = (ReplicationSource) 
replicationSourceI;
+          WALEntryFilter filter = replicationSource.getWalEntryFilter();
+          WAL.Entry filtered = filter.filter(new WAL.Entry((WALKeyImpl) 
logkey, logEdit));
+          if (filtered != null && filtered.getEdit() != null && 
!filtered.getEdit().isEmpty()) {
+            walReplAppendSize = 
ReplicationSourceWALReader.getEntrySizeIncludeBulkLoad(filtered);
+            // get the replication metrics source for table at the run time
+            TableName tableName = logkey.getTableName();
+            MetricsReplicationTableSource tableSource =
+              source.getSingleSourceSourceByTable().computeIfAbsent(

Review Comment:
   Better put this logic in the metrics module?



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java:
##########
@@ -649,6 +655,40 @@ public void 
logPositionAndCleanOldLogs(ReplicationSourceInterface source,
     cleanOldLogs(walName, entryBatch.isEndOfFile(), source);
   }
 
+  public void postAppend(final long size, final long time, final WALKey logkey,

Review Comment:
   Does this method needs to be public?



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java:
##########
@@ -649,6 +655,40 @@ public void 
logPositionAndCleanOldLogs(ReplicationSourceInterface source,
     cleanOldLogs(walName, entryBatch.isEndOfFile(), source);
   }
 
+  public void postAppend(final long size, final long time, final WALKey logkey,
+    final WALEdit logEdit) {
+    try {
+      long walReplAppendSize = 0;
+      List<ReplicationSourceInterface> replicationSources = getSources();
+      for (ReplicationSourceInterface replicationSourceI : replicationSources) 
{
+        if (replicationSourceI instanceof ReplicationSource) {
+          MetricsSource source = replicationSourceI.getSourceMetrics();
+          ReplicationSource replicationSource = (ReplicationSource) 
replicationSourceI;
+          WALEntryFilter filter = replicationSource.getWalEntryFilter();
+          WAL.Entry filtered = filter.filter(new WAL.Entry((WALKeyImpl) 
logkey, logEdit));
+          if (filtered != null && filtered.getEdit() != null && 
!filtered.getEdit().isEmpty()) {
+            walReplAppendSize = 
ReplicationSourceWALReader.getEntrySizeIncludeBulkLoad(filtered);
+            // get the replication metrics source for table at the run time
+            TableName tableName = logkey.getTableName();
+            MetricsReplicationTableSource tableSource =
+              source.getSingleSourceSourceByTable().computeIfAbsent(
+                tableName.getMetricPrefixTableName(), t -> 
CompatibilitySingletonFactory
+                  
.getInstance(MetricsReplicationSourceFactory.class).getTableSource(t));
+            // LOG.info("repl key=" + filtered.getKey() + ",edit=" +

Review Comment:
   Remove these lines?



-- 
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

Reply via email to