You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Filipe David Manana <fd...@apache.org> on 2010/10/12 17:40:27 UTC
gen_server timeout after compaction patch
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."
Re: gen_server timeout after compaction patch
Posted by Damien Katz <da...@apache.org>.
Looks good to me.
-Damien
On Oct 12, 2010, at 8:42 AM, Filipe David Manana wrote:
> (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
> <fd...@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."
Re: gen_server timeout after compaction patch
Posted by Filipe David Manana <fd...@apache.org>.
(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
<fd...@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."