This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/main by this push:
new f519c1b1f Handle a just deleted db in auto-purge plugin
f519c1b1f is described below
commit f519c1b1f378d101a9d2414d723a54bda577697e
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Wed Mar 11 17:36:51 2026 -0400
Handle a just deleted db in auto-purge plugin
Noticed this in production logs:
```
database_does_not_exist at mem3_shards:load_from_db/1(line:463)
<= mem3_shards:load_opts_from_disk/1(line:436)
<= mem3:props/1(line:122)
<= fabric_auto_purge:get/1(line:22)
<= couch_auto_purge_plugin:ttl/2(line:195)
<= couch_auto_purge_plugin:db/2(line:66)
```
The plugin crashes and resumes from the checkpoint and makes further
progress,
but since this is an expected case it might be a bit nicer to anticipate and
handle it cleaner.
---
src/couch/src/couch_auto_purge_plugin.erl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/couch/src/couch_auto_purge_plugin.erl
b/src/couch/src/couch_auto_purge_plugin.erl
index 5589be244..1f7713eaa 100644
--- a/src/couch/src/couch_auto_purge_plugin.erl
+++ b/src/couch/src/couch_auto_purge_plugin.erl
@@ -63,11 +63,14 @@ checkpoint(St) ->
end.
db(St, DbName) ->
- case ttl(St, DbName) of
+ try ttl(St, DbName) of
TTL when is_integer(TTL) ->
{ok, St#{ttl => TTL}};
undefined ->
{skip, St}
+ catch
+ error:database_does_not_exist ->
+ {skip, St}
end.
db_opened(#{} = St, Db) ->