usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject usergrid git commit: Removed repair, and added in stack trace in case of exceptions.
Date Wed, 09 Dec 2015 18:36:49 GMT
Repository: usergrid
Updated Branches:
  refs/heads/unique_index_logging 51cf21c08 -> ea3c5c575


Removed repair, and added in stack trace in case of exceptions.


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

Branch: refs/heads/unique_index_logging
Commit: ea3c5c575c5d24b771d98f8b915f8fdabc8afb51
Parents: 51cf21c
Author: George Reyes <grey@apache.org>
Authored: Wed Dec 9 10:36:44 2015 -0800
Committer: George Reyes <grey@apache.org>
Committed: Wed Dec 9 10:36:44 2015 -0800

----------------------------------------------------------------------
 .../usergrid/tools/ManagementUserAudit.java     | 119 ++++++++++---------
 1 file changed, 62 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/ea3c5c57/stack/tools/src/main/java/org/apache/usergrid/tools/ManagementUserAudit.java
----------------------------------------------------------------------
diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/ManagementUserAudit.java
b/stack/tools/src/main/java/org/apache/usergrid/tools/ManagementUserAudit.java
index 4d3a876..a84e378 100644
--- a/stack/tools/src/main/java/org/apache/usergrid/tools/ManagementUserAudit.java
+++ b/stack/tools/src/main/java/org/apache/usergrid/tools/ManagementUserAudit.java
@@ -207,7 +207,7 @@ public class ManagementUserAudit extends ToolBase {
                 }
             }
         }
-        logger.info( "Completed logging successfully" );
+        logger.debug( "Completed logging successfully" );
     }
 
 
