From 0a6760e366a2b9ae94a3fb4e07d7a46008c325b7 Mon Sep 17 00:00:00 2001 From: Yosuke Hara Date: Fri, 9 May 2014 15:29:52 +0900 Subject: [PATCH] Fix leo-project/leofs/issues/188 --- src/leo_object_storage_haystack.erl | 3 ++- src/leo_object_storage_server.erl | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/leo_object_storage_haystack.erl b/src/leo_object_storage_haystack.erl index 2259a25..a9d6040 100644 --- a/src/leo_object_storage_haystack.erl +++ b/src/leo_object_storage_haystack.erl @@ -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}; diff --git a/src/leo_object_storage_server.erl b/src/leo_object_storage_server.erl index d35beae..2cf9b17 100644 --- a/src/leo_object_storage_server.erl +++ b/src/leo_object_storage_server.erl @@ -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); @@ -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 ->