You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ji...@apache.org on 2019/08/13 08:44:22 UTC
[couchdb] 01/01: fixup for dreyfus_fabric_cleanup:go/1
This is an automated email from the ASF dual-hosted git repository.
jiangphcn pushed a commit to branch fixup-cleanup-go
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 721f4fde975f045997e81bd33242c99f42d2c244
Author: jiangph <ji...@cn.ibm.com>
AuthorDate: Tue Aug 13 16:42:21 2019 +0800
fixup for dreyfus_fabric_cleanup:go/1
---
src/dreyfus/src/dreyfus_fabric_cleanup.erl | 8 ++++----
src/dreyfus/src/dreyfus_util.erl | 5 ++++-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/dreyfus/src/dreyfus_fabric_cleanup.erl b/src/dreyfus/src/dreyfus_fabric_cleanup.erl
index b5e030d..2840a2f 100644
--- a/src/dreyfus/src/dreyfus_fabric_cleanup.erl
+++ b/src/dreyfus/src/dreyfus_fabric_cleanup.erl
@@ -53,12 +53,12 @@ cleanup_local_purge_doc(DbName, ActiveSigs) ->
end, [], LocalShards),
DeadDirs = DirList -- ActiveDirs,
- lists:foldl(fun(IdxDir) ->
+ lists:foreach(fun(IdxDir) ->
Sig = dreyfus_util:get_signature_from_idxdir(IdxDir),
case Sig of undefined -> ok; _ ->
DocId = dreyfus_util:get_local_purge_doc_id(Sig),
LocalShards = mem3:local_shards(DbName),
- lists:foldl(fun(LS, _AccOuter) ->
+ lists:foreach(fun(LS) ->
ShardDbName = LS#shard.name,
{ok, ShardDb} = couch_db:open_int(ShardDbName, []),
case couch_db:open_doc(ShardDb, DocId, []) of
@@ -69,6 +69,6 @@ cleanup_local_purge_doc(DbName, ActiveSigs) ->
ok
end,
couch_db:close(ShardDb)
- end, [], LocalShards)
+ end, LocalShards)
end
- end, [], DeadDirs).
+ end, DeadDirs).
diff --git a/src/dreyfus/src/dreyfus_util.erl b/src/dreyfus/src/dreyfus_util.erl
index ae3133e..6832299 100644
--- a/src/dreyfus/src/dreyfus_util.erl
+++ b/src/dreyfus/src/dreyfus_util.erl
@@ -332,7 +332,10 @@ get_local_purge_doc_id(Sig) ->
get_signature_from_idxdir(IdxDir) ->
IdxDirList = filename:split(IdxDir),
Sig = lists:last(IdxDirList),
- case [Ch || Ch <- Sig, not (((Ch >= $0) and (Ch =< $9))
+ Sig2 = if not is_binary(Sig) -> Sig; true ->
+ binary_to_list(Sig)
+ end,
+ case [Ch || Ch <- Sig2, not (((Ch >= $0) and (Ch =< $9))
orelse ((Ch >= $a) and (Ch =< $f))
orelse ((Ch >= $A) and (Ch =< $F)))] == [] of
true -> Sig;