-
Notifications
You must be signed in to change notification settings - Fork 43
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
add WriteBatch #26
add WriteBatch #26
Conversation
Hey @akiozihao. rose already came up with some ideas around this feature in #23 . dont u prefer taking this path? it is also similar to tidwal's WAl, except for creating a seperate struct for each batch. |
@amityahav Thank you for your reminder; I have noticed this issue and this problem. I am currently attempting to split |
wal.go
Outdated
wal.mu.Lock() | ||
defer wal.mu.Unlock() | ||
|
||
if wal.pendingSize+wal.calSizeUpperBound(int64(len(data))) > wal.options.SegmentSize { |
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.
wal.calSizeUpperBound can be put in a variable and reused in 311 and 314
segment.go
Outdated
} | ||
|
||
// WriteAll write batch data to the segment file. | ||
func (seg *segment) WriteAll(data [][]byte) ([]*ChunkPosition, error) { |
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.
can u maybe privatize all segment functions that are invoked from within wal's methods? such as WriteAll, Write, Read.. as they arent supposed to be used independently. #22
segment.go
Outdated
// You can call Next to get the next chunk data, | ||
// and io.EOF will be returned when there is no data. | ||
func (seg *segment) NewReader() *segmentReader { |
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.
Please split this into a single PR
For better review.
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
This approach may have lower efficiency for short values and can potentially disrupt the segment when failures occur, requiring more testing.