chewbranca commented on a change in pull request #3366: URL: https://github.com/apache/couchdb/pull/3366#discussion_r574059642
########## File path: src/couch/src/couch_server.erl ########## @@ -860,19 +865,55 @@ get_engine_path(DbName, Engine) when is_binary(DbName), is_atom(Engine) -> end. lock(DbName, Reason) when is_binary(DbName), is_binary(Reason) -> - case ets:lookup(couch_dbs, DbName) of + case ets:lookup(couch_dbs(DbName), DbName) of [] -> - true = ets:insert(couch_dbs_locks, {DbName, Reason}), + true = ets:insert(couch_dbs_locks(DbName), {DbName, Reason}), ok; [#entry{}] -> {error, already_opened} end. unlock(DbName) when is_binary(DbName) -> - true = ets:delete(couch_dbs_locks, DbName), + true = ets:delete(couch_dbs_locks(DbName), DbName), ok. +db_updated(Db) -> + DbName = couch_db:name(Db), + gen_server:call(couch_server(DbName), {db_updated, Db}, infinity). + + +couch_server(Arg) -> + name("couch_server", Arg). + + +couch_dbs(Arg) -> + name("couch_dbs", Arg). + + +couch_dbs_pid_to_name(Arg) -> + name("couch_dbs_pid_to_name", Arg). + + +couch_dbs_locks(Arg) -> + name("couch_dbs_locks", Arg). + + +name(BaseName, DbName) when is_binary(DbName) -> + N = 1 + (erlang:crc32(DbName) rem num_servers()), Review comment: @nickva I'm having trouble finding a reference, but I've been under the impression that `timer:tc` is not to be trusted on anonymous functions in the shell and should be tested on a compiled module. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org