yifan-c commented on code in PR #211: URL: https://github.com/apache/cassandra-sidecar/pull/211#discussion_r2004456719
########## server/src/main/java/org/apache/cassandra/sidecar/db/SidecarLeaseDatabaseAccessor.java: ########## @@ -76,20 +78,22 @@ public LeaseClaimResult extendLease(String currentOwner) */ public static class LeaseClaimResult { - public final boolean leaseAcquired; public final String currentOwner; - LeaseClaimResult(boolean leaseAcquired, String currentOwner) + LeaseClaimResult(String currentOwner) { - this.leaseAcquired = leaseAcquired; this.currentOwner = currentOwner; } static LeaseClaimResult from(ResultSet resultSet, String newOwner) { return resultSet.wasApplied() - ? new LeaseClaimResult(true, newOwner) - : new LeaseClaimResult(false, resultSet.one().getString("owner")); + ? new LeaseClaimResult(newOwner) + // In some rare cases, the resultSet will not contain the owner information + // even though the resultSet was not applied. This will translate into an + // IllegalArgumentException being thrown when trying to retrieve the non-existing + // owner string. This exception is left to be handled by the caller method + : new LeaseClaimResult(resultSet.one().getString("owner")); Review Comment: my thinking was also unclear. Disregard it :p -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org