[ 
https://issues.apache.org/jira/browse/HBASE-18624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16201162#comment-16201162
 ] 

Zach York commented on HBASE-18624:
-----------------------------------

Ajay is out on vacation so I will be picking this up.

[~tedyu] Are you talking about incrementing a counter for each time a 
NotServingRegionException is thrown below? Another thing I thought of is that 
we could expose how many blocks are evicted as the return of this command 
(since that is already exposed via the internal function)

+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void clearBlockCache(final TableName tableName) throws IOException {
+    checkTableExists(tableName);
+    List<Pair<HRegionInfo, ServerName>> pairs =
+      MetaTableAccessor.getTableRegionsAndLocations(connection, tableName);
+    for (Pair<HRegionInfo, ServerName> pair: pairs) {
+      if (pair.getFirst().isOffline()) continue;
+      if (pair.getSecond() == null) continue;
+      try {
+        clearBlockCache(pair.getSecond(), pair.getFirst());
+      } catch (NotServingRegionException e) {
//You want to keep track of how many of these there are?

+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Trying to clear block cache for " + pair.getFirst() + ": 
" +
+                        StringUtils.stringifyException(e));
+        }
+      }
+    }
+  }

> Added support for clearing BlockCache based on table name
> ---------------------------------------------------------
>
>                 Key: HBASE-18624
>                 URL: https://issues.apache.org/jira/browse/HBASE-18624
>             Project: HBase
>          Issue Type: Sub-task
>    Affects Versions: 2.0.0, 1.3.0
>            Reporter: Ajay Jadhav
>            Assignee: Zach York
>             Fix For: 2.0.0, 1.4.0
>
>         Attachments: HBASE-18624.branch-1.001.patch, 
> HBASE-18624.master.001.patch, HBASE-18624.master.002.patch
>
>
> Bulk loading the primary HBase cluster triggers a lot of compactions 
> resulting in archival/ creation
> of multiple HFiles. This process will cause a lot of items to become stale in 
> replica’s BlockCache.
> This patch will help users to clear the block cache for a given table by 
> either using shell or API.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to