7931: Don't bother trying to trash replicas on readonly mounts.
authorTom Clegg <tclegg@veritasgenetics.com>
Thu, 22 Mar 2018 16:58:57 +0000 (12:58 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Thu, 22 Mar 2018 16:58:57 +0000 (12:58 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

services/keep-balance/balance.go

index d87e2a29f9a017b0332e1208e40d601ac3753126..9338075d01f466f332dcf63b98b65ec353530d7f 100644 (file)
@@ -430,9 +430,10 @@ func (bal *Balancer) balanceBlock(blkid arvados.SizedDigest, blk *BlockState) {
                slots[i].srv = srv
        }
        for ri := range blk.Replicas {
-               // TODO: when multiple copies are on one server, use
-               // the oldest one that doesn't have a timestamp
-               // collision with other replicas.
+               // TODO: when multiple copies are on one server,
+               // prefer one on a readonly mount, or the oldest one
+               // that doesn't have a timestamp collision with other
+               // replicas.
                repl := &blk.Replicas[ri]
                srv := repl.KeepService
                slotIdx := rendezvousOrder[srv]
@@ -475,6 +476,7 @@ func (bal *Balancer) balanceBlock(blkid arvados.SizedDigest, blk *BlockState) {
                        // distinct from all of the better replicas'
                        // Mtimes.
                        if !srv.ReadOnly &&
+                               !repl.KeepMount.ReadOnly &&
                                repl.Mtime < bal.MinMtime &&
                                len(uniqueBestRepl) >= blk.Desired &&
                                !uniqueBestRepl[repl.Mtime] {