Commit 5ab19951 by Hemanth Yamijala

ATLAS-885 optimize HBaseStoreManager to avoid expensive HTable instantiation…

ATLAS-885 optimize HBaseStoreManager to avoid expensive HTable instantiation every 5 seconds (madhan.neethiraj via yhemanth)
parent 94a8db33
...@@ -22,6 +22,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset ...@@ -22,6 +22,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags) ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
ALL CHANGES: ALL CHANGES:
ATLAS-885 optimize HBaseStoreManager to avoid expensive HTable instantiation every 5 seconds (madhan.neethiraj via yhemanth)
ATLAS-878 UI: Not showing details of SD, DB and COLUMNS (saqeeb.s via shwethags) ATLAS-878 UI: Not showing details of SD, DB and COLUMNS (saqeeb.s via shwethags)
ATLAS-853 User's name to be mentioned in the top user drop down (saqeeb.s via shwethags) ATLAS-853 User's name to be mentioned in the top user drop down (saqeeb.s via shwethags)
ATLAS-867 Excessive logs: default log level should be set to 'info'; currently it is 'debug' (svimal2106 via sumasai ) ATLAS-867 Excessive logs: default log level should be set to 'info'; currently it is 'debug' (svimal2106 via sumasai )
......
...@@ -347,6 +347,11 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol ...@@ -347,6 +347,11 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
@Override @Override
public Deployment getDeployment() { public Deployment getDeployment() {
return Deployment.REMOTE;
/* If just one of the regions for titan table is in the localhost,
* this method returns Deployment.LOCAL - which does not sound right.
*
List<KeyRange> local; List<KeyRange> local;
try { try {
local = getLocalKeyPartition(); local = getLocalKeyPartition();
...@@ -355,6 +360,8 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol ...@@ -355,6 +360,8 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
// propagating StorageException might be a better approach // propagating StorageException might be a better approach
throw new RuntimeException(e); throw new RuntimeException(e);
} }
*
*/
} }
@Override @Override
...@@ -506,14 +513,16 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol ...@@ -506,14 +513,16 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
List<KeyRange> result = new LinkedList<KeyRange>(); List<KeyRange> result = new LinkedList<KeyRange>();
HTable table = null; TableMask table = null;
try { try {
ensureTableExists(tableName, getCfNameForStoreName(GraphDatabaseConfiguration.SYSTEM_PROPERTIES_STORE_NAME), 0); ensureTableExists(tableName, getCfNameForStoreName(GraphDatabaseConfiguration.SYSTEM_PROPERTIES_STORE_NAME), 0);
table = new HTable(hconf, tableName); table = cnx.getTable(tableName);
HTable hTable = (HTable)table.getTableObject();
Map<KeyRange, ServerName> normed = Map<KeyRange, ServerName> normed =
normalizeKeyBounds(table.getRegionLocations()); normalizeKeyBounds(hTable.getRegionLocations());
for (Map.Entry<KeyRange, ServerName> e : normed.entrySet()) { for (Map.Entry<KeyRange, ServerName> e : normed.entrySet()) {
if (NetworkUtil.isLocalConnection(e.getValue().getHostname())) { if (NetworkUtil.isLocalConnection(e.getValue().getHostname())) {
......
...@@ -57,4 +57,9 @@ public class HTable0_98 implements TableMask ...@@ -57,4 +57,9 @@ public class HTable0_98 implements TableMask
{ {
table.close(); table.close();
} }
@Override
public Object getTableObject() {
return table;
}
} }
...@@ -57,4 +57,9 @@ public class HTable1_0 implements TableMask ...@@ -57,4 +57,9 @@ public class HTable1_0 implements TableMask
{ {
table.close(); table.close();
} }
@Override
public Object getTableObject() {
return table;
}
} }
...@@ -37,4 +37,5 @@ public interface TableMask extends Closeable ...@@ -37,4 +37,5 @@ public interface TableMask extends Closeable
void batch(List<Row> writes, Object[] results) throws IOException, InterruptedException; void batch(List<Row> writes, Object[] results) throws IOException, InterruptedException;
Object getTableObject();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment