Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
None
Description
We have the following code in couch_server
maybe_add_sys_db_callbacks(DbName, Options) when is_binary(DbName) -> maybe_add_sys_db_callbacks(?b2l(DbName), Options); maybe_add_sys_db_callbacks(DbName, Options) -> DbsDbName = config:get("mem3", "shard_db", "dbs"), NodesDbName = config:get("mem3", "node_db", "nodes"), IsReplicatorDb = DbName == config:get("replicator", "db", "_replicator") orelse path_ends_with(DbName, <<"_replicator">>), IsUsersDb = DbName ==config:get("couch_httpd_auth", "authentication_db", "_users") orelse path_ends_with(DbName, <<"_users">>), if DbName == DbsDbName -> [sys_db | Options]; DbName == NodesDbName -> [sys_db | Options]; IsReplicatorDb -> [{before_doc_update, fun couch_replicator_manager:before_doc_update/2}, {after_doc_read, fun couch_replicator_manager:after_doc_read/2}, sys_db | Options]; IsUsersDb -> [{before_doc_update, fun couch_users_db:before_doc_update/2}, {after_doc_read, fun couch_users_db:after_doc_read/2}, sys_db | Options]; true -> Options end.
Which works perfectly except if system database is clustered. So, for shared _users and _replicator the check condition will not work since shared databases ends with timestamp and full name looks as "shards/00000000-1fffffff/_users.1424979962"