@@ -249,8 +249,13 @@ public class ManagementUserAudit extends ToolBase {
 
     private void entityUUIDDelete( final String uniqueValue, final List<HColumn<ByteBuffer,
ByteBuffer>> cols ) throws Exception {
 
-
-        UserInfo userInfo = managementService.getAdminUserByEmail( uniqueValue );
+        UserInfo userInfo = null;
+        try {
+            userInfo = managementService.getAdminUserByEmail( uniqueValue );
+        }catch(Exception e){
+            logger.error("threw exception when looking up email: {}",uniqueValue);
+            e.printStackTrace();
+        }
         if(userInfo==null) {
             if(cols!=null){
                 if(cols.size()>1){
@@ -260,60 +265,60 @@ public class ManagementUserAudit extends ToolBase {
 
                 }
                 if(cols.size()==1){
-                    logger.error( "Management user with uuid: {} and email: {} is broken.
Starting Repair.",ue.fromByteBuffer( cols.get( 0 ).getName()), uniqueValue );
-                    EntityManager em = emf.getEntityManager( CassandraService.MANAGEMENT_APPLICATION_ID
);
-                    EntityRef entity = em.getUserByIdentifier( Identifier.fromEmail(uniqueValue)
);
-                    if(entity == null){
-                        entity = em.getUserByIdentifier(Identifier.fromName(uniqueValue));
-                    }
-                    if(entity == null){
-                        logger.error("Entity id parameter {} with {} value does not exist",
"email", uniqueValue);
-                        return;
-                        //throw new IllegalArgumentException("Entity not found.");
-                    }
-
-                    Map<String, Object> properties = new HashMap<String, Object>();
-                    properties.put("email", uniqueValue);
-                    properties.put("username", uniqueValue);
-                    properties.put("name", uniqueValue);
-                    properties.put("uuid", entity.getUuid());
-                    properties.put("confirmed", true);
-                    properties.put("activated", true);
-
-
-
-                    // Re-create the user entity with the existing UUID found in the index
-                    em.create(entity.getUuid(), User.ENTITY_TYPE, properties );
-                    logger.debug( "Repair Finished.Verifying Fix." );
-                    userInfo = managementService.getAdminUserByEmail( uniqueValue );
-                    if(userInfo==null){
-                        logger.error("Repair failed for uuid: {} and email {}", ue.fromByteBuffer(
cols.get( 0 ).getName()),uniqueValue );
-                    }
-                    if(!userInfo.getUuid().equals(cols.get( 0 ).getName())){
-                        Object[] loggerObjects = new Object[3];
-                        loggerObjects[0] = uniqueValue;
-                        loggerObjects[1] = ue.fromByteBuffer( cols.get( 0 ).getName());
-                        loggerObjects[2] = userInfo.getUuid();
-                        logger.error("Repair associated a new uuid for email {}. It should
have been uuid: {} but is instead uuid: {}", loggerObjects );
-                    }
-
-                    if(!userInfo.getUsername().equals( uniqueValue )){
-                        Object[] loggerObjects = new Object[3];
-                        loggerObjects[0] = uniqueValue;
-                        loggerObjects[1] = uniqueValue;
-                        loggerObjects[2] = uniqueValue;
-                        logger.error("Repair associated a new username for email {}. It should
have been username: {} but is instead username: {}", loggerObjects );
-                    }
-
-                    if(!userInfo.getEmail().equals( uniqueValue )){
-                        Object[] loggerObjects = new Object[3];
-                        loggerObjects[0] = uniqueValue;
-                        loggerObjects[1] = uniqueValue;
-                        loggerObjects[2] = uniqueValue;
-                        logger.error("Repair associated a new email for email {}. It should
have been email: {} but is instead email: {}", loggerObjects );
-                    }
-
-                    logger.debug("Repair succeeded for uuid: {} and email {}", ue.fromByteBuffer(
cols.get( 0 ).getName()),uniqueValue );
+                    logger.error( "Management user with uuid: {} and email: {} is broken.",ue.fromByteBuffer(
cols.get( 0 ).getName()), uniqueValue );
+//                    EntityManager em = emf.getEntityManager( CassandraService.MANAGEMENT_APPLICATION_ID
);
+//                    EntityRef entity = em.getUserByIdentifier( Identifier.fromEmail(uniqueValue)
);
+//                    if(entity == null){
+//                        entity = em.getUserByIdentifier(Identifier.fromName(uniqueValue));
+//                    }
+//                    if(entity == null){
+//                        logger.error("Entity id parameter {} with {} value does not exist",
"email", uniqueValue);
+//                        return;
+//                        //throw new IllegalArgumentException("Entity not found.");
+//                    }
+//
+//                    Map<String, Object> properties = new HashMap<String, Object>();
+//                    properties.put("email", uniqueValue);
+//                    properties.put("username", uniqueValue);
+//                    properties.put("name", uniqueValue);
+//                    properties.put("uuid", entity.getUuid());
+//                    properties.put("confirmed", true);
+//                    properties.put("activated", true);
+//
+//
+//
+//                    // Re-create the user entity with the existing UUID found in the index
+//                    em.create(entity.getUuid(), User.ENTITY_TYPE, properties );
+//                    logger.debug( "Repair Finished.Verifying Fix." );
+//                    userInfo = managementService.getAdminUserByEmail( uniqueValue );
+//                    if(userInfo==null){
+//                        logger.error("Repair failed for uuid: {} and email {}", ue.fromByteBuffer(
cols.get( 0 ).getName()),uniqueValue );
+//                    }
+//                    if(!userInfo.getUuid().equals(cols.get( 0 ).getName())){
+//                        Object[] loggerObjects = new Object[3];
+//                        loggerObjects[0] = uniqueValue;
+//                        loggerObjects[1] = ue.fromByteBuffer( cols.get( 0 ).getName());
+//                        loggerObjects[2] = userInfo.getUuid();
+//                        logger.error("Repair associated a new uuid for email {}. It should
have been uuid: {} but is instead uuid: {}", loggerObjects );
+//                    }
+//
+//                    if(!userInfo.getUsername().equals( uniqueValue )){
+//                        Object[] loggerObjects = new Object[3];
+//                        loggerObjects[0] = uniqueValue;
+//                        loggerObjects[1] = uniqueValue;
+//                        loggerObjects[2] = uniqueValue;
+//                        logger.error("Repair associated a new username for email {}. It
should have been username: {} but is instead username: {}", loggerObjects );
+//                    }
+//
+//                    if(!userInfo.getEmail().equals( uniqueValue )){
+//                        Object[] loggerObjects = new Object[3];
+//                        loggerObjects[0] = uniqueValue;
+//                        loggerObjects[1] = uniqueValue;
+//                        loggerObjects[2] = uniqueValue;
+//                        logger.error("Repair associated a new email for email {}. It should
have been email: {} but is instead email: {}", loggerObjects );
+//                    }
+//
+//                    logger.debug("Repair succeeded for uuid: {} and email {}", ue.fromByteBuffer(
cols.get( 0 ).getName()),uniqueValue );
 
 
                 }


Mime
View raw message