Skip to content

Commit

Permalink
Don't try to replicate to more nodes than we have.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Sep 22, 2012
1 parent 5f60f00 commit 26a66ab
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,19 @@ func ensureMinimumReplicaCount() error {
}
}{}

// Don't bother trying to replicate to more nodes than exist.
endKey := globalConfig.MinReplicas - 1
if globalConfig.MinReplicas > len(nl) {
endKey = len(nl) - 1
}

// Find some less replicated docs to suck in.
err = couchbase.ViewCustom("cbfs", "repcounts",
map[string]interface{}{
"reduce": false,
"limit": 1000,
"startkey": 1,
"endkey": globalConfig.MinReplicas - 1,
"endkey": endKey,
"stale": false,
},
&viewRes)
Expand Down

0 comments on commit 26a66ab

Please sign in to comment.