Skip to content

Commit

Permalink
Remove the delayed_write option
Browse files Browse the repository at this point in the history
Don't use the delayed_write option when opening a file.  This option
is known to cause corruption issues in Erlang 15x.  It is fixed in
16B01 but currently Riak must run on 15B01, thus the VM cannot simply
be upgraded.

This patch is being made in direct relation to a customer having
buffer corruption issues when the machine is under heavy load.  I was
able to reproduce easily using an underpowered centos VM running on
virtual box.
  • Loading branch information
rzezeski committed Jul 3, 2013
1 parent 263f84a commit 4cb9a4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/mi_buffer.erl
Expand Up @@ -51,11 +51,7 @@
new(Filename) ->
%% Open the existing buffer file...
filelib:ensure_dir(Filename),
{ok, DelayedWriteSize} = application:get_env(merge_index, buffer_delayed_write_size),
{ok, DelayedWriteMS} = application:get_env(merge_index, buffer_delayed_write_ms),
FuzzedWriteSize = trunc(mi_utils:fuzz(DelayedWriteSize, 0.1)),
FuzzedWriteMS = trunc(mi_utils:fuzz(DelayedWriteMS, 0.1)),
{ok, FH} = file:open(Filename, [read, write, raw, binary, {delayed_write, FuzzedWriteSize, FuzzedWriteMS}]),
{ok, FH} = file:open(Filename, [read, write, raw, binary]),

%% Read into an ets table...
Table = ets:new(buffer, [duplicate_bag, public]),
Expand Down
4 changes: 1 addition & 3 deletions src/mi_segment_writer.erl
Expand Up @@ -66,9 +66,7 @@

from_iterator(Iterator, Segment) ->
%% Open the data file...
{ok, DelayedWriteSize} = application:get_env(merge_index, segment_delayed_write_size),
{ok, DelayedWriteMS} = application:get_env(merge_index, segment_delayed_write_ms),
{ok, DataFile} = file:open(mi_segment:data_file(Segment), [write, raw, binary, {delayed_write, DelayedWriteSize, DelayedWriteMS}]),
{ok, DataFile} = file:open(mi_segment:data_file(Segment), [write, raw, binary]),

W = #writer {
data_file=DataFile,
Expand Down

0 comments on commit 4cb9a4d

Please sign in to comment.