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

Prepared queries pubsub #3074

Merged
merged 15 commits into from
Apr 8, 2021
Merged

Prepared queries pubsub #3074

merged 15 commits into from
Apr 8, 2021

Conversation

leszke
Copy link
Contributor

@leszke leszke commented Apr 7, 2021

My and @chrzaszcz collective effort of preparing SQL queries in pubsub modules.

leszke and others added 15 commits March 12, 2021 13:24
- Unchanged behaviour without item ids
- Slight changes if item ids are provided:
  - Results are fetched one by one - should be fast enough
    as there shouldn't be too many IDs and there is a way to limit this.
  - Results have the same order as item ids - this is more intuitive
    for the end user, XEP-0060 does not specify this
  - max_items with item ids is a combination not mentioned in the XEP,
    but still supported for completeness.
- Separate INSERT and SELECT to work on all DBs
- SELECT the entire row as this query is already prepared
    and is not much more costly
- Insert parents one by one
- Always delete old parents on update to prevent the corner case
    when all aprents are deleted.
Traverse nodes one by one - it might be slower,
  but complex collection structures shouldn't be used frequently.
Prepared queries for PubSub - part 2
@codecov
Copy link

codecov bot commented Apr 7, 2021

Codecov Report

Merging #3074 (ac21acf) into master (8a4e707) will decrease coverage by 0.06%.
The diff coverage is 98.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3074      +/-   ##
==========================================
- Coverage   78.76%   78.70%   -0.07%     
==========================================
  Files         378      377       -1     
  Lines       31102    31083      -19     
==========================================
- Hits        24499    24465      -34     
- Misses       6603     6618      +15     
Impacted Files Coverage Δ
src/pubsub/mod_pubsub_db_rdbms.erl 95.34% <98.84%> (+0.66%) ⬆️
src/pubsub/mod_pubsub_cache_rdbms.erl 90.90% <100.00%> (-0.76%) ⬇️
src/ejabberd.erl 45.00% <0.00%> (-10.00%) ⬇️
...c/global_distrib/mod_global_distrib_server_mgr.erl 75.14% <0.00%> (-2.26%) ⬇️
src/rdbms/mongoose_rdbms.erl 62.04% <0.00%> (-2.05%) ⬇️
src/mod_bosh_socket.erl 77.63% <0.00%> (-1.56%) ⬇️
src/wpool/mongoose_wpool.erl 81.00% <0.00%> (-1.00%) ⬇️
src/ejabberd_sm.erl 75.91% <0.00%> (-0.61%) ⬇️
src/ejabberd_c2s.erl 89.03% <0.00%> (-0.38%) ⬇️
src/mod_muc_room.erl 77.38% <0.00%> (-0.18%) ⬇️
... and 4 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 8a4e707...ac21acf. Read the comment docs.

Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

Both pull requests to this branch were already approved.

@chrzaszcz chrzaszcz merged commit bf18df3 into master Apr 8, 2021
@chrzaszcz chrzaszcz deleted the prepared-queries-pubsub branch April 8, 2021 06:22
@leszke leszke added this to the 4.2.0 milestone Apr 16, 2021
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.

2 participants