couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filipe David Manana <fdman...@apache.org>
Subject Re: gen_server timeout after compaction patch
Date Tue, 12 Oct 2010 15:42:33 GMT
(previous mail got messed up)

Sometimes (too often actually), after compacting a large DB (6,5Gb), I
get gen_server call timeouts (calls to couch_db gen_server, message
{db_updater, Db}). Resulting in big stack traces and a restart of the
couch_server process. The following 1 line patch fixes it:


diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl
index 93faba0..48d25db 100644
--- a/src/couchdb/couch_db_updater.erl
+++ b/src/couchdb/couch_db_updater.erl
@@ -187,7 +187,7 @@ handle_cast({compact_done, CompactFilepath},
#db{filepath=Filepath}=Db) ->
         couch_file:delete(RootDir, Filepath),
         ok = file:rename(CompactFilepath, Filepath),
         close_db(Db),
-        ok = gen_server:call(Db#db.main_pid, {db_updated, NewDb2}),
+        ok = gen_server:cast(Db#db.main_pid, {db_updated, NewDb2}),
         ?LOG_INFO("Compaction for db \"~s\" completed.", [Db#db.name]),
         {noreply, NewDb2#db{compactor_pid=nil}};
     false ->



anyone against committing this?



On Tue, Oct 12, 2010 at 4:40 PM, Filipe David Manana
<fdmanana@apache.org> wrote:
> Hi all,
>
> I have a large DB (about 6,5 Gb after compaction) that every time it's
> compacted, immediately
>
>
> diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl
> Sometimes (too often actually), after compacting a large DB (6,5Gb), I
> get gen_server call timeouts (calls to couch_db gen_server, message
> {db_updater, Db}). Resulting in big stack traces and a restart of the
> couch_server process. The following 1 line patch fixes it:
>
> index 93faba0..40f393e 100644
> --- a/src/couchdb/couch_db_updater.erl
> +++ b/src/couchdb/couch_db_updater.erl
> @@ -187,7 +187,7 @@ handle_cast({compact_done, CompactFilepath},
> #db{filepath=Filepath}=Db) ->
>         couch_file:delete(RootDir, Filepath),
>         ok = file:rename(CompactFilepath, Filepath),
>         close_db(Db),
> -        ok = gen_server:call(Db#db.main_pid, {db_updated, NewDb2}),
> +        ok = gen_server:call(Db#db.main_pid, {db_updated, NewDb2}, infinity),
>         ?LOG_INFO("Compaction for db \"~s\" completed.", [Db#db.name]),
>         {noreply, NewDb2#db{compactor_pid=nil}};
>     false ->
>
>
> Anyone against committing it?
>
> cheers
>
> --
> Filipe David Manana,
> fdmanana@gmail.com, fdmanana@apache.org
>
> "Reasonable men adapt themselves to the world.
>  Unreasonable men adapt the world to themselves.
>  That's why all progress depends on unreasonable men."
>



-- 
Filipe David Manana,
fdmanana@gmail.com, fdmanana@apache.org

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

Mime
View raw message