Github user poornachandra commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/35#discussion_r100931804
  
    --- Diff: 
tephra-hbase-compat-1.1-base/src/main/java/org/apache/tephra/hbase/coprocessor/TransactionProcessor.java
 ---
    @@ -454,28 +441,39 @@ protected Filter getTransactionFilter(Transaction tx, 
ScanType type, Filter filt
         return TransactionFilters.getVisibilityFilter(tx, ttlByFamily, 
allowEmptyValues, type, filter);
       }
     
    -  private void 
initPruneState(ObserverContext<RegionCoprocessorEnvironment> c) {
    -    Configuration conf = getConfiguration(c.getEnvironment());
    -    // Configuration won't be null in TransactionProcessor but the derived 
classes might return
    -    // null if it is not available temporarily
    +  protected void initializePruneState(RegionCoprocessorEnvironment env) {
    +    Configuration conf = getConfiguration(env);
         if (conf != null) {
           pruneEnable = 
conf.getBoolean(TxConstants.TransactionPruning.PRUNE_ENABLE,
                                         
TxConstants.TransactionPruning.DEFAULT_PRUNE_ENABLE);
    +
           if (Boolean.TRUE.equals(pruneEnable)) {
    -        String pruneTable = 
conf.get(TxConstants.TransactionPruning.PRUNE_STATE_TABLE,
    -                                     
TxConstants.TransactionPruning.DEFAULT_PRUNE_STATE_TABLE);
    -        long pruneFlushInterval = TimeUnit.SECONDS.toMillis(
    -          conf.getLong(TxConstants.TransactionPruning.PRUNE_FLUSH_INTERVAL,
    -                       
TxConstants.TransactionPruning.DEFAULT_PRUNE_FLUSH_INTERVAL));
    -        compactionState = new CompactionState(c.getEnvironment(), 
TableName.valueOf(pruneTable), pruneFlushInterval);
    +        // pruneTable and pruneFlushInterval cannot be changed by simply 
loading the Configuration dynamically
    +        // since we have only one flush thread across all regions and we 
might loose.
    +        TableName pruneTable = 
TableName.valueOf(conf.get(TxConstants.TransactionPruning.PRUNE_STATE_TABLE,
    +                                                          
TxConstants.TransactionPruning.DEFAULT_PRUNE_STATE_TABLE));
    +        long pruneFlushInterval = TimeUnit.SECONDS.toMillis(conf.getLong(
    +          TxConstants.TransactionPruning.PRUNE_FLUSH_INTERVAL,
    +          TxConstants.TransactionPruning.DEFAULT_PRUNE_FLUSH_INTERVAL));
    +
    +        compactionState = new CompactionState(env, pruneTable, 
pruneFlushInterval);
             if (LOG.isDebugEnabled()) {
    -          LOG.debug("Automatic invalid list pruning is enabled. Compaction 
state will be recorded in table "
    -                      + pruneTable);
    +          LOG.debug(String.format("Automatic invalid list pruning is 
enabled for table %s. Compaction state " +
    +                                    "will be recorded in table %s",
    +                                  
env.getRegionInfo().getTable().getNameWithNamespaceInclAsString(),
    +                                  
pruneTable.getNameWithNamespaceInclAsString()));
             }
           }
         }
       }
     
    +  protected void resetPruneState() {
    +    pruneEnable = false;
    +    if (compactionState != null) {
    +      compactionState.stop();
    --- End diff --
    
    It would be good to reset `compactionState` to `null` here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to