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 delayed deltas after Thinking Sphinx upgrade #4389

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

romanzes
Copy link

The problem that is being fixed here is described in detail on the community forum: https://www.sharetribe.com/community/t/search-not-working-in-sharetribe-go-version-11-delayed-deltas/3720

The problem started happening after thinking-sphinx gem was upgraded from 3.3.0 to 5.5.0 in this commit. Apparently, there was a breaking API change in 5.0.0 release of Thinking Sphinx described in its release notes. Basically, callbacks aren’t added automatically for all ActiveRecord models anymore, you need to add them explicitly. I searched GitHub for examples of other projects that upgraded Thinking Sphinx to 5.0.0 or higher, hoping to see what changes they had to implement. I found a couple examples of such upgrades: 1, 2. I applied the same changes to my copy of Sharetribe and that fixed the issue.

@thomasmalbaux
Copy link
Contributor

Thanks for the proposed fix, @romanzes!

We may look at this in the future, but I don't have any timeline to share. In the meantime, I've opened an issue at #4391 to clearly identify this situation.

@romanzes
Copy link
Author

No worries, I'll just use my fork in the meantime, and maybe the fix in this PR will be useful to others who run into the issue. Thanks for opening the issue.

@kAgotsi
Copy link

kAgotsi commented Apr 23, 2024

Hello @romanzes , Could you help me ? I 'am searching who to install sphinx package on Mac.

I used brew install sphinx but not working . May be you have solution because you request is recent.

@romanzes
Copy link
Author

Hey @kAgotsi, maybe try downloading the binary from here: https://sphinxsearch.com/downloads/current/

@ali-hassan
Copy link

ali-hassan commented Apr 24, 2024 via email

@kAgotsi
Copy link

kAgotsi commented Apr 24, 2024

Hey @ali-hassan ,

I'am following step to deploy on my local Mac Sharetribe's development environnement

At step 8 : Run Sphinx index:

When I run :

bundle exec rake ts:index

I got

DEPRECATION WARNING: The factory_girl gem is deprecated. Please upgrade to factory_bot. See https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md for further instructions. (called from <top (required)> at /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/application.rb:20)
Type image/heic is already registered as a variant of image/heic.
Type image/heif is already registered as a variant of image/heif.
WARN DEPRECATION WARNING: Initialization autoloaded the constants ApplicationRecord, ErrorsHelper, ApplicationHelper, DeletePerson, Person::ToView, Person, Person::OmniauthService, Maintenance, and UUIDUtils.

Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.

Reloading does not reboot the application, and therefore code executed during
initialization does not run again. So, if you reload ApplicationRecord, for example,
the expected changes won't be reflected in that stale Class object.

config.autoloader is set to classic. These autoloaded constants would have been unloaded if config.autoloader had been set to :zeitwerk.

In order to autoload safely at boot time, please wrap your code in a reloader
callback this way:

Rails.application.reloader.to_prepare do
  # Autoload classes and modules needed at boot time here.
end

That block runs when the application boots, and every time there is a reload.
For historical reasons, it may run twice, so it has to be idempotent.

Check the "Autoloading and Reloading Constants" guide to learn more about how
Rails autoloads and reloads.
(called from

at /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/environment.rb:26)
Generating configuration to /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf
DEBUG Delayed::Backend::ActiveRecord::Job Destroy (41.8ms) DELETE FROM delayed_jobs WHERE (handler LIKE ('--- !ruby/object:ThinkingSphinx::Deltas::%') AND locked_at IS NULL AND locked_by IS NULL AND failed_at IS NULL)
Sphinx 3.6.1 (commit c9dbedabf)
Copyright (c) 2001-2023, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf'...
WARNING: key 'sql_attr_uint' is deprecated in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 28; use 'attr_uint in index{..} section' instead.
WARNING: key 'sql_attr_uint' is deprecated in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 29; use 'attr_uint in index{..} section' instead.
WARNING: key 'sql_attr_uint' is deprecated in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 30; use 'attr_uint in index{..} section' instead.
WARNING: key 'sql_attr_uint' is deprecated in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 31; use 'attr_uint in index{..} section' instead.
WARNING: key 'sql_attr_float' is deprecated in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 32; use 'attr_float in index{..} section' instead.
WARNING: 20 more warnings skipped.
ERROR: unknown key name 'enable_star' in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 113 col 14.
FATAL: failed to parse config file '/Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf'

The Sphinx indexing command failed:
Command: indexer --config "/Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf" --all
Status: 1
Output: See above

There may be more information about the failure in /Users/commit/Documents/code/own/sharetribe/p2pmarket/log/development.searchd.log.

SO It's seems that sphinx, was not installed.
When I tried to installed sphinx with
brew install sphinx

I got as output

==> Downloading https://formulae.brew.sh/api/formula.jws.json

