You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2019/03/06 09:49:43 UTC
[GitHub] [couchdb-documentation] janl commented on a change in pull request
#397: Add latest RFC draft for FDB revision storage
janl commented on a change in pull request #397: Add latest RFC draft for FDB revision storage
URL: https://github.com/apache/couchdb-documentation/pull/397#discussion_r262864728
##########
File path: rfcs/001-fdb-revision-metadata-model.md
##########
@@ -0,0 +1,179 @@
+[NOTE]: # ( ^^ Provide a general summary of the RFC in the title above. ^^ )
+
+# Introduction
+
+This is a proposal for the storage of document revision history metadata as a
+set of KVs in FoundationDB.
+
+## Abstract
+
+This design stores each edit branch as its own KV, and all of the edit branches
+are stored separately from the actual document data. Document reads can avoid
+retrieving this information, while writes can avoid retrieving the document
+body.
+
+## Requirements Language
+
+[NOTE]: # ( Do not alter the section below. Follow its instructions. )
+
+The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
+"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
+interpreted as described in [RFC
+2119](https://www.rfc-editor.org/rfc/rfc2119.txt).
+
+## Terminology
+
+[TIP]: # ( Provide a list of any unique terms or acronyms, and their
+definitions here.)
+
+---
+
+# Detailed Description
+
+The size limits in FoundationDB preclude storing the entire revision tree as a
+single value; in pathological situations the tree could exceed 100KB. Rather, we
+propose to store each edit *branch* as a separate KV. Specifically, we create a
+"revisions" subdirectory in each database directory to store the revision trees
+with keys and values that look like
+
+`(“revisions”, DocID, NotDeleted, RevFormat, RevPosition, RevHash) =
+(Versionstamp, [ParentRev, GrandparentRev, …])`
+
+where the individual elements of the key and value are defined as follows:
+- `DocID`: the document ID
+- `NotDeleted`: `\x00` if the leaf of the edit branch is deleted, `\x01`
+ otherwise
+- `RevFormat`: enum for the revision encoding being used, start at `\x01` with
+ this proposal
+- `RevPosition`: positive integer encoded using standard tuple layer encoding
+ (signed, variable-length, order-preserving)
+- `RevHash`: 16 bytes uniquely identifying this revision
+- `Versionstamp`: the FoundationDB
+ [versionstamp](https://apple.github.io/foundationdb/api-python.html#fdb.tuple.Versionstamp)
+ associated with the last transaction that modified the document (NB: not
+ necessarily the last edit to *this* branch).
+- `[ParentRev, GrandparentRev, ...]`: 16 byte identifiers of ancestors, up to
+ 1000 by default
+
+## Limits
+
+In order to stay compatible with FoundationDB size limits we need to prevent
+administrators from increasing `_revs_limit` beyond what we can fit into a
+single value. Suggest **4000** as a max.
Review comment:
It’s rather edge-casey, but allowing to lower revs_limit has proved beneficial in a handful of cases in the past. I would be okay with a fixed lower bound that is > 1 if we fix it at, say 10, which would still solve the edge-case, but don’t suggest the flawed understanding of revs_limit eliminating tombstones.
That said, it might be easier to keep the default and keep it configurable for the time being. I’d argue against hardcoding this.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services