janl opened a new issue #877: Make peruser use the `/` trick to avoid ?too many 
databases in one directory? issue
URL: https://github.com/apache/couchdb/issues/877
 
 
   When you put a slash (`/`) into a database name, CouchDB will create a 
sub-directory inside of `database_dir`. This can be used to avoid issues with 
too many individual .couch files in a single directory (different file systems 
have different limitations here). This is especially relevant for peruser 
setups.
   
   couch_peruser creates databases with a prefix (`userdb-`) and the hex 
representation of the username. I suggest that if that hex representation is 
longer than two characters, we insert a `/` after the first two. Like so:
   
   `userdb-c4d3ff3` becomes `userdb-c4/d3ff3`
   
   ### Implementation note:
   
   For installations that start on the existing scheme and are upgraded to a 
CouchDB version with this feature, the couch_peruser model should include 
fallback code that can handle at least the deletion of old-style databases.
   
   In addition there should be a configuration option to disable the feature 
for installations that don?t want to migrate to the new system when they update 
their CouchDB version. There might be external systems that need updating to 
handle the `/` in URLs (as they need to be encoded as `%2[Ff]` and not all 
utility scripts might do this properly.
   
   ### Related Work
   Git uses a similar scheme for it?s objects subdirectory:
   
   ```terminal
   > ls .git/objects/
   00   14      28      3c      50      64      78      8c      a0      b4      
c8      dc      f0
   01   15      29      3d      51      65      79      8d      a1      b5      
c9      dd      f1
   02   16      2a      3e      52      66      7a      8e      a2      b6      
ca      de      f2
   03   17      2b      3f      53      67      7b      8f      a3      b7      
cb      df      f3
   04   18      2c      40      54      68      7c      90      a4      b8      
cc      e0      f4
   05   19      2d      41      55      69      7d      91      a5      b9      
cd      e1      f5
   06   1a      2e      42      56      6a      7e      92      a6      ba      
ce      e2      f6
   07   1b      2f      43      57      6b      7f      93      a7      bb      
cf      e3      f7
   08   1c      30      44      58      6c      80      94      a8      bc      
d0      e4      f8
   09   1d      31      45      59      6d      81      95      a9      bd      
d1      e5      f9
   0a   1e      32      46      5a      6e      82      96      aa      be      
d2      e6      fa
   0b   1f      33      47      5b      6f      83      97      ab      bf      
d3      e7      fb
   0c   20      34      48      5c      70      84      98      ac      c0      
d4      e8      fc
   0d   21      35      49      5d      71      85      99      ad      c1      
d5      e9      fd
   0e   22      36      4a      5e      72      86      9a      ae      c2      
d6      ea      fe
   0f   23      37      4b      5f      73      87      9b      af      c3      
d7      eb      ff
   10   24      38      4c      60      74      88      9c      b0      c4      
d8      ec      info
   11   25      39      4d      61      75      89      9d      b1      c5      
d9      ed      pack
   12   26      3a      4e      62      76      8a      9e      b2      c6      
da      ee
   13   27      3b      4f      63      77      8b      9f      b3      c7      
db      ef
   ```
   
   ```terminal
   > ls .git/objects/00/
   09488cc8dfbaa6471174a2e1d0247ee15ab89a  
9a148b4800c773504037a9231d2827b7337623
   1be12127153c2647125767e1b1a23e7aafe44a  
a393e01c85b9be4819f0c6dc43d5984fc622a4
   2bcb25013c8bae71192989b941f84b7cde3ce1  
c3d56e167a73321ce34e7241b5290cf9252478
   2cb4d33b40520d7f19d8b71e3cfffc2ace7495  
cf5f4956a9580bc5e6147816a514232c78c9dc
   41e1c9e661b37d79d8c7a308dd615460cda6fc  
df0def7fb8107717ed2274b88f855d18402a72
   53609d2bd5d62d0a1b3e16b71fdb38222d603a  
df6c5b6d68b9ac6b8d77c8fbb387c2e321be5d
   56e591f28f96abdbdfe9a272db5ad8f67be133  
e126e210d7ca642913bfa6ac457a87e0b7cca8
   68539eec28b5ceaa93c3e0279ee51fba31b14b  
e31fc275ff9100c2f52176d8fb78ac1b7af6be
   739e591a62f98df6580d2f23bb25116ef2f8bb  
e5f302a2c302b7dbc135534983cd945ed968ec
   77704dfd0f41d99a7cff6b7267a1be1da721c3  
ea24ca145464d4a314aa14b6d8533a767aa2e2
   7f5692be9eeef7fce43728c2c35c43c7a0d0b8  
f4f3ff16b100e942548a00143ab45e9e1cab40
   84f68b6d16a45574d8361c4722aaf7ef08e022  
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to