Skip to content
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

ets:insert/2 insert order preserved when list with same keys for bag table #6752

Merged
merged 2 commits into from
Feb 6, 2023

Conversation

madlep
Copy link
Contributor

@madlep madlep commented Jan 28, 2023

Since OTP 23, when inserting a list of values into an ets bag table, values for the same key are inserted in reversed order (prior to OTP 22, they were inserted in the order in the list).

Implementing fix suggested by @sverker to build linked list of DbTerm values stored against a key by appending (rather than prepending as it had been doing).

Fix for #6730 (see description there for code to reproduce + original correct behaviour on OTP 22, and regression behaviour on OTP >= 23)

@CLAassistant
Copy link

CLAassistant commented Jan 28, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2023

CT Test Results

       4 files     199 suites   1h 14m 40s ⏱️
3 080 tests 2 980 ✔️   95 💤 5
3 688 runs  3 567 ✔️ 116 💤 5

For more details on these failures, see this check.

Results for commit 5c4f367.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@rickard-green rickard-green added the team:VM Assigned to OTP team VM label Jan 30, 2023
@sverker sverker added fix testing currently being tested, tag is used by OTP internal CI labels Jan 31, 2023
@sverker
Copy link
Contributor

sverker commented Feb 2, 2023

I pushed a commit with some documentation improvements.
@madlep @gomoripeti What do you think?

@KennethL KennethL added this to the OTP-26.0-rc1 milestone Feb 2, 2023
@madlep
Copy link
Contributor Author

madlep commented Feb 2, 2023

I pushed a commit with some documentation improvements. @madlep @gomoripeti What do you think?

@sverker makes sense to me 👍

madlep and others added 2 commits February 6, 2023 18:12
After discussion in erlang#6730

Changed `db_term_list_prepend*` to `db_term_list_append*` so values to
be stored against a key have their order preserved. Previously due to
building the linked list via prepending, the values insert order was
reversed from OTP 23 onward.
Describe and warn about lots of objects with same keys
in bag and duplicate_bag.
@sverker sverker merged commit c730e8d into erlang:maint Feb 6, 2023
@sverker
Copy link
Contributor

sverker commented Feb 6, 2023

Expanded the test case to include provoking bug for duplicate_bag.
Squashed into two commits and merged.

@madlep Thanks for good report and fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants