Skip to content

Commit

Permalink
SDK reader improper error removal
Browse files Browse the repository at this point in the history
  • Loading branch information
ajantha-bhat committed Jul 26, 2018
1 parent 4158bcd commit b3c22d5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,19 @@ public void clearInvalidSegments(CarbonTable carbonTable, List<Segment> segments
*/
public void clearDataMaps(AbsoluteTableIdentifier identifier) {
CarbonTable carbonTable = getCarbonTable(identifier);
clearDataMaps(carbonTable);
}

/**
* Clear the datamap/datamaps of a table from memory
*
* @param carbonTable carbonTable
*/
public void clearDataMaps(CarbonTable carbonTable) {
AbsoluteTableIdentifier identifier = carbonTable.getAbsoluteTableIdentifier();
String tableUniqueName = identifier.getCarbonTableIdentifier().getTableUniqueName();
List<TableDataMap> tableIndices = allDataMaps.get(tableUniqueName);
if (null != carbonTable && tableIndices != null) {
if (tableIndices != null) {
try {
DataMapUtil.executeDataMapJobForClearingDataMaps(carbonTable);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ public void initialize(InputSplit inputSplit, TaskAttemptContext context)
}
if (!skipClearDataMapAtClose) {
// Clear the datamap cache
DataMapStoreManager.getInstance().clearDataMaps(
queryModel.getTable().getAbsoluteTableIdentifier());
DataMapStoreManager.getInstance().clearDataMaps(queryModel.getTable());
}
// close read support
readSupport.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public CarbonTableCacheModel getCarbonCache(SchemaTableName table) {

private void removeTableFromCache(SchemaTableName table) {
DataMapStoreManager.getInstance()
.clearDataMaps(carbonCache.get().get(table).carbonTable.getAbsoluteTableIdentifier());
.clearDataMaps(carbonCache.get().get(table).carbonTable);
carbonCache.get().remove(table);
tableList.remove(table);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public <T> CarbonReader<T> build() throws IOException, InterruptedException {
} catch (Exception ex) {
// Clear the datamap cache as it can get added in getSplits() method
DataMapStoreManager.getInstance()
.clearDataMaps(table.getAbsoluteTableIdentifier());
.clearDataMaps(table);
throw ex;
}
}
Expand Down

0 comments on commit b3c22d5

Please sign in to comment.