Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #175 from basho/az655-osync-warning

Az655 osync warning
  • Loading branch information...
commit 6a29591ecd9da73e27223a1a55acd80c21d4d17f 2 parents 15a19a5 + 31cc4c9
Jeffrey Massung massung authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 src/riak_kv_bitcask_backend.erl
20 src/riak_kv_bitcask_backend.erl
View
@@ -91,6 +91,7 @@ start(Partition, Config) ->
BitcaskOpts = set_mode(read_write, Config),
case bitcask:open(filename:join(DataRoot, DataFile), BitcaskOpts) of
Ref when is_reference(Ref) ->
+ check_fcntl(),
schedule_merge(Ref),
maybe_schedule_sync(Ref),
AsyncFolds = config_value(async_folds, Config, true),
@@ -368,6 +369,25 @@ key_counts(RootDir) ->
%% ===================================================================
%% @private
+%% On linux there is a kernel bug that won't allow fcntl to add O_SYNC
+%% to an already open file descriptor.
+check_fcntl() ->
+ Logged=application:get_env(riak_kv,o_sync_warning_logged),
+ Strategy=application:get_env(bitcask,sync_strategy),
+ case {Logged,Strategy} of
+ {undefined,{ok,o_sync}} ->
+ case riak_core_util:is_arch(linux) of
+ true ->
+ lager:warning("{sync_strategy,o_sync} not implemented on Linux"),
+ application:set_env(riak_kv,o_sync_warning_logged,true);
+ _ ->
+ ok
+ end;
+ _ ->
+ ok
+ end.
+
+%% @private
%% Return a function to fold over the buckets on this backend
fold_buckets_fun(FoldBucketsFun) ->
fun(#bitcask_entry{key=BK}, {Acc, BucketSet}) ->
Please sign in to comment.
Something went wrong with that request. Please try again.