couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r777345 - in /couchdb/branches/tail_header/src/couchdb: couch_db_updater.erl couch_file.erl
Date Fri, 22 May 2009 01:09:01 GMT
Author: damien
Date: Fri May 22 01:09:01 2009
New Revision: 777345

URL: http://svn.apache.org/viewvc?rev=777345&view=rev
Log:
Fixes for reading old 09 files.

Modified:
    couchdb/branches/tail_header/src/couchdb/couch_db_updater.erl
    couchdb/branches/tail_header/src/couchdb/couch_file.erl

Modified: couchdb/branches/tail_header/src/couchdb/couch_db_updater.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/tail_header/src/couchdb/couch_db_updater.erl?rev=777345&r1=777344&r2=777345&view=diff
==============================================================================
--- couchdb/branches/tail_header/src/couchdb/couch_db_updater.erl (original)
+++ couchdb/branches/tail_header/src/couchdb/couch_db_updater.erl Fri May 22 01:09:01 2009
@@ -56,7 +56,7 @@
     end;
 handle_call(full_commit, _From, #db{waiting_delayed_commit=nil}=Db) ->
     {reply, ok, Db}; % no data waiting, return ok immediately
-handle_call(full_commit, _From,  #db{fd=Fd}=Db) ->
+handle_call(full_commit, _From,  Db) ->
     {reply, ok, commit_data(Db)}; % commit the data and return ok
 handle_call(increment_update_seq, _From, Db) ->
     Db2 = commit_data(Db#db{update_seq=Db#db.update_seq+1}),

Modified: couchdb/branches/tail_header/src/couchdb/couch_file.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/tail_header/src/couchdb/couch_file.erl?rev=777345&r1=777344&r2=777345&view=diff
==============================================================================
--- couchdb/branches/tail_header/src/couchdb/couch_file.erl (original)
+++ couchdb/branches/tail_header/src/couchdb/couch_file.erl Fri May 22 01:09:01 2009
@@ -66,7 +66,7 @@
 %%----------------------------------------------------------------------
 
 append_term(Fd, Term) ->
-    append_binary(Fd, term_to_binary(Term, [compressed])).
+    append_binary(Fd, term_to_binary(Term)).
 
 
 %%----------------------------------------------------------------------
@@ -112,8 +112,6 @@
     {ok, Iolist, _} = read_raw_iolist(Fd, NextPos, Len),
     {ok, Iolist}.
 
-read_raw_iolist(Fd, Pos, Len) when (Pos rem ?SIZE_BLOCK) == 0 ->
-    read_raw_iolist(Fd, Pos + 1, Len);
 read_raw_iolist(Fd, Pos, Len) ->
     BlockOffset = Pos rem ?SIZE_BLOCK,
     TotalBytes = calculate_total_read_len(BlockOffset, Len),
@@ -249,7 +247,7 @@
 
 handle_call({pread, Pos, Bytes}, _From, #file{fd=Fd,tail_append_begin=TailAppendBegin}=File)
->
     {ok, Bin} = file:pread(Fd, Pos, Bytes),
-    {reply, {ok, Bin, Pos > TailAppendBegin}, File};
+    {reply, {ok, Bin, Pos >= TailAppendBegin}, File};
 handle_call(bytes, _From, #file{fd=Fd}=File) ->
     {reply, file:position(Fd, eof), File};
 handle_call(sync, _From, #file{fd=Fd}=File) ->
@@ -436,7 +434,8 @@
     Md5Sig = erlang:md5(HeaderBin),
     {ok, HeaderBin}.
 
-
+calculate_total_read_len(0, FinalLen) ->
+    calculate_total_read_len(1, FinalLen) + 1;
 calculate_total_read_len(BlockOffset, FinalLen) ->
     case ?SIZE_BLOCK - BlockOffset of
     BlockLeft when BlockLeft >= FinalLen ->



Mime
View raw message