Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
4724548e
Commit
4724548e
authored
Jul 22, 2018
by
zhaozhao.zz
Committed by
antirez
Jul 24, 2018
Browse files
Streams: skip master fileds only when we are going forward in streamIteratorGetID
parent
4b79fdf1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_stream.c
View file @
4724548e
...
...
@@ -548,13 +548,16 @@ int streamIteratorGetID(streamIterator *si, streamID *id, int64_t *numfields) {
si
->
master_fields_count
=
lpGetInteger
(
si
->
lp_ele
);
si
->
lp_ele
=
lpNext
(
si
->
lp
,
si
->
lp_ele
);
/* Seek first field. */
si
->
master_fields_start
=
si
->
lp_ele
;
/* Skip master fileds to seek the first entry. */
for
(
uint64_t
i
=
0
;
i
<
si
->
master_fields_count
;
i
++
)
si
->
lp_ele
=
lpNext
(
si
->
lp
,
si
->
lp_ele
);
/* We are now pointing the zero term of the master entry. If
/* We are now pointing the start filed of the master entry. If
* we are iterating in reverse order, we need to seek the
* end of the listpack. */
if
(
si
->
rev
)
si
->
lp_ele
=
lpLast
(
si
->
lp
);
if
(
si
->
rev
)
{
si
->
lp_ele
=
lpLast
(
si
->
lp
);
}
else
{
/* Skip master fileds to seek the first entry. */
for
(
uint64_t
i
=
0
;
i
<
si
->
master_fields_count
;
i
++
)
si
->
lp_ele
=
lpNext
(
si
->
lp
,
si
->
lp_ele
);
}
}
else
if
(
si
->
rev
)
{
/* If we are itereating in the reverse order, and this is not
* the first entry emitted for this listpack, then we already
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment