-
Notifications
You must be signed in to change notification settings - Fork 5
Table size fixes #21
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
Table size fixes #21
Conversation
(Previously, it would *always* evict at least one record even if size was <= new_size)
Closer reading of RFC9113§4.3.1para¶4 (https://www.rfc-editor.org/rfc/rfc9113.html#section-4.3.1) suggests that we should always send a dynamic resize Fixes elixir-mint#20
Pull Request Test Coverage Report for Build d892f265ddeb6a5729eda4acb9802f149f4728fd-PR-21Details
💛 - Coveralls |
test/hpax/table_test.exs
Outdated
@@ -70,7 +70,7 @@ defmodule HPAX.TableTest do | |||
end | |||
end | |||
|
|||
describe "resizing" do | |||
describe "resize/2" do |
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.
Let's not change this, the tests are about the resizing flow
test/hpax/table_test.exs
Outdated
end | ||
end | ||
|
||
describe "dynamic_resize/2" do |
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.
describe "dynamic_resize/2" do | |
describe "dynamically resizing" do |
lib/hpax/table.ex
Outdated
table = | ||
if new_protocol_max_table_size < table.size do | ||
evict_to_size(table, new_protocol_max_table_size) | ||
else | ||
table | ||
end |
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 is making my brain hurt 😄 Here, we say to evict the table only if the protocol size goes below the table size. But the added clause to evict_to_size/2
is a no-op if we try to evict to a larger size. These are opposite I think, so it might make sense, but I think some comments would be helpful?
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.
Yeah you're right, we don't need this one. I'd had these two commits originally staged in the opposite order so didn't notice that this chunk is now obsolete. Removing.
Updated |
Fixes #20.
This changes our resize code to always send a dynamic table resize command, even if the table size did not change from the commanded version. This is in line with a closer / alternate read of RFC9113§4.3.1 paragraph 4.
I also fixed the evict_towards_size internal table function to handle the case where it was being asked to evict to a size larger than the table's current actual size. Previously we were always evicting at least one entry even if it wasn't necessary.