Logging improvements and limit = 1000 for queries
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/a121f379 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/a121f379 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/a121f379 Branch: refs/heads/1.x Commit: a121f37967eafe18b796a30f171e1d9c2098454d Parents: 4c92778 Author: Dave Johnson <snoopd...@apache.org> Authored: Wed Jan 6 13:50:11 2016 -0500 Committer: Dave Johnson <snoopd...@apache.org> Committed: Wed Jan 6 13:50:11 2016 -0500 ---------------------------------------------------------------------- .../org/apache/usergrid/tools/DuplicateOrgRepair.java | 13 ++++++------- .../java/org/apache/usergrid/tools/ExportAdmins.java | 11 +++++++---- .../main/java/org/apache/usergrid/tools/ToolBase.java | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/a121f379/stack/tools/src/main/java/org/apache/usergrid/tools/DuplicateOrgRepair.java ---------------------------------------------------------------------- diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/DuplicateOrgRepair.java b/stack/tools/src/main/java/org/apache/usergrid/tools/DuplicateOrgRepair.java index a33ca0e..4363dbd 100644 --- a/stack/tools/src/main/java/org/apache/usergrid/tools/DuplicateOrgRepair.java +++ b/stack/tools/src/main/java/org/apache/usergrid/tools/DuplicateOrgRepair.java @@ -431,8 +431,6 @@ public class DuplicateOrgRepair extends ToolBase { class RepairManager implements DuplicateOrgInterface { - private boolean dryRun = true; - @Override public Observable<Org> getOrgs() throws Exception { @@ -443,15 +441,16 @@ public class DuplicateOrgRepair extends ToolBase { subscriber.onStart(); try { int count = 0; - - Query query = new Query(); - query.setLimit( MAX_ENTITY_FETCH ); - query.setResultsLevel( Results.Level.ALL_PROPERTIES ); + EntityManager em = emf.getEntityManager( CassandraService.MANAGEMENT_APPLICATION_ID ); + String queryString = "select *"; + Query query = Query.fromQL( queryString ); + query.withLimit( MAX_ENTITY_FETCH ); + Results results = em.searchCollection( em.getApplicationRef(), "groups", query ); while (results.size() > 0) { - for (Entity orgEntity : results.getList()) { + for (Entity orgEntity : results.getEntities()) { Org org = new Org( orgEntity.getUuid(), http://git-wip-us.apache.org/repos/asf/usergrid/blob/a121f379/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java ---------------------------------------------------------------------- diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java b/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java index 57d87e6..56750e4 100644 --- a/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java +++ b/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java @@ -68,11 +68,12 @@ public class ExportAdmins extends ExportingToolBase { public static final String ADMIN_USER_METADATA_PREFIX = "admin-user-metadata"; // map admin user UUID to list of organizations to which user belongs - private Map<UUID, List<Org>> userToOrgsMap = new HashMap<UUID, List<Org>>(50000); + private Map<UUID, List<Org>> userToOrgsMap = new HashMap<UUID, List<Org>>(100000); - private Map<String, UUID> orgNameToUUID = new HashMap<String, UUID>(50000); + private Map<String, UUID> orgNameToUUID = new HashMap<String, UUID>(100000); - private Set<UUID> orgsWritten = new HashSet<UUID>(50000); + private Set<UUID> orgsWritten = new HashSet<UUID>(100000); + private Set<String> orgsNamesWritten = new HashSet<String>(100000); private Set<UUID> duplicateOrgs = new HashSet<UUID>(); @@ -476,7 +477,8 @@ public class ExportAdmins extends ExportingToolBase { usersFile.writeEndArray(); usersFile.close(); - logger.info( "Exported TOTAL {} admin users and {} organizations", userCount.get(), orgsWritten.size() ); + logger.info( "Exported TOTAL {} admin users and {} organizations, org names = {}", + new Object[] { userCount.get(), orgsWritten.size(), orgsNamesWritten.size() } ); } @@ -531,6 +533,7 @@ public class ExportAdmins extends ExportingToolBase { synchronized (orgsWritten) { logger.info("Exported org {}:{}", uuid, orgs.get(uuid)); orgsWritten.add( uuid ); + orgsNamesWritten.add( orgs.get(uuid) ); } } http://git-wip-us.apache.org/repos/asf/usergrid/blob/a121f379/stack/tools/src/main/java/org/apache/usergrid/tools/ToolBase.java ---------------------------------------------------------------------- diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/ToolBase.java b/stack/tools/src/main/java/org/apache/usergrid/tools/ToolBase.java index 3c427e1..d6e4882 100644 --- a/stack/tools/src/main/java/org/apache/usergrid/tools/ToolBase.java +++ b/stack/tools/src/main/java/org/apache/usergrid/tools/ToolBase.java @@ -55,7 +55,7 @@ import static org.apache.usergrid.utils.JsonUtils.mapToFormattedJsonString; */ public abstract class ToolBase { - public static final int MAX_ENTITY_FETCH = 100; + public static final int MAX_ENTITY_FETCH = 1000; /** Verbose option: -v */ static final String VERBOSE = "v";