You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/05/30 07:22:22 UTC

[james-project] 11/19: MAILBOX-351 WebAdmin documentation for fixing a reIndexing

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit f98fb0b26391e3a9b3229546c521e6dbefeb28db
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri May 24 11:36:02 2019 +0700

    MAILBOX-351 WebAdmin documentation for fixing a reIndexing
---
 .../james/webadmin/routes/ReindexingRoutes.java    |  6 +--
 .../service/PreviousReIndexingService.java         |  8 +--
 src/site/markdown/server/manage-webadmin.md        | 60 ++++++++++++++++++++--
 3 files changed, 64 insertions(+), 10 deletions(-)

diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/ReindexingRoutes.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/ReindexingRoutes.java
index 083579e..c2f09d8 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/ReindexingRoutes.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/ReindexingRoutes.java
@@ -141,8 +141,8 @@ public class ReindexingRoutes implements Routes {
             return wrap(request, response, () -> reIndexer.reIndex(extractUser(request)));
         }
         if (indexingCorrection) {
-                IndexingDetailInformation indexingDetailInformation = retrieveIndexingExecutionDetails(request);
-                return wrap(request, response, () -> reIndexer.reIndex(indexingDetailInformation.failures()));
+            IndexingDetailInformation indexingDetailInformation = retrieveIndexingExecutionDetails(request);
+            return wrap(request, response, () -> reIndexer.reIndex(indexingDetailInformation.failures()));
         }
         return wrap(request, response, reIndexer::reIndex);
     }
@@ -151,7 +151,7 @@ public class ReindexingRoutes implements Routes {
         TaskId taskId = getTaskId(request);
         try {
             return previousReIndexingService.retrieveIndexingExecutionDetails(taskId);
-        } catch (PreviousReIndexingService.NotAnIndexingRetryiableTask | PreviousReIndexingService.TaskNotYetFinishedException e) {
+        } catch (PreviousReIndexingService.NotAnIndexingRetriableTask | PreviousReIndexingService.TaskNotYetFinishedException e) {
             throw ErrorResponder.builder()
                 .statusCode(HttpStatus.BAD_REQUEST_400)
                 .type(ErrorResponder.ErrorType.INVALID_ARGUMENT)
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/PreviousReIndexingService.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/PreviousReIndexingService.java
index 2df5879..9c00dea 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/PreviousReIndexingService.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/PreviousReIndexingService.java
@@ -34,8 +34,8 @@ public class PreviousReIndexingService {
         }
     }
 
-    public static class NotAnIndexingRetryiableTask extends RuntimeException {
-        NotAnIndexingRetryiableTask(String type) {
+    public static class NotAnIndexingRetriableTask extends RuntimeException {
+        NotAnIndexingRetriableTask(String type) {
             super("'" + type + "' is not a valid type of task for retrying a failed indexing");
         }
     }
@@ -47,7 +47,7 @@ public class PreviousReIndexingService {
         this.taskManager = taskManager;
     }
 
-    public IndexingDetailInformation retrieveIndexingExecutionDetails(TaskId taskId) throws NotAnIndexingRetryiableTask, TaskNotFoundException, TaskNotYetFinishedException {
+    public IndexingDetailInformation retrieveIndexingExecutionDetails(TaskId taskId) throws NotAnIndexingRetriableTask, TaskNotFoundException, TaskNotYetFinishedException {
         TaskExecutionDetails executionDetails = taskManager.getExecutionDetails(taskId);
         if (!executionDetails.getStatus().isFinished()) {
             throw new TaskNotYetFinishedException(executionDetails.getStatus());
@@ -55,6 +55,6 @@ public class PreviousReIndexingService {
         return executionDetails.getAdditionalInformation()
             .filter(additionalInformation -> additionalInformation instanceof IndexingDetailInformation)
             .map(additionalInformation -> (IndexingDetailInformation) additionalInformation)
-            .orElseThrow(() -> new NotAnIndexingRetryiableTask(executionDetails.getType()));
+            .orElseThrow(() -> new NotAnIndexingRetriableTask(executionDetails.getType()));
     }
 }
diff --git a/src/site/markdown/server/manage-webadmin.md b/src/site/markdown/server/manage-webadmin.md
index efe53b7..ea99c41 100644
--- a/src/site/markdown/server/manage-webadmin.md
+++ b/src/site/markdown/server/manage-webadmin.md
@@ -2392,7 +2392,11 @@ The scheduled task will have the following type `FullReIndexing` and the followi
 ```
 {
   "successfullyReprocessMailCount":18,
-  "failedReprocessedMailCount": 1
+  "failedReprocessedMailCount": 3,
+  "failures": {
+    "mbx1": [{"uid": 35}, {"uid": 45}],
+    "mbx2": [{"uid": 38}]
+  }
 }
 ```
 
@@ -2436,7 +2440,11 @@ The scheduled task will have the following type `userReIndexing` and the followi
 {
   "user":"bob@domain.com",
   "successfullyReprocessMailCount":18,
-  "failedReprocessedMailCount": 1
+  "failedReprocessedMailCount": 3,
+  "failures": {
+    "mbx1": [{"uid": 35}, {"uid": 45}],
+    "mbx2": [{"uid": 38}]
+  }
 }
 ```
 
@@ -2482,7 +2490,11 @@ The scheduled task will have the following type `mailboxReIndexing` and the foll
 {
   "mailboxId":"{mailboxId}",
   "successfullyReprocessMailCount":18,
-  "failedReprocessedMailCount": 1
+  "failedReprocessedMailCount": 3,
+  "failures": {
+    "mbx1": [{"uid": 35}, {"uid": 45}],
+    "mbx2": [{"uid": 38}]
+  }
 }
 ```
 
@@ -2493,6 +2505,48 @@ Warning: Canceling this task should be considered unsafe as it will leave the cu
 Warning: While we have been trying to reduce the inconsistency window to a maximum (by keeping track of ongoing events),
 concurrent changes done during the reIndexing might be ignored.
 
+### Fixing previously failed ReIndexing
+
+Given `bbdb69c9-082a-44b0-a85a-6e33e74287a5` being a taskId generated for a reIndexing tasks
+
+```
+curl -XPOST http://ip:port/mailboxes?task=reIndex&reIndexFailedMessagesOf=bbdb69c9-082a-44b0-a85a-6e33e74287a5
+```
+
+Will schedule a task for reIndexing all the mails that this task failed to reIndex.
+
+The response to that request will be the scheduled `taskId` :
+
+```
+{"taskId":"5641376-02ed-47bd-bcc7-76ff6262d92a"}
+```
+
+Positioned headers:
+
+ - Location header indicates the location of the resource associated with the scheduled task. Example:
+
+```
+Location: /tasks/3294a976-ce63-491e-bd52-1b6f465ed7a2
+```
+
+Response codes:
+
+ - 201: Success. Corresponding task id is returned.
+ - 400: Error in the request. Details can be found in the reported error.
+
+The scheduled task will have the following type `ReIndexPreviousFailures` and the following `additionalInformation`:
+
+```
+{
+  "successfullyReprocessMailCount":18,
+  "failedReprocessedMailCount": 3,
+  "failures": {
+    "mbx1": [{"uid": 35}, {"uid": 45}],
+    "mbx2": [{"uid": 38}]
+  }
+}
+```
+
 ### ReIndexing a single mail
 
 ```


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