Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API versioning #2832

Open
wants to merge 327 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
327 commits
Select commit Hold shift + click to select a range
4e4b1a8
Fetch docs in parallel for view indexing
garrensmith Sep 9, 2019
3b9a0e3
Fix _changes heartbeat option
nickva Sep 9, 2019
95ae5ba
Implement setting and getting _revs_limit
nickva Sep 16, 2019
9e1317f
Make get_security and get_revs_limit calls consistent
nickva Sep 16, 2019
f37b6d5
Check members after db is opened
nickva Sep 19, 2019
f920172
Add revision stemming for interactive docs
nickva Sep 20, 2019
e6fb78b
Fix doc counts for replicated deletions
nickva Sep 24, 2019
a71fc30
Add more deleted docs replication cases to integration test
nickva Sep 24, 2019
3ccec82
Add couch_eval abstraction layer
garrensmith Aug 14, 2019
36945e7
Initial creation of couch_js application
davisp Aug 20, 2019
6574a4d
Implement couch_js callbacks for couch_eval
davisp Aug 20, 2019
8805234
Add tests for couch_js application
davisp Aug 20, 2019
388c114
Update couch_views to use couch_eval
davisp Aug 20, 2019
31dd2b7
Fix mango index validation
davisp Sep 27, 2019
8a972dd
Fix timeout in couch_views
nickva Oct 3, 2019
831555f
DRY out CouchDB FDB prefix fetching
nickva Oct 14, 2019
168126b
Use a shorter name for create_or_open_couchdb_dir
nickva Oct 15, 2019
b5c4468
Enable FDB transaction tracing
nickva Oct 16, 2019
dd7a382
Take better advantage of metadata version key feature
nickva Oct 17, 2019
7e881e2
Remove compiler warning
iilyak Oct 1, 2019
e6f24ac
Chunkify local docs
nickva Oct 22, 2019
253a48b
Add a special error for an invalid legacy local doc revsion
nickva Oct 24, 2019
a1425f0
add test to prove we can view swap
garrensmith Oct 28, 2019
31f88cf
Use "\xFF/metadataVersion" key for checking metadata
nickva Oct 30, 2019
eb4d0d8
Abandon a view job if the db or ddoc is deleted
davisp Oct 30, 2019
7815e80
Pass contexts to fabric2_db functions
iilyak Oct 1, 2019
c6f5d82
Ensure we can create partitioned design docs with FDB
nickva Nov 4, 2019
3344638
Check security properties in the main transaction
nickva Nov 5, 2019
3b45489
Before starting a db transanction, refresh the db handle from the cache
nickva Nov 8, 2019
da0318f
Update fabric2_fdb's set_config to take un-encoding values
nickva Nov 14, 2019
1420756
Assert Db handle field existence in `load_config/1` in fabric2_fdb
nickva Nov 14, 2019
7eaab66
Check membership when calling get_security/1 in fabric2_db
nickva Nov 15, 2019
6c11319
Support regexp based blacklist in config
iilyak Nov 12, 2019
555d28c
Implement fabric2_server:fdb_cluster/0
iilyak Nov 12, 2019
b49ca70
Add ctrace application
iilyak Nov 12, 2019
0521bca
Trace http endpoints
iilyak Nov 12, 2019
8232be8
Trace fdb transactions
iilyak Nov 12, 2019
8163d99
Implement node types
nickva Nov 21, 2019
6ff0a11
Add operation names for all HTTP endpoints
davisp Nov 21, 2019
5aeb21c
Change end-point /_up to check fdb connectivity
eiri Nov 22, 2019
f943ac1
Optimize view read latency when the view ready
garrensmith Nov 26, 2019
b971493
Retry for failed indexes builds
garrensmith Nov 25, 2019
a59c953
Normalize fabric2 test suite
davisp Dec 4, 2019
ebe14ec
Delete attachments when no longer referenced
davisp Dec 6, 2019
4e8b200
Expiring cache
jaydoane Dec 11, 2019
f358971
Improve transaction name setting when tracing FDB transactions
nickva Dec 18, 2019
e6c4ca3
Add `external` tag to opentrace events
iilyak Jan 14, 2020
9785ea5
Change map indexes to be stored in one row
garrensmith Jan 16, 2020
2fb578d
Delete unused ets table creation
jaydoane Jan 29, 2020
f62ac8e
reserve search namespace
rnewson Jan 29, 2020
98a9d80
Support jaeger http reporter
iilyak Jan 17, 2020
b4a7f6d
fix b3 - Headers suppose to be strings
iilyak Feb 4, 2020
8bcf566
Add basic test case for b3 fix
iilyak Feb 4, 2020
712fe04
Encode startkey/endkey for all_docs (#2538)
garrensmith Feb 13, 2020
e7ed6e9
Fix doc attachment tests
davisp Feb 10, 2020
1511b6d
Track a database level view size rollup
davisp Dec 3, 2019
1b79e11
Implement async API for `fabric2_fdb:get_info/1`
davisp Dec 3, 2019
bd69a01
Implement `fabric2_db:list_dbs_info/1,2,3`
davisp Dec 3, 2019
4248ef7
Support `GET /_dbs_info` endpoint
davisp Dec 3, 2019
f297fe3
Implement mult-transactional iterators for _changes feeds
nickva Jan 31, 2020
cad91ad
Use {restart_tx, false} option in view index builder changes feed
nickva Feb 15, 2020
f4a9e60
Remove attachment headers field
davisp Feb 15, 2020
53518b6
Track the size of data stored in a database
davisp Dec 4, 2019
9cad194
Add tests for database size tracking
davisp Feb 13, 2020
86d87cd
Convert versionstamps to binaries
davisp Feb 14, 2020
193c342
Test coverage: list_dbs and list_dbs_info
davisp Feb 14, 2020
8ebebcf
Test coverage: get_full_doc_info
davisp Feb 14, 2020
e946ed3
Test coverage: validate_dbname, validate_docid
davisp Feb 14, 2020
78d7a9f
Test coverage: apply_open_doc_opts
davisp Feb 14, 2020
293d3d5
Re-use changes feed main transaction when including docs
nickva Feb 17, 2020
e0bdb7e
Handle spurious 1009 (future_version) errors in couch_jobs pending
nickva Feb 18, 2020
bab3566
Let couch_jobs use its own metadata key
nickva Feb 18, 2020
c95d8c1
Improve validate_dbname test
jaydoane Feb 21, 2020
aa3b738
Add 410 status code to stats_descriptions
nickva Feb 21, 2020
2e13cff
Support setting base_url in Couch test helper (take 2)
iilyak Feb 21, 2020
47b6b33
Do not use the ddoc cache to load _changes filter design documents
nickva Feb 22, 2020
42062b6
Add fdb_to_revinfo compatibility with 5-tuple Val
jaydoane Feb 19, 2020
d2a670b
Fix bug in fdb_to_revinfo compatibility clauses
jaydoane Feb 20, 2020
a35af0f
Add fdb_to_revinfo version compatibility unit test
jaydoane Feb 20, 2020
f30c83c
Fix catching of Jiffy error exceptions
davisp Mar 2, 2020
bdd0578
Temporary shortcut to running the fdb test suite
davisp Mar 2, 2020
c9175af
Fix couch_views type in wait_for_job
nickva Mar 3, 2020
ee150f4
standardize couch_views_indexer_tests
garrensmith Feb 25, 2020
4bd68d1
Add Key/Value size limit for map indexes
garrensmith Jan 20, 2020
735b3f6
Enable fdb feature
jaydoane Mar 4, 2020
2fe1666
Clean up view size limit enforcement
davisp Mar 4, 2020
377a3d3
Refactor view index layout
davisp Mar 2, 2020
69fc02b
Fix handling of duplicate keys
davisp Mar 4, 2020
e6f6e2d
Don't store `{0,0,[]}` for views with new results
davisp Mar 4, 2020
97458c3
Test size calculations for view rows
davisp Mar 2, 2020
17ce741
Optimize resubmitting pending jobs
nickva Mar 8, 2020
02ca72b
Implement a simple index auto-updater
nickva Mar 8, 2020
132cf7a
Enable index auto-updating for couch_views
nickva Mar 8, 2020
6b5985f
Fix bug in reverse folding with startkey_docid
garrensmith Mar 9, 2020
1457c28
couch_jobs resubmit updates job data (#2649)
garrensmith Mar 10, 2020
258ec66
Fix _changes with a _view filter
nickva Mar 11, 2020
bf989eb
Handle spurious erlfdb future
jaydoane Mar 11, 2020
0db143a
Handle transaction timeouts in list_dbs and list_dbs_info
nickva Mar 12, 2020
0cd9c26
Refactor some of the "tx_too_old" tests
nickva Mar 13, 2020
f28a1ad
A few minor cleanups in fabric2_db_crud_tests
nickva Mar 16, 2020
3bac804
add _conflicts field to docs for views
garrensmith Mar 16, 2020
0cafb17
Handle transaction cancelled errors in list_dbs_info/3
nickva Mar 16, 2020
28ffba4
Handle transaction timeouts in _all_docs
nickva Mar 17, 2020
301db96
Reformat and simplify couch_views_indexer_test module
nickva Mar 17, 2020
41be92b
Add additional get_doc spans
chewbranca Mar 18, 2020
15509f2
Merge pull request #2681 from apache/prototype/fdb-layer-get-doc-spans
chewbranca Mar 18, 2020
e520294
Fix database re-creation
nickva Mar 21, 2020
a008c6d
Add a fabric doc fold test when db is re-created
nickva Mar 21, 2020
3fba9ff
Fix couch_jobs after recent db re-creation commit
nickva Mar 22, 2020
f81f117
add info endpoint for fdb stored views (#2706)
tonysun83 Mar 23, 2020
2c704ac
set DbPrefix with value allocated with erlfdb_hca
jiangphcn Mar 23, 2020
ed83bf9
Implement fabric2_db:get_design_docs/1
davisp Mar 23, 2020
0f27bf5
Improve fabric2_events
nickva Mar 24, 2020
e06c5f3
Handle db re-creation in view indexing
nickva Mar 23, 2020
f05b3ad
Fix db prefix checks in fabric2_fdb
nickva Mar 25, 2020
d67f507
Make sure to clear db metadata flag before each transaction
nickva Mar 25, 2020
9912d49
Implement AES KW algorithm*
rnewson Mar 25, 2020
efe53e4
Merge pull request #2722 from apache/couch-keywrap
rnewson Mar 26, 2020
bf887c5
Return a 400 error code for an invalid update sequence
nickva Mar 27, 2020
7ca2ca5
Don't advertise unimplemented features
jaydoane Mar 28, 2020
9b325b7
change _all_docs to raw collation
garrensmith Mar 30, 2020
24524a4
Switch erlfdb to the couchdb repo at tag v1.0.0
rnewson Apr 1, 2020
4707af4
Merge pull request #2743 from apache/switch-erlfdb-couch
rnewson Apr 1, 2020
85f81d8
Use `couch_rate` application for `couch_view`
iilyak Feb 13, 2020
d520d73
Merge pull request #2662 from cloudant/couch_view-rate_limit
iilyak Apr 2, 2020
c22d007
fix all_docs call to return row
garrensmith Mar 18, 2020
cc2d232
move all_doc view options to fabric2_util
garrensmith Mar 18, 2020
a8b930d
add include_docs option to fold_docs
garrensmith Mar 10, 2020
551bd91
add fabric2 after_doc_write plugin
garrensmith Mar 19, 2020
9d27c6e
Add couch_views_indexer build to creation versionstamp
garrensmith Mar 23, 2020
34ca5e4
All couch_view queries to run across transactions
garrensmith Mar 25, 2020
b856501
Add couch_views_updater interactive indexer
garrensmith Mar 25, 2020
0c12654
Add couch_views_encoding max value
garrensmith Mar 24, 2020
aa940db
remove mango native proc
garrensmith Mar 10, 2020
e28eb6b
remove partition opts from mango
garrensmith Mar 24, 2020
bd1667d
remove unneeded r/w parameter
garrensmith Mar 23, 2020
4f8e33e
Remove view_cb predicate push down
garrensmith Mar 23, 2020
dd44442
Remove quorum stats
garrensmith Mar 23, 2020
c483652
Add mango indexing
garrensmith Mar 23, 2020
377b0c2
Update Mango query to work with couch_views
garrensmith Mar 23, 2020
1bc7c54
Update mango test creds to same as elixir tests
garrensmith Mar 31, 2020
29ef7fb
update mango tests to work with Mango on FDB
garrensmith Mar 31, 2020
5652e72
remove defer and load_ddocs from mango_utils
garrensmith Mar 31, 2020
2ba98a8
Return better responses for endpoints which are not implemented
nickva Apr 6, 2020
1be2363
Fix POST _all_docs/queries endpoint
nickva Apr 6, 2020
e71a77d
Do not allow editing _security in _user database
nickva Apr 6, 2020
1d6799f
Start running chttpd eunit tests
nickva Apr 6, 2020
0d1cf61
Support soft-deletion in fabric level
jiangphcn Apr 7, 2020
ec12e1f
Support soft-deletion in chttpd level
jiangphcn Apr 7, 2020
6c1d7a9
Merge pull request #2666 from apache/db-softdeletion
jiangphcn Apr 7, 2020
d6ec993
Compress doc bodies and attachments
nickva Apr 4, 2020
a14f62d
Add mango_plugin
iilyak Apr 7, 2020
396a3b5
Merge pull request #2767 from cloudant/prototype/fdb-layer-mango-plugin
iilyak Apr 9, 2020
56137f3
Fix job removal notifications
nickva Apr 9, 2020
daf1082
Fix division by zero
davisp Apr 9, 2020
cbad08d
Make 'make check' run all the passing FDB tests on this branch
nickva Apr 9, 2020
2bb0ccd
Fix incorrect usage of couch_epi in mango plugin
iilyak Apr 10, 2020
aad871b
Merge pull request #2775 from cloudant/mango-plugin-fixup
iilyak Apr 10, 2020
d4bc3a5
Fix flaky fabric2_index test
nickva Apr 10, 2020
742c64e
Fix index updater configuration keys
davisp Mar 25, 2020
247b809
Rename variables to indicate transaction state
davisp Mar 25, 2020
3c0a017
Move process_db/1 to match the logical progression
davisp Mar 25, 2020
3e1c822
Update to use `fabric2_db:get_design_docs/1`
davisp Mar 25, 2020
7bc9148
Extend fabric2_index callbacks for index cleanup
davisp Mar 25, 2020
e0d0391
Implement couch_views:cleanup_indices/2
davisp Mar 25, 2020
4275a49
Implement _view_cleanup for FoundationDB
davisp Mar 25, 2020
7aeb54b
Optionally cleanup stale indices automatically
davisp Mar 25, 2020
2e5a556
Remove jobs on index cleanup
davisp Apr 9, 2020
30fdef7
Remove failed view jobs
davisp Apr 10, 2020
7575152
Implement couch_views_cleanup_test.erl
davisp Mar 25, 2020
4e2f18c
Merge keys from rebar.config
iilyak Apr 14, 2020
9da549e
Integrate emilio - erang linter
iilyak Feb 26, 2019
6bc6f9c
Merge pull request #2789 from cloudant/fdb-integrate-emilio
iilyak Apr 15, 2020
3636451
Enable configurable binary chunk size
jaydoane Apr 15, 2020
27cbad7
report changes stats intermittently (#2777)
tonysun83 Apr 15, 2020
0eb1a73
Refactor expiring cache FDB interface
jaydoane Apr 16, 2020
4098c12
Clean up old expiry key on update insert
jaydoane Apr 16, 2020
a527ad1
Merge pull request #2783 from cloudant/merge-rebar-config
iilyak Apr 16, 2020
f71c4c0
Allow using cached security and revs_limit properties
nickva Apr 14, 2020
0b8dfa6
Fetch doc in same transaction as _all_doc row
garrensmith Apr 17, 2020
45e0c30
Fix typo in error message
iilyak Apr 20, 2020
8554329
Merge pull request #2796 from cloudant/fix-typo
iilyak Apr 20, 2020
3895223
Add after_interactive_write plugin to couch_views_updater
garrensmith Apr 23, 2020
f522b88
Refactor fetching rev code in fabric2_fdb
garrensmith Apr 22, 2020
5efcbfc
Add fold_docs for DocId list
garrensmith Apr 6, 2020
232e1d5
Report the chttpd_auth authentication db in session info
jaydoane Apr 26, 2020
a5fded8
Add native encryption support
rnewson Apr 8, 2020
43da896
Merge pull request #2826 from apache/aegis
rnewson Apr 27, 2020
21bb444
Add a couch_views test for multiple design documents with the same map
nickva Apr 23, 2020
0a74954
Update erlfdb to v1.1.0
nickva Apr 24, 2020
b07a629
Allow specifying FDB transaction options
nickva Apr 24, 2020
e889cf0
Fix mango test suite
davisp Apr 27, 2020
19d8582
Remove etag from changes and _list_dbs
garrensmith Apr 28, 2020
c6d3a7b
Temporary disable fabric2_tx_options_tests
eiri Apr 28, 2020
cf0b032
Re-enable the tx options tests
nickva Apr 28, 2020
97227c4
Improve robustness of couch expiring cache test
jaydoane Apr 26, 2020
e48da92
Fix a flaky fdbcore index test
nickva Apr 29, 2020
45a899a
Fix list_dbs_info_tx_too_old flaky test
nickva Apr 29, 2020
bd44fc6
return correct not implemented for reduce
garrensmith May 4, 2020
7e7a3f6
add test to make sure type <<"text">> design docs are ignored (#2866)
tonysun83 May 5, 2020
577be65
Re-enable ExUnit tests
iilyak May 7, 2020
51b8cc1
Update erlfdb
iilyak May 7, 2020
25bf5cb
Merge pull request #2874 from cloudant/enable-exunit
iilyak May 7, 2020
1d0a102
Convert aegis key cach to LRU with hard expiration time
eiri May 5, 2020
b2f2a45
add local_docs to fold_doc with docids
garrensmith May 6, 2020
d66e95a
mix format all_docs_test.exs
garrensmith May 6, 2020
968def8
Fix couch_views updater_running info result
nickva May 8, 2020
91becc1
background deletion for soft-deleted database
jiangphcn Apr 23, 2020
1127908
Merge pull request #2857 from apache/background-db-deletion
jiangphcn May 13, 2020
f0040c7
Fix a few flaky tests in fabric2_db
nickva May 13, 2020
c9cbcb4
Fix compiler warning
jaydoane May 13, 2020
3846af7
Fix variable shadowing
iilyak May 8, 2020
4041741
Move not_implemented check down to allow testing of validation
iilyak May 14, 2020
af502ea
Add tests for legacy API before refactoring
iilyak May 11, 2020
b8a13a5
Implement pagination API
iilyak May 4, 2020
02e4c3e
Add tests for pagination API
iilyak May 14, 2020
d4a9723
Merge pull request #2870 from cloudant/pagination-api-2
iilyak May 15, 2020
6f2417e
Fix flaky couch_jobs type monitor test
nickva May 15, 2020
fad3828
Fix handling of limit query parameter
iilyak May 20, 2020
51694f7
Bulk docs transaction batching
nickva May 19, 2020
44935ac
Improve log of permanently deleting databases
jiangphcn May 21, 2020
6c7d203
Merge pull request #2897 from apache/improve-db-expiration-log
jiangphcn May 21, 2020
9e3f475
Merge pull request #2896 from cloudant/pagination-api-fix-limit
iilyak May 21, 2020
5bade6f
Improve load handling in couch_jobs and couch_views
nickva May 21, 2020
d068944
Remove erlfdb mock from update_docs/2,3 test
nickva May 22, 2020
19c040f
Lower the default batch size for update_docs to 2.5MB
nickva May 27, 2020
5673835
Introduce _bulk_docs max_doc_count limit
nickva May 27, 2020
10559ea
Don't skip over docs in mango indices on erlfdb errors
nickva May 28, 2020
ef4cfb4
Fix mango erlfdb error catch clause erlfdb -> erlfdb_error
nickva May 28, 2020
0152c1e
Fix bad catch statement in couch_jobs activity monitor
nickva May 29, 2020
b9aa2c6
Protect couch_jobs activity monitor against timeouts as well
nickva May 29, 2020
6501709
Guard couch_jobs:accept_loop timing out
nickva May 29, 2020
03210b0
Prevent eviction of newer handles from fabric_server cache
nickva Jun 2, 2020
9f8b4fd
Remove on_commit handler from fabric2_fdb
nickva Jun 2, 2020
b3fe090
Handle error:{timeout, _} exception in couch_jobs:accept
nickva Jun 2, 2020
b417bc1
Improve efficiency of couch_jobs:accept/2 for views
nickva Jun 2, 2020
2e938ca
Fix couch_jobs accept timeout when no_schedule option is used
nickva Jun 3, 2020
19ae508
Include database uuid in db info result
nickva Jun 4, 2020
3536ad8
Split couch_views acceptors and workers
nickva Jun 4, 2020
b17bc49
Handle transaction and future timeouts in couch_jobs notifiers
nickva Jun 10, 2020
fa16e6a
Bump erlfdb to v1.2.2
nickva Jun 12, 2020
3423d19
add back r and w options
tonysun83 Jun 12, 2020
7e008d0
Reserve aegis namespace under ?CLUSTER_CONFIG
eiri Jun 17, 2020
afbe32e
Add max_bulk_get_count configuration option
iilyak Jun 22, 2020
5c7dbc4
Merge pull request #2960 from cloudant/add-max_bulk_get_count
iilyak Jun 23, 2020
03ecce8
PoC for API versioning
iilyak Apr 27, 2020
36c95bb
Get API version earlier
iilyak Jun 25, 2020
2bab09a
Add tests
iilyak Jun 26, 2020
2d7ad7d
Handle unknown version error
iilyak Jun 26, 2020
5dc150b
Fix meck invocation
iilyak Jun 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fetch docs in parallel for view indexing
  • Loading branch information
garrensmith authored and davisp committed Mar 2, 2020
commit 4e4b1a8dc62a2a3599b9674c517f42bcef5f5b74
58 changes: 45 additions & 13 deletions src/couch_views/src/couch_views_indexer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ update(#{} = Db, Mrst0, State0) ->
last_seq := LastSeq
} = State2,

{Mrst1, MappedDocs} = map_docs(Mrst0, DocAcc),
DocAcc1 = fetch_docs(TxDb, DocAcc),
{Mrst1, MappedDocs} = map_docs(Mrst0, DocAcc1),
write_docs(TxDb, Mrst1, MappedDocs, State2),

case Count < Limit of
Expand Down Expand Up @@ -140,14 +141,12 @@ process_changes(Change, Acc) ->
#{
doc_acc := DocAcc,
count := Count,
tx_db := TxDb,
design_opts := DesignOpts
} = Acc,

#{
id := Id,
sequence := LastSeq,
deleted := Deleted
sequence := LastSeq
} = Change,

IncludeDesign = lists:keymember(<<"include_design">>, 1, DesignOpts),
Expand All @@ -159,16 +158,8 @@ process_changes(Change, Acc) ->
last_seq => LastSeq
});
_ ->
% Making a note here that we should make fetching all the docs
% a parallel fdb operation
{ok, Doc} = case Deleted of
true -> {ok, []};
false -> fabric2_db:open_doc(TxDb, Id)
end,

Change1 = maps:put(doc, Doc, Change),
Acc#{
doc_acc := DocAcc ++ [Change1],
doc_acc := DocAcc ++ [Change],
count := Count + 1,
last_seq := LastSeq
}
Expand Down Expand Up @@ -215,6 +206,47 @@ write_docs(TxDb, Mrst, Docs, State) ->
couch_views_fdb:set_update_seq(TxDb, Sig, LastSeq).


