On Mon, Jun 28, 2010 at 7:38 AM, Juhani Ränkimies <[email protected]> wrote:
...
>
> Opening in append mode in sync/1 helps for 'basics' test. But there is
> still something wrong. The server hangs in different tests when trying
> to 'Run All'.
>
With the patch below, most Futon tests succeed on windows.
For some reason, on my system repeating init:restart/0 many times
causes erlang vm to crash. Don't know if it's just my build of R14A or
erlang on windows in general. Replacing
couch_server_sup:restart_core_server/0 with the old implementation
helped for that.
DB deletion still failed occationally when the previous .delete file
for the db still existed. Adding a uuid to the .delete filename fixed
that.
With the patch these tests still fail:
'uuids' fails consistently with ~930 of these
# Assertion 'u1 < u2, "UTC uuids are only roughly ordered, so this
assertion may fail occasionally. Don't sweat it."' failed: UTC uuids
are only roughly ordered, so this assertion may fail occasionally.
Don't sweat it.
'rev_stemming' fails consistently with
# Assertion 'should return a truncated revision list' failed: expected
'5', got '6'
'view_include_docs' fails consistently with
# Assertion failed: !resp.rows[0].doc
# Assertion failed: resp.rows[0].doc == null
'compact' sometimes fails with
# Assertion failed: db.info().disk_size < deletesize
'attachments' sometimes fails with
# Assertion 'should send 201 Accepted' failed: expected '201', got '500'
# Assertion 'should send 201 Accepted' failed: expected '201', got '400'
'changes' sometimes fails with
# Exception raised: "timeout: change_lines"
-juhani
--------------------------------------------------------------------------
diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl
index 8c82272..e9cd83a 100644
--- a/src/couchdb/couch_file.erl
+++ b/src/couchdb/couch_file.erl
@@ -148,7 +148,7 @@ truncate(Fd, Pos) ->
%%----------------------------------------------------------------------
sync(Filepath) when is_list(Filepath) ->
- {ok, Fd} = file:open(Filepath, [read, raw]),
+ {ok, Fd} = file:open(Filepath, [append, raw]),
try file:sync(Fd) after file:close(Fd) end;
sync(Fd) ->
gen_server:call(Fd, sync, infinity).
@@ -171,9 +171,10 @@ close(Fd) ->
end.
delete(Filepath) ->
- case file:rename(Filepath, Filepath ++ ".delete") of
+ DeleteFilepath = Filepath ++ binary_to_list(couch_uuids:new()) ++
".delete",
+ case file:rename(Filepath, DeleteFilepath) of
ok ->
- spawn(file, delete, [Filepath ++ ".delete"]),
+ spawn(file, delete, [DeleteFilepath]),
ok;
Error ->
Error
diff --git a/src/couchdb/couch_server_sup.erl b/src/couchdb/couch_server_sup.erl
index 1484982..df8bf3f 100644
--- a/src/couchdb/couch_server_sup.erl
+++ b/src/couchdb/couch_server_sup.erl
@@ -32,7 +32,13 @@ start_link(IniFiles) ->
end.
restart_core_server() ->
- init:restart().
+ supervisor:terminate_child(couch_primary_services, couch_server),
+ supervisor:terminate_child(couch_secondary_services, stats_aggregator),
+ supervisor:terminate_child(couch_secondary_services, stats_collector),
+ supervisor:restart_child(couch_primary_services, couch_server),
+ supervisor:restart_child(couch_secondary_services, stats_collector),
+ supervisor:restart_child(couch_secondary_services, stats_aggregator).
+% init:restart().
couch_config_start_link_wrapper(IniFiles, FirstConfigPid) ->
case is_process_alive(FirstConfigPid) of