tkhurana commented on code in PR #2247:
URL: https://github.com/apache/phoenix/pull/2247#discussion_r2240809037


##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/CDCCompactionUtil.java:
##########
@@ -53,19 +54,206 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.phoenix.thirdparty.com.google.common.cache.Cache;
+import org.apache.phoenix.thirdparty.com.google.common.cache.CacheBuilder;
+
 /**
  * Utility class for CDC (Change Data Capture) operations during compaction. 
This class contains
  * utilities for handling TTL row expiration events and generating CDC events 
with pre-image data
- * that are written directly to CDC index tables.
+ * that are written directly to CDC index tables using batch mutations.
  */
 public final class CDCCompactionUtil {
 
   private static final Logger LOGGER = 
LoggerFactory.getLogger(CDCCompactionUtil.class);
 
+  // Shared cache for row images across all CompactionScanner instances in the 
JVM.
+  // Entries expire after 1200 seconds (20 minutes) by default.
+  // The JVM level cache helps merge the pre-image for the row with multiple 
CFs.
+  // The key of the cache contains (regionId + data table rowkey).
+  // The value contains pre-image that needs to be directly inserted in the 
CDC index.
+  private static volatile Cache<ImmutableBytesPtr, Map<String, Object>> 
sharedTtlImageCache;
+
   private CDCCompactionUtil() {
     // empty
   }
 
+  /**
+   * Gets the shared row image cache, initializing it lazily with 
configuration.
+   * @param config The Hadoop configuration to read cache expiry from
+   * @return the shared cache instance
+   */
+  static Cache<ImmutableBytesPtr, Map<String, Object>>

Review Comment:
   If its per region then we don't need all of this code because there is 
nothing to share.



-- 
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...@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to