jiangphcn commented on a change in pull request #2707: Set DbPrefix with value allocated by erlfdb_hca URL: https://github.com/apache/couchdb/pull/2707#discussion_r396870210
########## File path: src/fabric/src/fabric2_fdb.erl ########## @@ -177,10 +177,13 @@ create(#{} = Db0, Options) -> layer_prefix := LayerPrefix } = Db = ensure_current(Db0, false), - % Eventually DbPrefix will be HCA allocated. For now - % we're just using the DbName so that debugging is easier. DbKey = erlfdb_tuple:pack({?ALL_DBS, DbName}, LayerPrefix), - DbPrefix = erlfdb_tuple:pack({?DBS, DbName}, LayerPrefix), + DefDbPref = ?DEFAULT_DB_PREFIX, + AllDbPrefix = erlfdb_util:get(Options, db_prefix, DefDbPref), + DbId = erlfdb_tuple:pack({AllDbPrefix}, AllDbPrefix), + DbPrefixAllocator = erlfdb_hca:create(erlfdb_tuple:pack({DbId}, <<"hca">>)), + AllocPrefix = erlfdb_hca:allocate(DbPrefixAllocator, Tx), + DbPrefix = erlfdb_tuple:pack({?DBS, AllocPrefix}, LayerPrefix), Review comment: thanks @nickva and @davisp. I simplified creation of HCA according to your suggestion. ---------------------------------------------------------------- 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 With regards, Apache Git Services