Skip to content

Commit

Permalink
Simplify and fix hyper
Browse files Browse the repository at this point in the history
Hyper is powering our `_approx_count_distinct` reducer. The dependency isn't
updated much and there is an under-counting bug discussed in issue #5084.

There is a more active fork [1], but moving to it is not practical as the
context records are changed. Unfortunately for us, those are part of the
on-disk indexing data structures. If we change them we risk breaking users'
views.

Additionally, we're not using most of the hyper library functionality: we only
use one backend, one precision value (11), and only a few API functions.

In light of that it makes sense to simplify the library and remove all the
un-used stuff. Also, add 100% test coverage, and fix the bug found by the
LivewareProblems/hyper fork.

In order to ensure we don't inadvertently modify the on-disk records those are
marked with a comment, and there is unit test that would break if we change
them. The existing record structure is kept as-is for that exact reason
including the silly mention of the `{hyper_binary, ...}` atom in the registers
field, just to ensure there are no compatibility issues for our users' views.

Fix #5084

[1] LivewareProblems/hyper
  • Loading branch information
nickva committed Jul 11, 2024
1 parent e7ed1dc commit c93940a
Show file tree
Hide file tree
Showing 10 changed files with 975 additions and 14 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ src/fauxton/
src/folsom/
src/hackney/
src/hqueue/
src/hyper/
src/ibrowse/
src/idna/
src/jiffy/
Expand Down
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2362,3 +2362,27 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

couch_hyper

The MIT License (MIT)

Copyright (c) 2014 Game Analytics ApS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ DESTDIR=

# Rebar options
apps=
skip_deps=meck,mochiweb,triq,proper,snappy,hyper,ibrowse
skip_deps=meck,mochiweb,triq,proper,snappy,ibrowse
suites=
tests=

Expand Down
2 changes: 1 addition & 1 deletion Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ DESTDIR=

# Rebar options
apps=
skip_deps=meck,mochiweb,triq,proper,snappy,hyper,ibrowse,local
skip_deps=meck,mochiweb,triq,proper,snappy,ibrowse,local
suites=
tests=

Expand Down
1 change: 0 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ defmodule CouchDBTest.Mixfile do
"proper",
"mochiweb",
"meck",
"hyper",
"fauxton"
]

Expand Down
2 changes: 0 additions & 2 deletions rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ DepDescs = [
%% %% Non-Erlang deps
{fauxton, {url, "https://github.com/apache/couchdb-fauxton"},
{tag, "v1.3.1"}, [raw]},
%% Third party deps
{hyper, "hyper", {tag, "CouchDB-2.2.0-7"}},
{ibrowse, "ibrowse", {tag, "CouchDB-4.4.2-6"}},
{jiffy, "jiffy", {tag, "1.1.2"}},
{mochiweb, "mochiweb", {tag, "v3.2.2"}},
Expand Down
2 changes: 0 additions & 2 deletions rel/reltool.config
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
ets_lru,
fabric,
global_changes,
hyper,
ibrowse,
ioq,
jiffy,
Expand Down Expand Up @@ -112,7 +111,6 @@
{app, ets_lru, [{incl_cond, include}]},
{app, fabric, [{incl_cond, include}]},
{app, global_changes, [{incl_cond, include}]},
{app, hyper, [{incl_cond, include}]},
{app, ibrowse, [{incl_cond, include}]},
{app, ioq, [{incl_cond, include}]},
{app, jiffy, [{incl_cond, include}]},
Expand Down
1 change: 0 additions & 1 deletion src/couch/src/couch.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
couch_event,
ioq,
couch_stats,
hyper,
couch_dist,
couch_quickjs
]},
Expand Down
Loading

0 comments on commit c93940a

Please sign in to comment.