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

Fix database purging of stale activewatchers #2519

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Jul 26, 2021

  1. db: Add IS NULL and IS NOT NULL unary operators

    If you try to (mysql) prepare a statement with "... column IS ?" you'd
    get an error.
    
    For mysql, you could fix this by using the "... column <=> ?" special
    operator ('IS NOT DISTINCT FROM'), but that's not standard SQL.
    
    Instead, you can now do:
    
        update_cols[0] = &some_column;
        update_ops[0] = OP_IS_NULL;
        update_vals[0].nul = 1;
    
    You still need to set .nul=1 because prepared statements have to consume
    a single value.
    wdoekes committed Jul 26, 2021
    Configuration menu
    Copy the full SHA
    430d4c8 View commit details
    Browse the repository at this point in the history
  2. presence: Fix leaking of activewatchers in database (with clustering)

    If you're using clustering, without tags (or with tags, but without
    fallback2db), you would end up with a lot of active watchers in the
    database that never got cleaned up.
    
    Before 929ab4d:
    
    - all stale activewatcher records in the db got purged.
    
    After:
    
    - if you're not clustering, all stale active watcher got purged;
    
    - if you are, only those with the sharing_tag set.
    
    However, the sharing tag is not necessarily set:
    
    - it is an optional argument to handle_subscribe;
    
    - and setting it in handle_subscribe does not write to the database
      because of missing code in the fallback2db==0 bit;
    
    - and even it it were set, then adding the argument to handle_subscribe
      does not "activate" the sharing tag.
    
    (Also interesting to know: a 408 or 481 after the
    this-subscription-is-expired NOTIFY _would_ cause the individual record
    to get deleted. But any other response, including 200, would leave the
    record to get sorted by the periodic purge.)
    
    This changeset reverts parts of the aforementioned commit by always
    purging stale records if the sharing_tag is NULL. Thus restoring
    behaviour to pre-3.1.0 and pre-2.4.8.
    wdoekes committed Jul 26, 2021
    Configuration menu
    Copy the full SHA
    a6a22c9 View commit details
    Browse the repository at this point in the history