You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/11/17 23:05:28 UTC
[33/39] usergrid git commit: Added retries for timeouts in unique
index cleanup
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/1.x
Commit: 91b5ab2323837443c6628f644c52a1e67f2bb074
Parents: b141565
Author: George Reyes <gr...@apache.org>
Authored: Thu Nov 12 11:12:34 2015 -0800
Committer: George Reyes <gr...@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;
}