8000 Support writes outside of head partition by dpgil · Pull Request #23 · nakabonne/tstorage · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support writes outside of head partition #23

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

Merged
merged 6 commits into from
Jul 13, 2021
Merged

Support writes outside of head partition #23

merged 6 commits into from
Jul 13, 2021

Conversation

dpgil
Copy link
Contributor
@dpgil dpgil commented Jul 11, 2021

currently we only write to the head partition, this change supports writing to any of the writable partitions (currently set to 2).

ref #20

@codecov-commenter
Copy link
codecov-commenter commented Jul 11, 2021

Codecov Report

Merging #23 (85c79ba) into main (15edba6) will increase coverage by 3.21%.
The diff coverage is 65.68%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
+ Coverage   63.14%   66.34%   +3.21%     
==========================================
  Files          17       19       +2     
  Lines         594      909     +315     
==========================================
+ Hits          375      603     +228     
- Misses        169      215      +46     
- Partials       50       91      +41     
Impacted Files Coverage Δ
partition_list.go 82.83% <0.00%> (-12.52%) ⬇️
wal.go 100.00% <ø> (ø)
fake_encoder.go 50.00% <50.00%> (ø)
storage.go 56.29% <57.15%> (+1.29%) ⬆️
disk_partition.go 56.37% <61.91%> (+28.37%) ⬆️
memory_partition.go 77.87% <63.64%> (-1.95%) ⬇️
encoding.go 64.87% <64.87%> (ø)
file_wal.go 75.00% <71.43%> (-25.00%) ⬇️
bstream.go 84.42% <84.42%> (ø)
fake_partition.go 28.58% <100.00%> (+11.91%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6fdddc...85c79ba. Read the comment docs.

@dpgil
Copy link
Contributor Author
dpgil commented Jul 11, 2021

hi @nakabonne , let me know what you think :)

@nakabonne
Copy link
Owner

Thank you @dpgil! I will get back as soon as possible 👍

Copy link
Owner
@nakabonne nakabonne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great approach and example tests! Mostly LGTM except for a couple of nitpicks comments!

Comment on lines 591 to 595
defer func() {
if err := storage.Close(); err != nil {
panic(err)
}
}()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unneeded because the first one will get closed at L623

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

Comment on lines 673 to 677
defer func() {
if err := storage.Close(); err != nil {
panic(err)
}
}()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unneeded as well

storage.go Outdated
Comment on lines 253 to 258
if len(rowsToInsert) == 0 {
return nil
}
if !iterator.next() {
return nil
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Currently it's fine, but break makes more sense than the early return. To avoid future confusion, let's use it.

Suggested change
if len(rowsToInsert) == 0 {
return nil
}
if !iterator.next() {
return nil
}
if len(rowsToInsert) == 0 {
break
}
if !iterator.next() {
break
}

@dpgil
Copy link
Contributor Author
dpgil commented Jul 13, 2021

@nakabonne thank you for the feedback! i made the requested changes

Copy link
Owner
@nakabonne nakabonne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good approach.

@nakabonne nakabonne merged commit 832a382 into nakabonne:main Jul 13, 2021
@nakabonne
Copy link
Owner

Thank you!

@nakabonne
Copy link
Owner

v0.2.1 with this change got released. Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0