Multi Tenancy in Dgraph

Questions from today’s review session
Lines prefixed with ibrahim are responses by Ibrahim.

  • Namespace key prefix vs a rdf 4-tuple
    Ibrahim - This needs input from @mrjn . AFAIK, we want to do keys with namespace prefix.
  • Should we support default namespace without any prefix
    Ibrahim - There are multiple challenges with doing the. The first one is how do we delete data? If the keys are prefixed, we can do dropPrefix(namespace) and all data will be dropped. Without the prefix, it would be very difficult to find the data to drop (we can iterate over the entire db but that’s too slow)
  • Separate p-directory for each namespace prefix vs shared
    • More memory footprint as Badger needs a separate memory allocation but would a separate p-directory per namespace provide better isolation.
      Ibrahim - Agreed, multiple badger instances could lead to a lot of per-namespace overhead but the physical isolation might be useful as well. @mrjn what do you think?
  • ACLs for different namespace prefix
    • Who gets access to default namespace?
      Todo(Ibrahim) - Update this once we have clarity on ACLs
  • Could we force users to always pick a namespace?
    Ibrahim - Based on the discussion we had on 25/06/2020, the JWT token will contain information about the namespace
    • What do other DBs do/allow?
      Ibrahim- Postgres requires you to create a DB before you start using it and select the DB before you insert/read data from that DB
    • All the existing code would need an update
  • Transactions
    • Can we have a transaction across namespaces?
      Ibrahim - Not in the initial version. The initial version will have only single-namepace queries/mutations
    • Query and transactions are limited to a namespace
      ibrahim - yes, that’s correct
  • Export and import
    • Should we allow export/import of all namespaces in a single request or allow regular expressions for namespace prefix?
      Ibrahim - the initial version will support only single namespace export.
  • Would Timestamps be shared across namespaces?
    Ibrahim - No. Zero will store timestamps for each namespace.

Todo:

  • We would need a section on Sentry and Telemetry
  • Test plan