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

dev/core#1862 Skip cache tables during merge, rely on cache management processes #17803

Merged
merged 1 commit into from
Jul 13, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jul 13, 2020

Overview

Fixes a dedupe regression on cache tables by not merging cache tables & relying on 'normal cache management'

Before

Potential for reproducible fatal error when merging contacts that are both in the same smart group.

  • replicated in attached test

After

Problematic queries are not run -- this also reduces the total number of potentially locking queries

Technical Details

We later call Contact.create on both contacts so that should manage the caches for this update 'as well as for any other update'
and solve the bug + reduce locking queries

Comments

Thanks to @JKingsnorth for reporting this

@civibot
Copy link

civibot bot commented Jul 13, 2020

(Standard links)

@civibot civibot bot added the 5.28 label Jul 13, 2020
@eileenmcnaughton eileenmcnaughton changed the title dev/core#1862 Skip cache tables during merge, rely on cache managemen… dev/core#1862 Skip cache tables during merge, rely on cache management processes Jul 13, 2020
@seamuslee001
Copy link
Contributor

This looks good to me merge on pass

…t processes

We later call Contact.create on both contacts so that should manage the caches for this update 'as well as for any other update'
and solve the bug + reduce locking queries
@seamuslee001
Copy link
Contributor

Jenkins re test this please

@JKingsnorth
Copy link
Contributor

@eileenmcnaughton Thanks very much for posting this.

I'll run through a full test of this now.

@JKingsnorth
Copy link
Contributor

JKingsnorth commented Jul 13, 2020

@eileenmcnaughton I've found a related issue which I've documented on the GitLab issue: https://lab.civicrm.org/dev/core/-/issues/1862

@seamuslee001 seamuslee001 merged commit d7895b3 into civicrm:5.28 Jul 13, 2020
@seamuslee001 seamuslee001 deleted the dedupe branch July 13, 2020 09:55
@JKingsnorth
Copy link
Contributor

@eileenmcnaughton I agree with the principle of this. Although the smart group lists will no longer be 'immediately' updated, this isn't a problem. Letting the cache-rebuild fix these up, the next time the caches are re-built, makes sense.

@eileenmcnaughton
Copy link
Contributor Author

@JKingsnorth I think it might happen sooner since there is still stuff in contact.create for it

@JKingsnorth
Copy link
Contributor

@eileenmcnaughton in my test, it did not. But we are using deterministic cache flush, I didn't check with opportunistic.

@eileenmcnaughton
Copy link
Contributor Author

@JKingsnorth right - so you have opted out of aggressive cache flushing - that makes sense

@JKingsnorth
Copy link
Contributor

@eileenmcnaughton For completeness, I'll test with 'opportunistic' mode tomorrow.

@eileenmcnaughton
Copy link
Contributor Author

Thanks @JKingsnorth

@JKingsnorth
Copy link
Contributor

(TLDR - it's all good.)

If you merge contacts, smart group associations are not carried across like they used to be, which is expected.

If you are using Civi's defaults of 'opportunistic' cache flushing, and smart group timeout of '5' then the merged contact is not in any new smart groups it would be eligible for (expected). Likewise if you are using 'deterministic' cache flushing.

If you use 'opportunistic' cache flushing, and set your smart group timeout set to '0' (which would be madness) then the merged contact is added to any smart groups they 'become' eligible for. This means that the merge process does an opportunistic flush of the cache, which is what you thought.

@eileenmcnaughton
Copy link
Contributor Author

@JKingsnorth funnily enough we actually do set smart group timeout to 0 - to be honest I'm not sure if it's better or worse but I tried it out after some deadlocks & we never turned it back on. I know @andrew-cormick-dockery at one point disabled it for AUG & I think was positive about the impact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants