Skip to content

Commit 72faf5d

Browse files
committed
refactor soft deletion of search index
1 parent a8f3ad9 commit 72faf5d

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/dreyfus/src/clouseau_rpc.erl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
-export([open_index/3]).
2121
-export([await/2, commit/2, get_update_seq/1, info/1, search/2]).
2222
-export([group1/7, group2/2]).
23-
-export([delete/2, update/3, cleanup/1, cleanup/2, rename/1]).
23+
-export([delete/2, soft_delete/1, update/3, cleanup/1, cleanup/2]).
2424
-export([analyze/2, version/0, disk_size/1]).
2525
-export([set_purge_seq/2, get_purge_seq/1, get_root_dir/0, close_lru/0, close_lru/1]).
2626
-export([connected/0]).
@@ -78,16 +78,15 @@ group2(Ref, Args) ->
7878
delete(Ref, Id) ->
7979
rpc(Ref, {delete, couch_util:to_binary(Id)}).
8080

81+
soft_delete(DbName) ->
82+
rpc({main, clouseau()}, {soft_delete, DbName}).
83+
8184
update(Ref, Id, Fields) ->
8285
rpc(Ref, {update, Id, Fields}).
8386

8487
cleanup(DbName) ->
8588
gen_server:cast({cleanup, clouseau()}, {cleanup, DbName}).
8689

87-
rename(DbName) ->
88-
close_lru(DbName),
89-
gen_server:cast({cleanup, clouseau()}, {rename, DbName}).
90-
9190
cleanup(DbName, ActiveSigs) ->
9291
gen_server:cast({cleanup, clouseau()}, {cleanup, DbName, ActiveSigs}).
9392

src/dreyfus/src/dreyfus_index_manager.erl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ handle_call({open_error, DbName, Sig, Error}, {OpenerPid, _}, State) ->
8282

8383
handle_cast({cleanup, DbName}, State) ->
8484
clouseau_rpc:cleanup(DbName),
85-
{noreply, State};
86-
87-
handle_cast({rename, DbName}, State) ->
88-
clouseau_rpc:rename(DbName),
8985
{noreply, State}.
9086

9187
handle_info({'EXIT', FromPid, Reason}, State) ->
@@ -123,8 +119,7 @@ handle_db_event(DbName, deleted, _St) ->
123119
"enable_database_recovery", false),
124120
case RecoveryEnabled of
125121
true ->
126-
clouseau_rpc:close_lru(DbName),
127-
gen_server:cast(?MODULE, {rename, DbName});
122+
clouseau_rpc:soft_delete(DbName);
128123
false ->
129124
gen_server:cast(?MODULE, {cleanup, DbName})
130125
end,

0 commit comments

Comments
 (0)