You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by "hungphan227 (via GitHub)" <gi...@apache.org> on 2023/12/15 04:27:56 UTC

[PR] JAMES-2586 ADR for Posgres mailbox tables structure [james-project]

hungphan227 opened a new pull request, #1857:
URL: https://github.com/apache/james-project/pull/1857

   (no comment)


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] JAMES-2586 ADR for Posgres mailbox tables structure [james-project]

Posted by "hungphan227 (via GitHub)" <gi...@apache.org>.
hungphan227 commented on code in PR #1857:
URL: https://github.com/apache/james-project/pull/1857#discussion_r1429567299


##########
src/adr/0071-postgresql-mailbox-tables-structure.md:
##########
@@ -0,0 +1,44 @@
+# 71.  Postgresql Mailbox tables structure
+
+Date: 2023-12-14
+
+## Status
+
+Implemented
+
+## Context
+
+Apache James was integrated with Postgresql database. The table structure for mailbox was created to store mailbox data in Postgresql database.
+
+## Decision
+
+![diagram for mailbox tables](img/adr-71-mailbox-table-diagram.png)
+
+Indexes in table message_mailbox: 
+- message_mailbox_message_id_index (message_id)
+- mailbox_id_mail_uid_index (mailbox_id, message_uid)
+- mailbox_id_is_seen_mail_uid_index (mailbox_id, is_seen, message_uid)
+- mailbox_id_is_recent_mail_uid_index (mailbox_id, is_recent, message_uid)
+- mailbox_id_is_delete_mail_uid_index (mailbox_id, is_deleted, message_uid)
+
+Indexes are used to find records faster
+
+For some fields, hstore data type are used. Hstore is key-value hashmap data structure. It is useful in some cases. For example, the database needs to store a list of usernames and corresponding rights for a mailbox. By applying hstore, acl that belongs to a specific mailbox and username could be retrieved quickly.
+

Review Comment:
   fixed



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] JAMES-2586 ADR for Posgres mailbox tables structure [james-project]

Posted by "hungphan227 (via GitHub)" <gi...@apache.org>.
hungphan227 commented on code in PR #1857:
URL: https://github.com/apache/james-project/pull/1857#discussion_r1429567122


##########
src/adr/0071-postgresql-mailbox-tables-structure.md:
##########
@@ -0,0 +1,44 @@
+# 71.  Postgresql Mailbox tables structure
+
+Date: 2023-12-14
+
+## Status
+
+Implemented
+
+## Context
+
+Apache James was integrated with Postgresql database. The table structure for mailbox was created to store mailbox data in Postgresql database.
+
+## Decision
+
+![diagram for mailbox tables](img/adr-71-mailbox-table-diagram.png)
+
+Indexes in table message_mailbox: 
+- message_mailbox_message_id_index (message_id)
+- mailbox_id_mail_uid_index (mailbox_id, message_uid)
+- mailbox_id_is_seen_mail_uid_index (mailbox_id, is_seen, message_uid)
+- mailbox_id_is_recent_mail_uid_index (mailbox_id, is_recent, message_uid)
+- mailbox_id_is_delete_mail_uid_index (mailbox_id, is_deleted, message_uid)
+
+Indexes are used to find records faster
+
+For some fields, hstore data type are used. Hstore is key-value hashmap data structure. It is useful in some cases. For example, the database needs to store a list of usernames and corresponding rights for a mailbox. By applying hstore, acl that belongs to a specific mailbox and username could be retrieved quickly.

Review Comment:
   fixed



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] JAMES-2586 ADR for Posgres mailbox tables structure [james-project]

Posted by "hungphan227 (via GitHub)" <gi...@apache.org>.
hungphan227 commented on code in PR #1857:
URL: https://github.com/apache/james-project/pull/1857#discussion_r1429566731


##########
src/adr/0071-postgresql-mailbox-tables-structure.md:
##########
@@ -0,0 +1,44 @@
+# 71.  Postgresql Mailbox tables structure
+
+Date: 2023-12-14
+
+## Status
+
+Implemented
+
+## Context
+
+Apache James was integrated with Postgresql database. The table structure for mailbox was created to store mailbox data in Postgresql database.
+
+## Decision
+
+![diagram for mailbox tables](img/adr-71-mailbox-table-diagram.png)

