Skip to content

Use multi-transactional iterators#2540

Merged
nickva merged 1 commit intoprototype/fdb-layerfrom
multi-transactional-iterators-3
Feb 14, 2020
Merged

Use multi-transactional iterators#2540
nickva merged 1 commit intoprototype/fdb-layerfrom
multi-transactional-iterators-3

Conversation

@nickva
Copy link
Contributor

@nickva nickva commented Feb 11, 2020

This is a 3rd approach.

Simplified even more after talking with @davisp

This one is driven by an optioned passed in to fold_range. There is also just a single fold_range callback as opposed to two as before.

Previous approach: #2532

Copy link
Member

@davisp davisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good but I had a few different questions.

@nickva nickva force-pushed the multi-transactional-iterators-3 branch 3 times, most recently from a5b2ece to 90f09b0 Compare February 14, 2020 18:54
@nickva nickva marked this pull request as ready for review February 14, 2020 18:55
@nickva nickva force-pushed the multi-transactional-iterators-3 branch 3 times, most recently from bd578c3 to 8c5471e Compare February 14, 2020 19:05
Copy link
Member

@davisp davisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple minor nits.

@nickva nickva force-pushed the multi-transactional-iterators-3 branch from 8c5471e to cf05920 Compare February 14, 2020 20:25
Previously changes feeds would fail if they streamed data for more than five
seconds. This was because of the FoundationDB's transaction time limit. After
the timeout fired, an 1007 (transaction_too_long) error was raised, and
transaction was retried. The emitted changes feed would often crash or simple
hang because the HTTP state would be garbled as response data was re-sent over
the same socket stream again.

To fix the issue introduce a new `{restart_tx, true}` option for
`fold_range/4`. This option sets up a new transaction to continue iterating
over the range from where the last one left off.

To avoid data being resent in the response stream, user callback functions must
first read all the data they plan on sending during that callback, send it out,
and then after that it must not do any more db reads so as not to trigger a
`transaction_too_old` error.
@nickva nickva force-pushed the multi-transactional-iterators-3 branch from cf05920 to a9f312f Compare February 14, 2020 20:27
Copy link
Member

@davisp davisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@nickva nickva merged commit 148af9e into prototype/fdb-layer Feb 14, 2020
@nickva nickva deleted the multi-transactional-iterators-3 branch February 14, 2020 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants