usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject usergrid git commit: Added retries for timeouts in unique index cleanup
Date Thu, 12 Nov 2015 19:12:36 GMT
Repository: usergrid
Updated Branches:
  refs/heads/readRepairForIndexValues b141565e3 -> 91b5ab232


Added retries for timeouts in unique index cleanup


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/91b5ab23
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/91b5ab23
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/91b5ab23

Branch: refs/heads/readRepairForIndexValues
Commit: 91b5ab2323837443c6628f644c52a1e67f2bb074
Parents: b141565
Author: George Reyes <grey@apache.org>
Authored: Thu Nov 12 11:12:34 2015 -0800
Committer: George Reyes <grey@apache.org>
Committed: Thu Nov 12 11:12:34 2015 -0800

----------------------------------------------------------------------
 .../usergrid/tools/UniqueIndexCleanup.java      | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/91b5ab23/stack/tools/src/main/java/org/apache/usergrid/tools/UniqueIndexCleanup.java
----------------------------------------------------------------------
diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/UniqueIndexCleanup.java b/stack/tools/src/main/java/org/apache/usergrid/tools/UniqueIndexCleanup.java
index 7c1fadd..64b634c 100644
--- a/stack/tools/src/main/java/org/apache/usergrid/tools/UniqueIndexCleanup.java
+++ b/stack/tools/src/main/java/org/apache/usergrid/tools/UniqueIndexCleanup.java
@@ -25,6 +25,7 @@ import java.util.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.cassandra.thrift.TimedOutException;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionBuilder;
@@ -282,6 +283,7 @@ public class UniqueIndexCleanup extends ToolBase {
         //these columns all come from the same row key, which means they each belong to the
same row key identifier
         //thus mixing and matching them in the below if cases won't matter.
         Entity[] entities = new Entity[cols.size()];
+        int numberOfRetrys = 5;
 
         if(cols.size() < 2){
             entities = new Entity[2];
@@ -293,8 +295,15 @@ public class UniqueIndexCleanup extends ToolBase {
             UUID entityId = ue.fromByteBuffer( col.getName() );
 
             if ( applicationId.equals( MANAGEMENT_APPLICATION_ID ) ) {
+                for(int i = 0; i<numberOfRetrys; i++){
+                    try {
+                        entities[index] = managementService.getAdminUserEntityByUuid( entityId
);
+                        break;
+                    }catch(TimedOutException toe){
+                        Thread.sleep( 2000 );
+                    }
+                }
 
-                entities[index] = managementService.getAdminUserEntityByUuid( entityId );
                 if ( entities[index] == null ) {
                     cleanup = true;
                 }
@@ -303,7 +312,15 @@ public class UniqueIndexCleanup extends ToolBase {
                 }
             }
             else {
-                entities[index] = em.get( entityId );
+
+                for(int i = 0; i<numberOfRetrys; i++){
+                    try {
+                        entities[index] = em.get( entityId );
+                        break;
+                    }catch(TimedOutException toe){
+                        Thread.sleep( 2000 );
+                    }
+                }
                 if ( entities[index] == null ) {
                     cleanup = true;
                 }


Mime
View raw message