-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: fix bugs in stream_family #4237
Conversation
romange
commented
Dec 2, 2024
- Use transaction time in streams code, similarly to how we do it in other commands. Stop using mstime() and delete unused redis code.
- Check for sequence overflow issue when passing huge sequence ids. Add a test.
@@ -40,4 +47,25 @@ RandomPick UniquePicksGenerator::Generate() { | |||
return max_index; | |||
} | |||
|
|||
streamConsumer* StreamCreateConsumer(streamCG* cg, string_view name, uint64_t now_ms, int flags) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved here from t_stream because we pass now_ms (the only differrence) instead of calling directly mstime()
.
In later versions of Redis/Valkey they also switched to "command time" by callng a global getter. Dragonfly uses transactional time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's another difference, which is that we now accept name
as a string_view
(which is better! but another difference :)
This also explains why below we don't need to free()
1. Use transaction time in streams code, similarly to how we do it in other commands. Stop using mstime() and delete unused redis code. 2. Check for sequence overflow issue when passing huge sequence ids. Add a test. Signed-off-by: Roman Gershman <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I would imagine that making such a change will require way more patching :)
@@ -40,4 +47,25 @@ RandomPick UniquePicksGenerator::Generate() { | |||
return max_index; | |||
} | |||
|
|||
streamConsumer* StreamCreateConsumer(streamCG* cg, string_view name, uint64_t now_ms, int flags) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's another difference, which is that we now accept name
as a string_view
(which is better! but another difference :)
This also explains why below we don't need to free()
@@ -563,15 +560,16 @@ int StreamAppendItem(stream* s, CmdArgList fields, streamID* added_id, streamID* | |||
s->first_id = id; | |||
if (added_id) | |||
*added_id = id; | |||
return C_OK; | |||
|
|||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not return C_OK
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C_OK/C_ERR
are redis constants, EDOM/ERANGE are posix constants, so i wanted to reduce this spaghetti