Strange behavior when deleting new records
I have a really strange problem, for some reason the index isn't staying in sync with activerecord when I delete something that was freshly added. It's a bit confusing to explain, but let me lay out the context a bit.
Our environment:
Ruby 2.5.7
Rails 5.2.4.1
thinking-sphinx 4.4.1 (with delta indexing enabled and working otherwise fine)
flying-sphinx 2.2.0
ts-delayed-delta 2.1
Everything works just dandy, for updates etc, and even for deletion of older content. However, when we create new records and then delete them (we are using activerecord destroy calls) our activerecord complains about receiving stale ID's from flyingsphinx. It's strange because it only seems to happen when onboarding legitimately new content, not old content (even if we re-add and remove old content). I am wondering if perhaps it is related to delta updates not completing a merge before deletion, possibly causing a race condition of sorts.. but further testing seems to rule that out.. So I would appreciate any guesses or insights anyone can provide. Has me stumped so far..
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Pat Allan on 13 May, 2020 04:44 AM
Hi Dave,
I'm going to ponder this one a bit more, nothing comes to mind immediately… but I do wonder if it's related to merges, as that's not a piece of functionality I've ever used myself in my own apps, so I'm less familiar with the edge cases.
I don't suppose you're able to reproduce the issue locally?
Cheers,
Pat
2 Posted by David on 14 May, 2020 05:33 AM
It doesn't seem to, however I wonder the same about merges. Is there a better way to implement a delta setup without using merges? Currently, I have a scheduled job running the merge and assume it is keeping the delta index small and everything running a-ok... ish ;p
________________________________
Support Staff 3 Posted by Pat Allan on 21 May, 2020 12:55 PM
Some further thoughts about all of this…
destroy
calls when deleting objects - just to confirm, this isdestroy
on a single record, thus the ActiveRecord callback lifecycle is invoked? (Though, now I thinkdestroy
on a relation will still instantiate all of those objects and calldestroy
on each and invoke callbacks, so maybe it's fine either way)