cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulo Motta (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-11258) Repair scheduling - Resource locking API
Date Mon, 25 Apr 2016 22:17:13 GMT


Paulo Motta commented on CASSANDRA-11258:

The only thing I mildly dislike about the interfaces is that they throw exception when it's
not possible to acquire or renew the lock, but since this is quite a common case should we
use {{Optional}} and {{boolean}} instead? WDYT about this definition?
interface Lease {
 long getExpiration();
 boolean renew(long duration) throws LeaseException;
 boolean cancel() throws LeaseException;
 boolean isValid();

interface LeaseFactory {
 Optional<Lease> newLease(long duration, String resource, int priority, Map<String,
String> metadata) throws LeaseException;

We would still throw {{LeaseException}} if some unexpected error occur when trying to acquire,
renew or cancel the lock.

bq. I think the LeaseMap(mentioned in the JINI lease spec) or a similar interface will be
useful for locking multiple data centers.

sounds good, but we can probably revisit and extend the library when adding multi-DC support.

Also, we should probably add another field "isActive" to {{resource_lease_priority}}, to avoid
try acquiring a higher priority lock (and contend on CAS) if a lower priority lock is currently

> Repair scheduling - Resource locking API
> ----------------------------------------
>                 Key: CASSANDRA-11258
>                 URL:
>             Project: Cassandra
>          Issue Type: Sub-task
>            Reporter: Marcus Olsson
>            Assignee: Marcus Olsson
>            Priority: Minor
> Create a resource locking API & implementation that is able to lock a resource in
a specified data center. It should handle priorities to avoid node starvation.

This message was sent by Atlassian JIRA

View raw message