couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Davies <ja...@jasondavies.com>
Subject Re: Detailed info on the B-tree store? Native implementations thereof?
Date Tue, 11 Aug 2009 23:15:51 GMT
On 12 Aug 2009, at 00:08, Robert Newson wrote:

>> The worst problem is that the disk controller will reorder sector  
>> writes to reduce seek time, which in effect means that if power is  
>> lost, some random subset of the last writes may not happen. So you  
>> won't just end up with a truncated file
>
> But what about that issue? It think it's tolerated because couchdb
> searches backward for the last non-corrupt header, right?
>
> find_header(_Fd, -1) ->
>    no_valid_header;
> find_header(Fd, Block) ->
>    case (catch load_header(Fd, Block)) of
>    {ok, Bin} ->
>        {ok, Bin};
>    _Error ->
>        find_header(Fd, Block -1)
>    end.


What if the tail-header isn't corrupted but some of the preceding  
writes were, due to the tail-header being written before preceding  
blocks?

--
Jason Davies

www.jasondavies.com


Mime
View raw message