linagora / james-project

Mirror of Apache James Project
Apache License 2.0
70 stars 63 forks source link

[Cassandra] blob_cache table is supposed to be on a separate cache keyspace on Cassandra #5082

Closed Arsnael closed 5 months ago

Arsnael commented 6 months ago

After discussing with @ducnm0711 and checking around, it seems on all our environments the blob_cache table is present in the main keyspace, and not in the cache keyspace one. The cache keyspace has been created but looks empty.

According to the related ADR: https://github.com/apache/james-project/blob/master/src/adr/0025-cassandra-blob-store-cache.md

The cache should be implemented as a key-value table on a dedicated 'cache' keyspace, with a replication factor of 1, and be queried with a consistency level of ONE.

Need to check the code and fix this.

ducnm0711 commented 6 months ago

Blob keyspace is configuration when setup but not picked up, blob_cache table get created in main keyspaces. This issue happened in all current env

### ENV1 ###
# cat cassandra.properties
cassandra.nodes=${env:TMAIL_CASSANDRA_NODES_URLS}
cassandra.local.dc=DC1
cassandra.keyspace.create=true
cassandra.keyspace=tmail
cassandra.keyspace.cache=tmail_cache

# du -sh tmail/
19G     tmail/

###### ENV2 ######
$ cat cassandra.properties
# Configuration file for cassandra mailbox
# http://james.apache.org/server/config-cassandra.html
cassandra.nodes=${env:OP_JAMES_CASSANDRA_NODES_URLS}
cassandra.local.dc=DC1
cassandra.keyspace.create=true
cassandra.keyspace=${env:OP_JAMES_CASSANDRA_KEYSPACE}
cassandra.keyspace.cache=james_cache

# du -sh james/
27G     james/
# du -sh james_cache/
16K     james_cache/
ducnm0711 commented 6 months ago

Table created in main keyspace

Connected to tmail at ****
[cqlsh 6.1.0 | Cassandra 4.1.3 | CQL spec 3.4.6 | Native protocol v5]
Use HELP for help.
admin@cqlsh> DESCRIBE KEYSPACE tmail_cache ;

admin@cqlsh> DESCRIBE TABLE tmail.blob_cache ;

CREATE TABLE tmail.blob_cache (
    id text PRIMARY KEY,
    data blob
) 
###### ENV2 ######
james@cqlsh> DESCRIBE TABLE james.blob_cache ;

CREATE TABLE james.blob_cache (
    id text PRIMARY KEY,
    data blob
)
quantranhong1999 commented 6 months ago

Table created in main keyspace

Bear in mind this is a public ticket. We should not expose customer DB endpoint IMO.

Arsnael commented 6 months ago

Bear in mind this is a public ticket. We should not expose customer DB endpoint IMO.

Updated

chibenwa commented 6 months ago

My shot at this https://github.com/apache/james-project/pull/2060