-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Refactor getting replication updates from database. #7636
Changes from 2 commits
cc34308
8de532d
53db1be
1975a4d
85c9a94
67e7276
b6e35f2
9b492b6
d00dce6
d3ed450
dbe1760
df6c3b0
a902de2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1082,6 +1082,21 @@ async def get_all_new_backfill_event_rows( | |
) -> Tuple[List[Tuple[int, list]], int, bool]: | ||
"""Get updates for backfill replication stream, including all new | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this docstring is very helpful, but please can all the updated/new storage methods have one, not just this method? |
||
backfilled events and events that have gone from being outliers to not. | ||
|
||
Args: | ||
instance_name: The writer we want to fetch updates from. Unused | ||
here sincethere is only ever one writer. | ||
erikjohnston marked this conversation as resolved.
Show resolved
Hide resolved
|
||
last_id: The token to fetch updates from. Exclusive. | ||
current_id: The token to fetch updates up to. Inclusive. | ||
limit: The requested limit for the number of rows to return. The | ||
function may return more or fewer rows. | ||
|
||
Returns: | ||
A tuple consisting of: the updates, the position of the rows | ||
returned up to, and whether we returned fewer rows than exists | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you rephrase "the position of the rows returned up to"? it's somewhat unclear: inconsistent use of "position" and "token", inclusive or exclusive, etc. "the last token included in the results", maybe? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hopefully I've clarified it. Unfortunately, technically, the returned token doesn't have to be the last token included in the results (since |
||
between the requested tokens due to the limit. | ||
|
||
The updates are list of 2-tuples of stream ID and the row. | ||
erikjohnston marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
if last_id == current_id: | ||
return [], current_id, False | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is doing the wrong thing for the returned token when the limit is hit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am such a crank 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MAYBE THIS TIME I'VE fIXeD IT?!!!??!1?