-
Notifications
You must be signed in to change notification settings - Fork 467
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
feat: support limit WriteBatch size #2508
Conversation
@AntiTopQuark Thanks for your efforts. Would you mind adding a Go test case for this? |
Sure, I will complete this task later. |
ba0b85d
to
d19064e
Compare
While adding cases, it was found that there were no corresponding error messages, so error codes were added and reported in many places involving batch processing |
d19064e
to
e4bee64
Compare
Yes, that makes sense. |
e4bee64
to
31722b4
Compare
31722b4
to
87d5603
Compare
7a10cd6
to
9f87948
Compare
@AntiTopQuark One comment inline, rest are good to me. Could anyone also have a look at this PR? @PragmaTwice @torwig @caipengbo @mapleFU |
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.
LGTM
4f19490
to
461379a
Compare
src/search/hnsw_indexer.cc
Outdated
auto s = PutMetadata(&node_metadata, search_key, ctx.storage, batch); | ||
if (!s.IsOK()) { | ||
return s; | ||
} | ||
return Status::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.
auto s = PutMetadata(&node_metadata, search_key, ctx.storage, batch); | |
if (!s.IsOK()) { | |
return s; | |
} | |
return Status::OK(); | |
return PutMetadata(&node_metadata, search_key, ctx.storage, batch); |
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.
done
src/search/hnsw_indexer.cc
Outdated
@@ -93,7 +103,10 @@ Status HnswNode::RemoveNeighbour(engine::Context& ctx, const NodeKey& neighbour_ | |||
|
|||
HnswNodeFieldMetadata node_metadata = GET_OR_RET(DecodeMetadata(ctx, search_key)); | |||
node_metadata.num_neighbours--; | |||
PutMetadata(&node_metadata, search_key, ctx.storage, batch); | |||
auto redis_status = PutMetadata(&node_metadata, search_key, ctx.storage, batch); |
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.
RETURN_NOT_OK or just return this?
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.
done
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.
This pr LGTM. But it can be shorter with macros
…nto limit_write_batch
216567b
Quality Gate passedIssues Measures |
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.
Also cc @PragmaTwice
Do we need some macro like RETURN_NOT_OK
, RETURN_NOT_OK_FROM_ROCKSDB
?
@mapleFU @AntiTopQuark |
I think it's good. Another problem is that we may need type cast between |
Yes, let's discuss this in new issue. |
Nope. They can be done by GET_OR_RET. |
So Besides, what about err from rocksdb? |
relate to #2284
Added the ability to limit the size of WriteBatch operations in RocksDB to control memory usage effectively.