fetch_docs(Db, Changes) ->
{Deleted, NotDeleted} = lists:partition(fun(Doc) ->
#{deleted := Deleted} = Doc,
Deleted
end, Changes),

RevState = lists:foldl(fun(Change, Acc) ->
#{id := Id} = Change,
RevFuture = fabric2_fdb:get_winning_revs_future(Db, Id, 1),
Acc#{
RevFuture => {Id, Change}
}
end, #{}, NotDeleted),

RevFutures = maps:keys(RevState),
BodyState = lists:foldl(fun(RevFuture, Acc) ->
{Id, Change} = maps:get(RevFuture, RevState),
Revs = fabric2_fdb:get_winning_revs_wait(Db, RevFuture),

% I'm assuming that in this changes transaction that the winning
% doc body exists since it is listed in the changes feed as not deleted
#{winner := true} = RevInfo = lists:last(Revs),
BodyFuture = fabric2_fdb:get_doc_body_future(Db, Id, RevInfo),
Acc#{
BodyFuture => {Id, RevInfo, Change}
}
end, #{}, erlfdb:wait_for_all(RevFutures)),

BodyFutures = maps:keys(BodyState),
ChangesWithDocs = lists:map(fun (BodyFuture) ->
{Id, RevInfo, Change} = maps:get(BodyFuture, BodyState),
Doc = fabric2_fdb:get_doc_body_wait(Db, Id, RevInfo, BodyFuture),
Change#{doc => Doc}
end, erlfdb:wait_for_all(BodyFutures)),

% This combines the deleted changes with the changes that contain docs
% Important to note that this is now unsorted. Which is fine for now
% But later could be an issue if we split this across transactions
Deleted ++ ChangesWithDocs.


start_query_server(#mrst{qserver = nil} = Mrst) ->
#mrst{
language = Language,
Expand Down