You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/09/01 20:23:31 UTC

couch commit: updated refs/heads/master to 4534f53

Repository: couchdb-couch
Updated Branches:
  refs/heads/master 0149bfa79 -> 4534f5393


new IOQ api


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/4534f539
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/4534f539
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/4534f539

Branch: refs/heads/master
Commit: 4534f53930465e239f3a06cfe3cd705d235c1f67
Parents: 0149bfa
Author: Robert Newson <rn...@apache.org>
Authored: Mon Sep 1 19:19:55 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Mon Sep 1 19:22:58 2014 +0100

----------------------------------------------------------------------
 src/couch_db_updater.erl |  4 ++--
 src/couch_file.erl       | 13 +++++++------
 2 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/4534f539/src/couch_db_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_db_updater.erl b/src/couch_db_updater.erl
index 07518e4..9af5eed 100644
--- a/src/couch_db_updater.erl
+++ b/src/couch_db_updater.erl
@@ -35,7 +35,7 @@
 }).
 
 init({DbName, Filepath, Fd, Options}) ->
-    erlang:put(io_class, compaction),
+    erlang:put(io_priority, {db_update, DbName}),
     case lists:member(create, Options) of
     true ->
         % create a new header and writes it to the file
@@ -1180,7 +1180,7 @@ copy_compact(Db, NewDb0, Retry) ->
 
 
 start_copy_compact(#db{}=Db) ->
-    erlang:put(io_class, compaction),
+    erlang:put(io_priority, {db_compact, Db#db.name}),
     #db{name=Name, filepath=Filepath, options=Options, header=Header} = Db,
     ?LOG_DEBUG("Compaction process spawned for db \"~s\"", [Name]),
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/4534f539/src/couch_file.erl
----------------------------------------------------------------------
diff --git a/src/couch_file.erl b/src/couch_file.erl
index fe5aeee..19fb72e 100644
--- a/src/couch_file.erl
+++ b/src/couch_file.erl
@@ -118,14 +118,15 @@ append_term_md5(Fd, Term, Options) ->
 %%----------------------------------------------------------------------
 
 append_binary(Fd, Bin) ->
-    ioq:call(Fd, {append_bin, assemble_file_chunk(Bin)}).
+    ioq:call(Fd, {append_bin, assemble_file_chunk(Bin)}, erlang:get(io_priority)).
     
 append_binary_md5(Fd, Bin) ->
     ioq:call(Fd,
-        {append_bin, assemble_file_chunk(Bin, couch_util:md5(Bin))}).
+        {append_bin, assemble_file_chunk(Bin, couch_util:md5(Bin))},
+        erlang:get(io_priority)).
 
 append_raw_chunk(Fd, Chunk) ->
-    ioq:call(Fd, {append_bin, Chunk}).
+    ioq:call(Fd, {append_bin, Chunk}, erlang:get(io_priority)).
 
 
 assemble_file_chunk(Bin) ->
@@ -160,7 +161,7 @@ pread_binary(Fd, Pos) ->
 
 
 pread_iolist(Fd, Pos) ->
-    case ioq:call(Fd, {pread_iolist, Pos}) of
+    case ioq:call(Fd, {pread_iolist, Pos}, erlang:get(io_priority)) of
     {ok, IoList, <<>>} ->
         {ok, IoList};
     {ok, IoList, Md5} ->
@@ -266,7 +267,7 @@ init_delete_dir(RootDir) ->
 
 
 read_header(Fd) ->
-    case ioq:call(Fd, find_header) of
+    case ioq:call(Fd, find_header, erlang:get(io_priority)) of
     {ok, Bin} ->
         {ok, binary_to_term(Bin)};
     Else ->
@@ -278,7 +279,7 @@ write_header(Fd, Data) ->
     Md5 = couch_util:md5(Bin),
     % now we assemble the final header binary and write to disk
     FinalBin = <<Md5/binary, Bin/binary>>,
-    ioq:call(Fd, {write_header, FinalBin}).
+    ioq:call(Fd, {write_header, FinalBin}, erlang:get(io_priority)).
 
 
 init_status_error(ReturnPid, Ref, Error) ->