couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [08/48] mem3 commit: updated refs/heads/windsor-merge to ff02b9a
Date Fri, 01 Aug 2014 09:10:54 GMT
Fix load_shards_from_disk/2

load_shards_from_disk/2 did not expect #ordered_shards to be returned
from load_shards_from_disk/1. Since it uses a list comprehension the
mistake is silently squashed, resulting in an empty list.

In production this manifests are the occasional failure, where 'n' is
calculated as 0, causing quorum reads to fail. The very next call
succeeds as it reads the cached versions and correctly downcasts.

BugzID: 20629


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/c9292bb3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/c9292bb3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/c9292bb3

Branch: refs/heads/windsor-merge
Commit: c9292bb3a204bd14ada2f28d5f7b3d7d96c88152
Parents: 1d50774
Author: Robert Newson <robert.newson@cloudant.com>
Authored: Thu Jun 27 19:19:24 2013 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Wed Jul 23 18:46:25 2014 +0100

----------------------------------------------------------------------
 src/mem3_shards.erl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/c9292bb3/src/mem3_shards.erl
----------------------------------------------------------------------
diff --git a/src/mem3_shards.erl b/src/mem3_shards.erl
index 2d21db2..df8cbac 100644
--- a/src/mem3_shards.erl
+++ b/src/mem3_shards.erl
@@ -278,7 +278,11 @@ load_shards_from_db(#db{} = ShardDb, DbName) ->
 load_shards_from_disk(DbName, DocId)->
     Shards = load_shards_from_disk(DbName),
     HashKey = mem3_util:hash(DocId),
-    [S || #shard{range = [B,E]} = S <- Shards, B =< HashKey, HashKey =< E].
+    [S || S <- Shards, in_range(S, HashKey)].
+
+in_range(Shard, HashKey) ->
+    [B, E] = mem3:range(Shard),
+    B =< HashKey andalso HashKey =< E.
 
 create_if_missing(Name) ->
     DbDir = config:get("couchdb", "database_dir"),


Mime
View raw message