You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "rnewson (via GitHub)" <gi...@apache.org> on 2023/06/16 08:08:13 UTC

[GitHub] [couchdb] rnewson commented on a diff in pull request #4643: Improve emitted change feed sequence after a split

rnewson commented on code in PR #4643:
URL: https://github.com/apache/couchdb/pull/4643#discussion_r1231928309


##########
src/fabric/src/fabric_view_changes.erl:
##########
@@ -425,6 +425,15 @@ pack_seqs(Workers) ->
     Opaque = couch_util:encodeBase64Url(?term_to_bin(SeqList, [compressed])),
     ?l2b([integer_to_list(SeqSum), $-, Opaque]).
 
+% When we get sequence before the split, we'll fill in the missing (now split)
+% ranges with a special {split, OldNodeUUid} marker. However, when sequences
+% are emitted in the changes API, that will make the N- prefix (SeqSum) bounce
+% around from higher to lower numbers, while users expect those to be mostly
+% incrementing. So take a conservative approach and assume it will be full
+% rewind for that ramge, and use 0 for that range. This is a purely cosmetic
+% thing, when we decode the sequence that prefix gets thrown away anyway.
+%
+seq({Seq, {split, <<_/binary>>}, _Node}) when is_integer(Seq) -> 0;

Review Comment:
   it's slightly more than cosmetic, the replicator (or at least older versions) depending on an increasing term in order to checkpoint regularly. If that's no longer the case we should consider dropping this otherwise useless number.
   
   I think the change here is fine and the comment will help us in future, however I would like us to rename the `seq/1` method to more clearly express that its for the fake packed_seq prefix. as currently named it implies it extracts the sequence from various tuple formats (which of course it _did_ before this change). Either we rename it to something like `fake_packed_seq/1` or leave it as is and do the conversion to 0 for split tuples in another function with an explanatory name.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org