==> Downloading https://formulae.brew.sh/api/cask.jws.json

Error: sphinx has been disabled because it is using unsupported v2 and source for v3 is not publicly available!

So I tried @romanzes recommandation, I downloaded binary from : g the binary from here: https://sphinxsearch.com/downloads/current/ .

I added the bin to $PATH

But got same issue.

Did you arrive to setup sharetribe dev env in your local computer ?

@ali-hassan
Copy link

ali-hassan commented Apr 24, 2024 via email

@kAgotsi
Copy link

kAgotsi commented Apr 24, 2024

Which version of Sharetribe you're trying to install?

On Wed, Apr 24, 2024 at 3:34 PM Cyrille AGOTSI @.> wrote: Hey @ali-hassan https://github.com/ali-hassan , I'am following step to deploy on my local Mac Sharetribe's development environnement At step 8 : Run Sphinx index: When I run : bundle exec rake ts:index I got DEPRECATION WARNING: The factory_girl gem is deprecated. Please upgrade to factory_bot. See https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md for further instructions. (called from <top (required)> at /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/application.rb:20) Type image/heic is already registered as a variant of image/heic. Type image/heif is already registered as a variant of image/heif. WARN DEPRECATION WARNING: Initialization autoloaded the constants ApplicationRecord, ErrorsHelper, ApplicationHelper, DeletePerson, Person::ToView, Person, Person::OmniauthService, Maintenance, and UUIDUtils. Being able to do this is deprecated. Autoloading during initialization is going to be an error condition in future versions of Rails. Reloading does not reboot the application, and therefore code executed during initialization does not run again. So, if you reload ApplicationRecord, for example, the expected changes won't be reflected in that stale Class object. config.autoloader is set to classic. These autoloaded constants would have been unloaded if config.autoloader had been set to :zeitwerk. In order to autoload safely at boot time, please wrap your code in a reloader callback this way: Rails.application.reloader.to_prepare do # Autoload classes and modules needed at boot time here. end That block runs when the application boots, and every time there is a reload. For historical reasons, it may run twice, so it has to be idempotent. Check the "Autoloading and Reloading Constants" guide to learn more about how Rails autoloads and reloads. (called from at /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/environment.rb:26) Generating configuration to /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf DEBUG Delayed::Backend::ActiveRecord::Job Destroy (41.8ms) DELETE FROM delayed_jobs WHERE (handler LIKE ('--- !ruby/object:ThinkingSphinx::Deltas::%') AND locked_at IS NULL AND locked_by IS NULL AND failed_at IS NULL) Sphinx 3.6.1 (commit c9dbedabf) Copyright (c) 2001-2023, Andrew Aksyonoff Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) using config file '/Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf'... WARNING: key 'sql_attr_uint' is deprecated in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 28; use 'attr_uint in index{..} section' instead. WARNING: key 'sql_attr_uint' is deprecated in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 29; use 'attr_uint in index{..} section' instead. WARNING: key 'sql_attr_uint' is deprecated in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 30; use 'attr_uint in index{..} section' instead. WARNING: key 'sql_attr_uint' is deprecated in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 31; use 'attr_uint in index{..} section' instead. WARNING: key 'sql_attr_float' is deprecated in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 32; use 'attr_float in index{..} section' instead. WARNING: 20 more warnings skipped. ERROR: unknown key name 'enable_star' in /Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf line 113 col 14. FATAL: failed to parse config file '/Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf' The Sphinx indexing command failed: Command: indexer --config "/Users/commit/Documents/code/own/sharetribe/p2pmarket/config/development.sphinx.conf" --all Status: 1 Output: See above There may be more information about the failure in /Users/commit/Documents/code/own/sharetribe/p2pmarket/log/development.searchd.log. SO It's seems that sphinx, was not installed. When I tried to installed sphinx with brew install sphinx I got as output ==> Downloading https://formulae.brew.sh/api/formula.jws.json ==> Downloading https://formulae.brew.sh/api/cask.jws.json Error: sphinx has been disabled because it is using unsupported v2 and source for v3 is not publicly available! So I tried @romanzes https://github.com/romanzes recommandation, I downloaded binary from : g the binary from here: https://sphinxsearch.com/downloads/current/ . I added the bin to $PATH But got same issue. Did you arrive to setup sharetribe dev env in your local computer ? — Reply to this email directly, view it on GitHub <#4389 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCJVQ5KXCQ2SUQBVFD7ZI3Y66DEFAVCNFSM6AAAAABCEKIU4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZUGYZTSNJQG4 . You are receiving this because you were mentioned.Message ID: @.>

I'am not install specific version. I cloned branch from https://github.com/sharetribe/sharetribe and I 'am following readme to install dev environnement

@ali-hassan
Copy link

ali-hassan commented Apr 24, 2024 via email

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.

None yet

4 participants