Forum: Ferret [ActsAsFerret] Index Directory Disappears and Not Re-created

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cabf735ce7b8b4471ef46ea54f71832d?d=identicon&s=25 Michael Mahemoff (Guest)
on 2007-01-18 13:05
Hi,

This is a recurring issue for me - the index directory on my production
server and everything below it occasionally disappears and isn't
reconstructed. I tried manually creating the entire index path manually
before starting the server, but it still happened while the server is
running.

I don't know what's causing the index to disappear and I'm also not sure
why it's not automagically re-created in any event?

Using:

Rails 1.1.6
Ferret 0.10.13
Acts_as_ferret (can't see a version no. but it's recent)

Any help would be greatly appreciated.

----

IOError (IO Error occured at <except.c>:79 in xraise
Error occured in fs_store.c:185 - fs_clear_all
        clearing all files in
/var/www/apps/accounts/current/config/../index/production/account: <No
such file or directory>

):
    /usr/lib/ruby/gems/1.8/gems/ferret-0.10.13/lib/ferret/index.rb:664:in
`initialize'
    /usr/lib/ruby/gems/1.8/gems/ferret-0.10.13/lib/ferret/index.rb:664:in
`ensure_writer_open'
    /usr/lib/ruby/gems/1.8/gems/ferret-0.10.13/lib/ferret/index.rb:270:in
`<<'
    /usr/lib/ruby/1.8/monitor.rb:229:in `synchronize'
    /usr/lib/ruby/gems/1.8/gems/ferret-0.10.13/lib/ferret/index.rb:254:in
`<<'
    /vendor/plugins/acts_as_ferret/lib/instance_methods.rb:85:in
`ferret_create'
    /vendor/rails/activerecord/lib/active_record/callbacks.rb:344:in
`callback'
    /vendor/rails/activerecord/lib/active_record/callbacks.rb:341:in
`callback'
    /vendor/rails/activerecord/lib/active_record/callbacks.rb:266:in
`create_without_timestamps'
    /vendor/rails/activerecord/lib/active_record/timestamp.rb:30:in
`create'
    /vendor/rails/activerecord/lib/active_record/base.rb:1718:in
`create_or_update_without_callbacks'
    /vendor/rails/activerecord/lib/active_record/callbacks.rb:253:in
`create_or_update'
    /vendor/rails/activerecord/lib/active_record/base.rb:1392:in
`save_without_validation'
    /vendor/rails/activerecord/lib/active_record/validations.rb:736:in
`save_without_transactions'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:126:in
`save'
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:51:in
`transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:91:in
`transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:118:in
`transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:126:in
`save'
C9dd93aa135988cabf9183d3210665ca?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-01-19 16:31
(Received via mailing list)
On Thu, Jan 18, 2007 at 01:05:47PM +0100, Michael Mahemoff wrote:
> Hi,
>
> This is a recurring issue for me - the index directory on my production
> server and everything below it occasionally disappears and isn't
> reconstructed. I tried manually creating the entire index path manually
> before starting the server, but it still happened while the server is
> running.
>
> I don't know what's causing the index to disappear and I'm also not sure
> why it's not automagically re-created in any event?

I suspect you use capistrano for your deployment - is it possible that
on each deploy your index gets lost because it is located inside the
releases/.../ subdirectory?

for the index not being recreated problem - maybe it's just a permission
issue?

Jens



--
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       kraemer@webit.de
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
Cabf735ce7b8b4471ef46ea54f71832d?d=identicon&s=25 Michael Mahemoff (Guest)
on 2007-01-24 12:05
Jens Kraemer wrote:
> On Thu, Jan 18, 2007 at 01:05:47PM +0100, Michael Mahemoff wrote:
>> Hi,
>>
>> This is a recurring issue for me - the index directory on my production
>> server and everything below it occasionally disappears and isn't
>> reconstructed. I tried manually creating the entire index path manually
>> before starting the server, but it still happened while the server is
>> running.
>>
>> I don't know what's causing the index to disappear and I'm also not sure
>> why it's not automagically re-created in any event?
>
> I suspect you use capistrano for your deployment - is it possible that
> on each deploy your index gets lost because it is located inside the
> releases/.../ subdirectory?

Thanks for the reply and you guessed correctly. It's running capistrano
and maybe that explains why it happens periodically.

> for the index not being recreated problem - maybe it's just a permission
> issue?

I'm not sure about that as the log messages don't seem to indicate it
and the server user is the same as the user that created the release
structure. I do have the index checked in to the repository though (as a
hack) and maybe the attributes on it are wrong (e.g. the dir's not
executable).

Thanks,
Michael
C9dd93aa135988cabf9183d3210665ca?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-01-24 13:38
(Received via mailing list)
On Wed, Jan 24, 2007 at 12:05:24PM +0100, Michael Mahemoff wrote:
> >> I don't know what's causing the index to disappear and I'm also not sure
> > issue?
>
> I'm not sure about that as the log messages don't seem to indicate it
> and the server user is the same as the user that created the release
> structure. I do have the index checked in to the repository though (as a
> hack) and maybe the attributes on it are wrong (e.g. the dir's not
> executable).

I usually symlink the RAILS_ROOT/index/ directory to shared/index in an
after_update_code recipe.
That way the index physically stays the same from deployment to
deployment.

Jens


--
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       kraemer@webit.de
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
1c2737f395a0c70124bca79081d4e8e0?d=identicon&s=25 Ewout (Guest)
on 2007-01-24 13:43
(Received via mailing list)
Checking in the index is a very bad idea. Instead, the index should be
in the shared directory of your deployment, and releases should symlink
to this shared index.

In deploy.rb, this would look like this:

<<-DESC
Create a shared index dir.
All deployed versions will share the same index, as they share the same
database.
When upgrading ferret, this index might have to be rebuilt.
DESC
task :create_index_dir do
  run <<-CMD
    mkdir -p -m 777 #{shared_path}/index
  CMD
end

<<-DESC
Create a symlink from the current release to the shared index.
DESC
task :create_index_symlink do
  run <<-CMD
    ln -fs #{shared_path}/index/ #{current_release}/index
  CMD
end

# Hooks

task :after_setup do
  create_index_dir
end

task :after_symlink do
  create_index_symlink
end
This topic is locked and can not be replied to.