summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Hui Jiang <jiangph@cn.ibm.com>2019-08-14 11:12:36 +0800
committerGitHub <noreply@github.com>2019-08-14 11:12:36 +0800
commit07600f73d117417d5af26e4c2fb6ebc31f09e570 (patch)
treefa1a7ce2919841ba3ff5a2738d31e5a9b038ae82
parentdcae3e7a7ad3a1365f7294b0df488ec2990e4f8b (diff)
parent721f4fde975f045997e81bd33242c99f42d2c244 (diff)
downloadcouchdb-07600f73d117417d5af26e4c2fb6ebc31f09e570.tar.gz
Merge pull request #2109 from apache/fixup-cleanup-go
fixup for dreyfus_fabric_cleanup:go/1
-rw-r--r--src/dreyfus/src/dreyfus_fabric_cleanup.erl8
-rw-r--r--src/dreyfus/src/dreyfus_util.erl5
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 b5e030db0..2840a2f2d 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 ae3133e7d..6832299db 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;