Kota-SH commented on code in PR #7481:
URL: https://github.com/apache/hbase/pull/7481#discussion_r2614654145


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptor.java:
##########
@@ -316,4 +323,23 @@ default boolean matchReplicationScope(boolean enabled) {
     }
     return !enabled;
   }
+
+  /**
+   * Computes a CRC32 hash of the table descriptor's protobuf representation. 
This hash can be used
+   * to detect changes in the table descriptor configuration.
+   * @return A hex string representation of the CRC32 hash, or "UNKNOWN" if 
computation fails
+   */
+  default String getDescriptorHash() {
+    try {
+      HBaseProtos.TableSchema tableSchema = ProtobufUtil.toTableSchema(this);
+      ByteBuffer byteBuffer = ByteBuffer.wrap(tableSchema.toByteArray());
+      CRC32 crc32 = new CRC32();
+      crc32.update(byteBuffer);
+      return Long.toHexString(crc32.getValue());
+    } catch (Exception e) {
+      Logger log = LoggerFactory.getLogger(TableDescriptor.class);

Review Comment:
   Can we move this log variable to the class level to be consistent? 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to