Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 35cb9388f -> de784a580


use shard suffix when generating _changes ETag

In CouchDB 2.0, instance_start_time is always 0.
This means that when generating ETag values derived
from the database info object, the same ETags can be
incorrectly deemed valid between different database
instances with the metadata.

To avoid this we can incorporate the unique shard
suffix for the database instance when generating
the current ETag value.

COUCHDB-3017


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

Branch: refs/heads/master
Commit: c4b955f419955e31e57f66b36edc0940fdb81d74
Parents: 7cffe7e
Author: Will Holley <willhol...@gmail.com>
Authored: Fri May 13 22:15:32 2016 +0100
Committer: Will Holley <willhol...@gmail.com>
Committed: Fri May 13 22:15:32 2016 +0100

----------------------------------------------------------------------
 src/chttpd_db.erl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/c4b955f4/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 9347c1a..b47a471 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -90,7 +90,8 @@ handle_changes_req1(#httpd{}=Req, Db) ->
     "normal" ->
         T0 = os:timestamp(),
         {ok, Info} = fabric:get_db_info(Db),
-        Etag = chttpd:make_etag(Info),
+        Suffix = mem3:shard_suffix(Db),
+        Etag = chttpd:make_etag({Info, Suffix}),
         DeltaT = timer:now_diff(os:timestamp(), T0) / 1000,
         couch_stats:update_histogram([couchdb, dbinfo], DeltaT),
         chttpd:etag_respond(Req, Etag, fun() ->

Reply via email to