You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/03/23 16:17:26 UTC

[GitHub] [couchdb] davisp commented on a change in pull request #2707: Set DbPrefix with value allocated by erlfdb_hca

davisp 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_r396576000
 
 

 ##########
 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:
   That's the correct approach. The directory prefix thing is just defined there because its for layer coordination. We just need to create our own subspace like `DB_HCA` as mentioned and all HCA operations just take that key as a parameter if memory serves.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services