Menu

#10 Invalidate table descriptors if tables are added / removed

closed-fixed
EMP
middletier (2)
5
2012-03-28
2012-02-21
Patrick
No

HTableDescriptor[] tableList(HbaseSource hbaseSourceInstance) throws MasterNotRunningException {
if (tableDescriptors == null || tableDescriptorsExpired()) {
tableDescriptors = getHBaseClient(hbaseSourceInstance).listTables()
lastRefreshTs = System.currentTimeMillis()
}
return tableDescriptors
}

boolean tableDescriptorsExpired() {
if ((System.currentTimeMillis() - lastRefreshTs) > TWO_MINUTES) {
return true;
}
return false;
}

extract method #forceRefresh and call when tables are changed

Discussion

  • EMP

    EMP - 2012-02-26

    I've moved descriptors cache to ConfigHolder object as they should be cached on per HbaseSource basis. Combined with a simple time based invalidation in cache getter.

     
  • EMP

    EMP - 2012-03-28
    • assigned_to: nobody --> e-m-p
    • status: open --> open-fixed
     
  • EMP

    EMP - 2012-03-28
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.