davisp commented on pull request #2952:
URL: https://github.com/apache/couchdb/pull/2952#issuecomment-649690991


   @kocolosk @nickva So two things. I've gone back and changed to using the 
`\xffmetadataVersion` as the primary cache synchronization but that brings up 
two more questions:
   
   
https://github.com/apache/couchdb/blob/9425a6408274edc1713b990729d4dea4daa4787d/src/fabric/src/fabric2_fdb.erl#L1332-L1336
   
   The first thing I realized is that by using the centralized metadataVersion, 
I think we're basically causing all in-flight write transactions to retry. I'll 
try and write a test case to prove that we can conflict on that key, but that 
also means that any time anyone updates a design doc (or creates or deletes a 
database) we're causing some amount of work to be retried. I can't decide if 
one KV lookup on db_version for every transaction is more or less work in that 
case.
   
   
https://github.com/apache/couchdb/blob/9425a6408274edc1713b990729d4dea4daa4787d/src/fabric/src/fabric2_fdb.erl#L1384-L1397
   
   The second thing I noticed is that `metadataVersion` is also supposed to 
protect between different layers which means we should be going back all the 
way to the directory layer to check that our directory hasn't been renamed and 
what not. That means each time the metadataVersion key we're now adding an 
extra ~5-10 KV lookups in those cases. I've added that as a commit on this PR 
but mostly for the conversation.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to