Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
2ea7f0ec
Unverified
Commit
2ea7f0ec
authored
Mar 26, 2020
by
Salvatore Sanfilippo
Committed by
GitHub
Mar 26, 2020
Browse files
Merge pull request #6644 from oranagra/stream_aofrw
AOFRW on an empty stream created with MKSTREAM loads badkly
parents
c4d7f30e
3b29556a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/aof.c
View file @
2ea7f0ec
...
...
@@ -1212,12 +1212,13 @@ int rewriteStreamObject(rio *r, robj *key, robj *o) {
/* Use the XADD MAXLEN 0 trick to generate an empty stream if
* the key we are serializing is an empty string, which is possible
* for the Stream type. */
id
.
ms
=
0
;
id
.
seq
=
1
;
if
(
rioWriteBulkCount
(
r
,
'*'
,
7
)
==
0
)
return
0
;
if
(
rioWriteBulkString
(
r
,
"XADD"
,
4
)
==
0
)
return
0
;
if
(
rioWriteBulkObject
(
r
,
key
)
==
0
)
return
0
;
if
(
rioWriteBulkString
(
r
,
"MAXLEN"
,
6
)
==
0
)
return
0
;
if
(
rioWriteBulkString
(
r
,
"0"
,
1
)
==
0
)
return
0
;
if
(
rioWriteBulkStreamID
(
r
,
&
s
->
last_
id
)
==
0
)
return
0
;
if
(
rioWriteBulkStreamID
(
r
,
&
id
)
==
0
)
return
0
;
if
(
rioWriteBulkString
(
r
,
"x"
,
1
)
==
0
)
return
0
;
if
(
rioWriteBulkString
(
r
,
"y"
,
1
)
==
0
)
return
0
;
}
...
...
tests/unit/type/stream-cgroups.tcl
View file @
2ea7f0ec
...
...
@@ -311,4 +311,17 @@ start_server {
}
}
}
start_server
{
tags
{
"stream"
}
overrides
{
appendonly yes aof-use-rdb-preamble no
}}
{
test
{
Empty stream with no lastid can be rewrite into AOF correctly
}
{
r XGROUP CREATE mystream group-name $ MKSTREAM
assert
{[
dict get
[
r xinfo stream mystream
]
length
]
== 0
}
set grpinfo
[
r xinfo groups mystream
]
r bgrewriteaof
waitForBgrewriteaof r
r debug loadaof
assert
{[
dict get
[
r xinfo stream mystream
]
length
]
== 0
}
assert
{[
r xinfo groups mystream
]
== $grpinfo
}
}
}
}
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