Review Comment:
   fixed



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] JAMES-2586 ADR for Posgres mailbox tables structure [james-project]

Posted by "chibenwa (via GitHub)" <gi...@apache.org>.
chibenwa commented on code in PR #1857:
URL: https://github.com/apache/james-project/pull/1857#discussion_r1427635982


##########
src/adr/0071-postgresql-mailbox-tables-structure.md:
##########
@@ -0,0 +1,44 @@
+# 71.  Postgresql Mailbox tables structure
+
+Date: 2023-12-14
+
+## Status
+
+Implemented
+
+## Context
+
+Apache James was integrated with Postgresql database. The table structure for mailbox was created to store mailbox data in Postgresql database.
+
+## Decision
+
+![diagram for mailbox tables](img/adr-71-mailbox-table-diagram.png)
+
+Indexes in table message_mailbox: 
+- message_mailbox_message_id_index (message_id)
+- mailbox_id_mail_uid_index (mailbox_id, message_uid)
+- mailbox_id_is_seen_mail_uid_index (mailbox_id, is_seen, message_uid)
+- mailbox_id_is_recent_mail_uid_index (mailbox_id, is_recent, message_uid)
+- mailbox_id_is_delete_mail_uid_index (mailbox_id, is_deleted, message_uid)
+
+Indexes are used to find records faster
+
+For some fields, hstore data type are used. Hstore is key-value hashmap data structure. It is useful in some cases. For example, the database needs to store a list of usernames and corresponding rights for a mailbox. By applying hstore, acl that belongs to a specific mailbox and username could be retrieved quickly.

Review Comment:
   Why do we use hstore?
   
   A: this postgres specific datatypes allows us to model complex data types without the need for complex joins.



##########
src/adr/0071-postgresql-mailbox-tables-structure.md:
##########
@@ -0,0 +1,44 @@
+# 71.  Postgresql Mailbox tables structure
+
+Date: 2023-12-14
+
+## Status
+
+Implemented
+
+## Context
+
+Apache James was integrated with Postgresql database. The table structure for mailbox was created to store mailbox data in Postgresql database.
+
+## Decision
+
+![diagram for mailbox tables](img/adr-71-mailbox-table-diagram.png)

Review Comment:
   The diagram is nice but it do not replace plain english with a table list.
   
   We are missing annotations on it, annotations is part of the mailbox.
   
   I would also like to have the word **normalized** explicitly mentionned: our table structure is mostly normalized which mitigates storage costs and ease achiving consistency. Indexes are used for key query in order to improve performance.
   
   Also have a word about constraintd



##########
src/adr/0071-postgresql-mailbox-tables-structure.md:
##########
@@ -0,0 +1,44 @@
+# 71.  Postgresql Mailbox tables structure
+
+Date: 2023-12-14
+
+## Status
+
+Implemented
+
+## Context
+
+Apache James was integrated with Postgresql database. The table structure for mailbox was created to store mailbox data in Postgresql database.

Review Comment:
   Why Past tense?
   
   I propose: 
   
   ```
   As described in [ADR-70](link), we are willing to provide a Postgres implementation for Apache James. 
   The current document is willing to detail the inner working of the mailbox of the target implementation.
   ```



##########
src/adr/0071-postgresql-mailbox-tables-structure.md:
##########
@@ -0,0 +1,44 @@
+# 71.  Postgresql Mailbox tables structure
+
+Date: 2023-12-14
+
+## Status
+
+Implemented
+
+## Context
+
+Apache James was integrated with Postgresql database. The table structure for mailbox was created to store mailbox data in Postgresql database.
+
+## Decision
+
+![diagram for mailbox tables](img/adr-71-mailbox-table-diagram.png)
+
+Indexes in table message_mailbox: 
+- message_mailbox_message_id_index (message_id)
+- mailbox_id_mail_uid_index (mailbox_id, message_uid)
+- mailbox_id_is_seen_mail_uid_index (mailbox_id, is_seen, message_uid)
+- mailbox_id_is_recent_mail_uid_index (mailbox_id, is_recent, message_uid)
+- mailbox_id_is_delete_mail_uid_index (mailbox_id, is_deleted, message_uid)
+
+Indexes are used to find records faster
+
+For some fields, hstore data type are used. Hstore is key-value hashmap data structure. It is useful in some cases. For example, the database needs to store a list of usernames and corresponding rights for a mailbox. By applying hstore, acl that belongs to a specific mailbox and username could be retrieved quickly.
+

