iilyak commented on code in PR #5603:
URL: https://github.com/apache/couchdb/pull/5603#discussion_r2222551779
##########
src/couch/src/couch_bt_engine_header.erl:
##########
@@ -330,6 +337,19 @@ upgrade_compacted_seq(#db_header{} = Header) ->
Header
end.
+upgrade_time_seq(#db_header{} = Header) ->
+ MaybeTSeq = Header#db_header.time_seq,
+ case couch_time_seq:check(MaybeTSeq) of
+ true ->
+ TSeq = couch_time_seq:new(MaybeTSeq),
Review Comment:
The `couch_time_seq:check(MaybeTSeq)` is implemented as
```erlang
-define(VER, 1).
check(#{v := ?VER, bins := Bins}) when is_list(Bins) ->
true;
check(_) ->
false.
```
The `couch_time_seq:new(MaybeTSeq),` is [supposed to be
responsible](https://github.com/apache/couchdb/blob/d14cc52858cd475ab1ed0b8ff26f37c052fe8e49/src/couch/src/couch_time_seq.erl#L107)
for `couch_time_seq` version upgrade.
However when we would bump `VER` to the next version the `check/1` would
start returning false and we wouldn't call `new/1`.
Please add comment to `check/1`, to remind us that it MUST handle all
previous versions of the structure for upgrade logic to work.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]