quantranhong1999 commented on code in PR #993:
URL: https://github.com/apache/james-project/pull/993#discussion_r877820910


##########
server/container/guice/elasticsearch/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java:
##########
@@ -111,6 +118,16 @@ protected void configure() {
             .to(ElasticSearchStartUpCheck.class);
     }
 
+    @Provides
+    Set<SearchOverride> provideSearchOverrides(GuiceGenericLoader loader, 
ElasticSearchConfiguration configuration) {
+        return configuration.getSearchOverrides()
+            .stream()
+            .map(ClassName::new)
+            
.map(Throwing.function(loader.<SearchOverride>withNamingSheme(NamingScheme.IDENTITY)::instantiate))
+            .peek(routes -> LOGGER.info("Loading WebAdmin route extension {}", 
routes.getClass().getCanonicalName()))

Review Comment:
   Seem unrelated.



##########
server/apps/cassandra-app/sample-configuration/elasticsearch.properties:
##########
@@ -82,3 +82,24 @@ elasticsearch.http.port=9200
 elasticsearch.metrics.reports.enabled=true
 elasticsearch.metrics.reports.period=30
 elasticsearch.metrics.reports.index=james-metrics
+
+# Search overrides allow resolution of predefined search queries against 
alternative sources of data
+# and allow bypassing ElasticSearch. This is useful to handle most 
resynchronisation queries that
+# are simple enough to be resolved against Cassandra.
+#
+# Possible values are:
+#  - `org.apache.james.mailbox.cassandra.search.AllSearchOverride` Some IMAP 
clients uses SEARCH ALL to fully list messages in
+# a mailbox and detect deletions. This is typically done by clients not 
supporting QRESYNC and from am IMAP perspective

Review Comment:
   ```suggestion
   # a mailbox and detect deletions. This is typically done by clients not 
supporting QRESYNC and from an IMAP perspective
   ```



##########
server/apps/distributed-app/docs/modules/ROOT/pages/configure/elasticsearch.adoc:
##########
@@ -208,3 +208,31 @@ You can configure to use which HostNameVerifier in the 
client.
 accept_any_hostname: accept any host (not recommended).
 
 |===
+
+== Search overrides
+
+*Search overrides* allow resolution of predefined search queries against 
alternative sources of data
+and allow bypassing ElasticSearch. This is useful to handle most 
resynchronisation queries that
+are simple enough to be resolved against Cassandra.
+
+Possible values are:
+  - `org.apache.james.mailbox.cassandra.search.AllSearchOverride` Some IMAP 
clients uses SEARCH ALL to fully list messages in
+ a mailbox and detect deletions. This is typically done by clients not 
supporting QRESYNC and from am IMAP perspective

Review Comment:
   ```suggestion
    a mailbox and detect deletions. This is typically done by clients not 
supporting QRESYNC and from an IMAP perspective
   ```



##########
server/apps/distributed-app/sample-configuration/elasticsearch.properties:
##########
@@ -81,3 +81,24 @@ elasticsearch.http.port=9200
 elasticsearch.metrics.reports.enabled=true
 elasticsearch.metrics.reports.period=30
 elasticsearch.metrics.reports.index=james-metrics
+
+# Search overrides allow resolution of predefined search queries against 
alternative sources of data
+# and allow bypassing ElasticSearch. This is useful to handle most 
resynchronisation queries that
+# are simple enough to be resolved against Cassandra.
+#
+# Possible values are:
+#  - `org.apache.james.mailbox.cassandra.search.AllSearchOverride` Some IMAP 
clients uses SEARCH ALL to fully list messages in
+# a mailbox and detect deletions. This is typically done by clients not 
supporting QRESYNC and from am IMAP perspective

Review Comment:
   ```suggestion
   # a mailbox and detect deletions. This is typically done by clients not 
supporting QRESYNC and from an IMAP perspective
   ```



##########
src/adr/0054-elasticsearch-search-overrides.md:
##########
@@ -0,0 +1,76 @@
+# 54. ElasticSearch search overrides
+
+Date: 2022-05-16
+
+## Status
+
+Accepted (lazy consensus).
+
+Not yet implemented.
+
+## Context
+
+IMAP SEARCH requests can of course be used for user searches. But many 
applications (eg Samsung email client) also uses
+IMAP SEARCH for resynchronization.
+
+The use of ElasticSearch in the context of resynchronization is a problem as:
+
+ - Resynchronization incurs many requests that ElasticSearch is not made to 
cope with.
+ - This have a performance impact and some 60+ seconds can be spotted.
+ - ElasticSearch indexing is asynchronous wich is not ideal for 
resynchronization

Review Comment:
   ```suggestion
    - ElasticSearch indexing is asynchronous which is not ideal for 
resynchronization
   ```



##########
src/site/xdoc/server/config-elasticsearch.xml:
##########
@@ -289,6 +289,35 @@
             </dd>
         </dl>
     </section>
+    <section name="Search overrides">
+
+        <p><b>Search overrides</b> allow resolution of predefined search 
queries against alternative sources of data
+            and allow bypassing ElasticSearch. This is useful to handle most 
resynchronisation queries that
+            are simple enough to be resolved against Cassandra.</p>
+
+        <ul>Possible values are:<br/>
+            
<li><pre>org.apache.james.mailbox.cassandra.search.AllSearchOverride</pre> Some 
IMAP clients uses SEARCH ALL to fully list messages in
+                a mailbox and detect deletions. This is typically done by 
clients not supporting QRESYNC and from am IMAP perspective

Review Comment:
   ```suggestion
                   a mailbox and detect deletions. This is typically done by 
clients not supporting QRESYNC and from an IMAP perspective
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to