Review Comment:
   I would like a word on consistency: Using specific postgres construct like returning or conflict management we are providing a consistent mailbox implementation without the need to rely on transaction thus with limited need to trade performance for consistency.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] JAMES-2586 ADR for Posgres mailbox tables structure [james-project]

Posted by "chibenwa (via GitHub)" <gi...@apache.org>.
chibenwa merged PR #1857:
URL: https://github.com/apache/james-project/pull/1857


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] JAMES-2586 ADR for Posgres mailbox tables structure [james-project]

Posted by "quantranhong1999 (via GitHub)" <gi...@apache.org>.
quantranhong1999 commented on code in PR #1857:
URL: https://github.com/apache/james-project/pull/1857#discussion_r1429602334


##########
src/adr/0071-postgresql-mailbox-tables-structure.md:
##########
@@ -0,0 +1,58 @@
+# 71.  Postgresql Mailbox tables structure
+
+Date: 2023-12-14
+
+## Status
+
+Implemented
+
+## Context
+
+As described in [ADR-70](link), we are willing to provide a Postgres implementation for Apache James.
+The current document is willing to detail the inner working of the mailbox of the target implementation.
+
+## Decision
+
+![diagram for mailbox tables](img/adr-71-mailbox-tables-diagram.png)
+
+Table list:
+- mailbox
+- mailbox_annotations
+- message
+- message_mailbox
+- subscription
+
+Indexes in table message_mailbox: 
+- message_mailbox_message_id_index (message_id)
+- mailbox_id_mail_uid_index (mailbox_id, message_uid)
+- mailbox_id_is_seen_mail_uid_index (mailbox_id, is_seen, message_uid)
+- mailbox_id_is_recent_mail_uid_index (mailbox_id, is_recent, message_uid)
+- mailbox_id_is_delete_mail_uid_index (mailbox_id, is_deleted, message_uid)
+
+Indexes are used to find records faster
+
+The table structure is mostly normalized which mitigates storage costs and achieve consistency easily

Review Comment:
   ```suggestion
   The table structure is mostly normalized which mitigates storage costs and achieves consistency easily.
   ```



##########
src/adr/0071-postgresql-mailbox-tables-structure.md:
##########
@@ -0,0 +1,58 @@
+# 71.  Postgresql Mailbox tables structure
+
+Date: 2023-12-14
+
+## Status
+
+Implemented
+
+## Context
+
+As described in [ADR-70](link), we are willing to provide a Postgres implementation for Apache James.
+The current document is willing to detail the inner working of the mailbox of the target implementation.
+
+## Decision
+
+![diagram for mailbox tables](img/adr-71-mailbox-tables-diagram.png)
+
+Table list:
+- mailbox
+- mailbox_annotations
+- message
+- message_mailbox
+- subscription
+
+Indexes in table message_mailbox: 
+- message_mailbox_message_id_index (message_id)
+- mailbox_id_mail_uid_index (mailbox_id, message_uid)
+- mailbox_id_is_seen_mail_uid_index (mailbox_id, is_seen, message_uid)
+- mailbox_id_is_recent_mail_uid_index (mailbox_id, is_recent, message_uid)
+- mailbox_id_is_delete_mail_uid_index (mailbox_id, is_deleted, message_uid)
+
+Indexes are used to find records faster

Review Comment:
   ```suggestion
   Indexes are used to find records faster.
   ```



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] JAMES-2586 ADR for Posgres mailbox tables structure [james-project]

Posted by "hungphan227 (via GitHub)" <gi...@apache.org>.
hungphan227 commented on code in PR #1857:
URL: https://github.com/apache/james-project/pull/1857#discussion_r1429566601


##########
src/adr/0071-postgresql-mailbox-tables-structure.md:
##########
@@ -0,0 +1,44 @@
+# 71.  Postgresql Mailbox tables structure
+
+Date: 2023-12-14
+
+## Status
+
+Implemented
+
+## Context
+
+Apache James was integrated with Postgresql database. The table structure for mailbox was created to store mailbox data in Postgresql database.

Review Comment:
   fixed



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org