Repository: incubator-ranger Updated Branches: refs/heads/master 818e1d354 -> 89136413e
RANGER-1156:Audit migration script from DB to Solr cloud failing Signed-off-by: sneethiraj <sneet...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/89136413 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/89136413 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/89136413 Branch: refs/heads/master Commit: 89136413ee589b9b63a83ea8f61402a533a8f621 Parents: 818e1d3 Author: pradeep agrawal <pradeep.agra...@freestoneinfotech.com> Authored: Fri Aug 19 19:04:22 2016 +0530 Committer: sneethiraj <sneet...@apache.org> Committed: Fri Aug 19 11:03:27 2016 -0400 ---------------------------------------------------------------------- .../ranger/patch/cliutil/DbToSolrMigrationUtil.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/89136413/security-admin/src/main/java/org/apache/ranger/patch/cliutil/DbToSolrMigrationUtil.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/patch/cliutil/DbToSolrMigrationUtil.java b/security-admin/src/main/java/org/apache/ranger/patch/cliutil/DbToSolrMigrationUtil.java index 283f44f..f25c3f7 100644 --- a/security-admin/src/main/java/org/apache/ranger/patch/cliutil/DbToSolrMigrationUtil.java +++ b/security-admin/src/main/java/org/apache/ranger/patch/cliutil/DbToSolrMigrationUtil.java @@ -236,6 +236,15 @@ public class DbToSolrMigrationUtil extends BaseLoader { System.out.println("Total Number of Migrated Audit logs:"+totalMigratedLogs); logger.info("Total Number of Migrated Audit logs:"+totalMigratedLogs); } + if(solrClient!=null){ + try { + solrClient.close(); + } catch (IOException e) { + logger.error("Error while closing solr connection", e); + }finally{ + solrClient=null; + } + } System.out.println("Migration process finished!!"); } @@ -401,8 +410,7 @@ public class DbToSolrMigrationUtil extends BaseLoader { zkHosts); solrCloudClient .setDefaultCollection(collectionName); - solrClient = solrCloudClient; - solrCloudClient.close(); + return solrCloudClient; } catch (Exception e) { logger.fatal( "Can't connect to Solr server. ZooKeepers="