1
0
Fork 0
mirror of https://github.com/element-hq/synapse.git synced 2025-03-05 15:37:02 +00:00
This commit is contained in:
erikjohnston 2023-10-23 15:58:36 +00:00
parent be9ebbe934
commit 42c609e950
4 changed files with 20 additions and 8 deletions

View file

@ -186,16 +186,22 @@ will be inserted with that ID.</p>
<h3 id="current-stream-id"><a class="header" href="#current-stream-id">Current stream ID</a></h3>
<p>For any given stream reader (including writers themselves), we may define a per-writer current stream ID:</p>
<blockquote>
<p>The current stream ID <em>for a writer W</em> is the largest stream ID such that
<p>A current stream ID <em>for a writer W</em> is the largest stream ID such that
all transactions added by W with equal or smaller ID have completed.</p>
</blockquote>
<p>Similarly, there is a &quot;linear&quot; notion of current stream ID:</p>
<blockquote>
<p>The &quot;linear&quot; current stream ID is the largest stream ID such that
<p>A &quot;linear&quot; current stream ID is the largest stream ID such that
all facts (added by any writer) with equal or smaller ID have completed.</p>
</blockquote>
<p>Because different stream readers A and B learn about new facts at different times, A and B may disagree about current stream IDs.
Put differently: we should think of stream readers as being independent of each other, proceeding through a stream of facts at different rates.</p>
<p>The above definition does not give a unique current stream ID, in fact there can
be a range of current stream IDs. Synapse uses both the minimum and maximum IDs
for different purposes. Most often the maximum is used, as its generally
beneficial for workers to advance their IDs as soon as possible. However, the
minimum is used in situations where e.g. another worker is going to wait until
the stream advances past a position.</p>
<p><strong>NB.</strong> For both senses of &quot;current&quot;, that if a writer opens a transaction that never completes, the current stream ID will never advance beyond that writer's last written stream ID.</p>
<p>For single-writer streams, the per-writer current ID and the linear current ID are the same.
Both senses of current ID are monotonic, but they may &quot;skip&quot; or jump over IDs because facts complete out of order.</p>

View file

@ -18349,16 +18349,22 @@ will be inserted with that ID.</p>
<h3 id="current-stream-id"><a class="header" href="#current-stream-id">Current stream ID</a></h3>
<p>For any given stream reader (including writers themselves), we may define a per-writer current stream ID:</p>
<blockquote>
<p>The current stream ID <em>for a writer W</em> is the largest stream ID such that
<p>A current stream ID <em>for a writer W</em> is the largest stream ID such that
all transactions added by W with equal or smaller ID have completed.</p>
</blockquote>
<p>Similarly, there is a &quot;linear&quot; notion of current stream ID:</p>
<blockquote>
<p>The &quot;linear&quot; current stream ID is the largest stream ID such that
<p>A &quot;linear&quot; current stream ID is the largest stream ID such that
all facts (added by any writer) with equal or smaller ID have completed.</p>
</blockquote>
<p>Because different stream readers A and B learn about new facts at different times, A and B may disagree about current stream IDs.
Put differently: we should think of stream readers as being independent of each other, proceeding through a stream of facts at different rates.</p>
<p>The above definition does not give a unique current stream ID, in fact there can
be a range of current stream IDs. Synapse uses both the minimum and maximum IDs
for different purposes. Most often the maximum is used, as its generally
beneficial for workers to advance their IDs as soon as possible. However, the
minimum is used in situations where e.g. another worker is going to wait until
the stream advances past a position.</p>
<p><strong>NB.</strong> For both senses of &quot;current&quot;, that if a writer opens a transaction that never completes, the current stream ID will never advance beyond that writer's last written stream ID.</p>
<p>For single-writer streams, the per-writer current ID and the linear current ID are the same.
Both senses of current ID are monotonic, but they may &quot;skip&quot; or jump over IDs because facts complete out of order.</p>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long