ritegarg commented on code in PR #2479:
URL: https://github.com/apache/phoenix/pull/2479#discussion_r3291072455
##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/ClusterRoleRecord.java:
##########
@@ -221,6 +241,20 @@ public boolean hasSameInfo(ClusterRoleRecord other) {
return haGroupName.equals(other.haGroupName) &&
policy.equals(other.policy);
}
+ /**
+ * Equality on the six identity/role fields ({@code haGroupName, policy,
url1, url2, role1,
+ * role2}); ignores {@code version} (always bumps) and {@code registryType}
(avoids RPC->ZK
+ * thrash). Returns {@code false} if {@code other} is {@code null}.
+ */
+ public boolean isLogicallyEqualIgnoringVersionAndRegistry(ClusterRoleRecord
other) {
+ if (other == null) {
+ return false;
+ }
+ return Objects.equals(haGroupName, other.haGroupName) &&
Objects.equals(policy, other.policy)
+ && Objects.equals(url1, other.url1) && Objects.equals(url2, other.url2)
+ && role1 == other.role1 && role2 == other.role2;
+ }
Review Comment:
You're right that the URL-normalization point makes the "avoids RPC->ZK
thrash" wording wrong: ZK-form and RPC-form URLs are different strings even for
the same underlying endpoint, so the helper would return false across registry
types. In practice the only caller is the sync path, which gates on
shouldWriteLegacyCrr first and only ever compares two ZK-form records. Updated
the javadoc to describe the actual contract (ignore version and the
registryType field; same-registry callers only) and drop the misleading thrash
claim. No logic change.
--
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]