rnewson commented on PR #5865:
URL: https://github.com/apache/couchdb/pull/5865#issuecomment-3805304592
It seems to me that we unpack the provided bookmark too early, in the
`create` function. It is then unpacked when `explain` returns. The patch below
moves the `unpack` logic to the `execute` function.
```
diff --git i/src/mango/src/mango_cursor_text.erl
w/src/mango/src/mango_cursor_text.erl
index 0fc92092d..a1cc018cc 100644
--- i/src/mango/src/mango_cursor_text.erl
+++ w/src/mango/src/mango_cursor_text.erl
@@ -38,7 +38,7 @@
documents_seen
}).
-create(Db, {Indexes, Trace}, Selector, Opts0) ->
+create(Db, {Indexes, Trace}, Selector, Opts) ->
Index =
case Indexes of
[Index0] ->
@@ -48,7 +48,6 @@ create(Db, {Indexes, Trace}, Selector, Opts0) ->
end,
DbName = couch_db:name(Db),
- Opts = unpack_bookmark(DbName, Opts0),
Stats = mango_execution_stats:stats_init(DbName),
DreyfusLimit = get_dreyfus_limit(),
@@ -77,7 +76,8 @@ explain(Cursor) ->
[
{query, mango_selector_text:convert(Selector)},
{partition, get_partition(Opts, null)},
- {sort, sort_query(Opts, Selector)}
+ {sort, sort_query(Opts, Selector)},
+ {bookmark, dreyfus_bookmark:pack(get_bookmark(Opts))}
].
execute(Cursor, UserFun, UserAcc) ->
@@ -87,9 +87,12 @@ execute(Cursor, UserFun, UserAcc) ->
limit = Limit,
skip = Skip,
selector = Selector,
- opts = Opts,
+ opts = Opts0,
execution_stats = Stats
} = Cursor,
+
+ DbName = couch_db:name(Db),
+ Opts = unpack_bookmark(DbName, Opts0),
Query = mango_selector_text:convert(Selector),
QueryArgs = #index_query_args{
q = Query,
```
--
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]