nickva commented on code in PR #5615:
URL: https://github.com/apache/couchdb/pull/5615#discussion_r2249512141
##########
src/couch_scanner/src/couch_scanner_plugin.erl:
##########
@@ -601,7 +609,7 @@ default_shards(Mod, _F, _A) when is_atom(Mod) ->
end.
default_db_opened(Mod, _F, _A) when is_atom(Mod) ->
- fun(St, _Db) -> {ok, St} end.
+ fun(St, _Db) -> {0, [], St} end.
Review Comment:
It's an option that's hard to generalize for each plugin. Plugins like the
ddoc features one, doesn't even do any shard scanning at all. Now, some
plugins may let user configure it but it should go in their own private config
section like `[$someplugin] traversal_options = ...`. Others may chose to
always traverse in a certain way, like the `find` one for example, can can
traverse changes in reverse.
The `default_db_opened(Mod, _F, _A) ->` function here is used in case
plugins to not implement the `db_opened/2` callback at all, since it's optional
callback. For optional callbacks we provide a default implementation of
traversing starting from since=0.
For toggling a plugin on and off at runtime there is an easy trick: just
disable it and re-enable it:
```erlang
config:set("couch_scanner_plugins", "couch_scanner_plugin_find", "false"),
config:set("couch_scanner_plugins", "couch_scanner_plugin_find", "true").
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]