Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yosukehara committed May 9, 2014
1 parent 3be7f4d commit 0a6760e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/leo_object_storage_haystack.erl
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,8 @@ compact_put(WriteHandler, Metadata, KeyBin, BodyBin) ->
Metadata_1 = leo_object_storage_transformer:transform_metadata(Metadata),
Object = leo_object_storage_transformer:metadata_to_object(Metadata_1),
Needle = create_needle(Object#?OBJECT{key = KeyBin,
data = BodyBin}),
data = BodyBin,
offset = Offset}),
case catch file:pwrite(WriteHandler, Offset, Needle) of
ok ->
{ok, Offset};
Expand Down
8 changes: 3 additions & 5 deletions src/leo_object_storage_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -834,13 +834,15 @@ calc_remain_disksize(MetaDBId, FilePath) ->
%% @private
-spec(is_deleted_rec(atom(), #backend_info{}, #?METADATA{}) ->
boolean()).
is_deleted_rec(_MetaDBId, _StorageInfo, #?METADATA{del = Del}) when Del =/= ?DEL_FALSE ->
is_deleted_rec(_MetaDBId, _StorageInfo, #?METADATA{del = ?DEL_TRUE}) ->
true;
is_deleted_rec(MetaDBId, #backend_info{avs_version_bin_prv = AVSVsnBinPrv} = StorageInfo,
#?METADATA{key = Key,
addr_id = AddrId} = MetaFromAvs) ->
KeyOfMetadata = ?gen_backend_key(AVSVsnBinPrv, AddrId, Key),
case leo_backend_db_api:get(MetaDBId, KeyOfMetadata) of
{ok, #?METADATA{del = ?DEL_TRUE}} ->
true;
{ok, MetaOrg} ->
MetaOrgTerm = binary_to_term(MetaOrg),
is_deleted_rec(MetaDBId, StorageInfo, MetaFromAvs, MetaOrgTerm);
Expand All @@ -853,10 +855,6 @@ is_deleted_rec(MetaDBId, #backend_info{avs_version_bin_prv = AVSVsnBinPrv} = Sto
%% @private
-spec(is_deleted_rec(atom(), #backend_info{}, #?METADATA{}, #?METADATA{}) ->
boolean()).
is_deleted_rec(_MetaDBId,_StorageInfo,
_Meta,
#?METADATA{del = Del}) when Del /= 0 ->
true;
is_deleted_rec(_MetaDBId,_StorageInfo,
#?METADATA{offset = Offset_1},
#?METADATA{offset = Offset_2}) when Offset_1 /= Offset_2 ->
Expand Down

0 comments on commit 0a6760e

Please sign in to comment.