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

ASF GitHub Bot commented on PHOENIX-5296:
-----------------------------------------

virajjasani commented on a change in pull request #1096:
URL: https://github.com/apache/phoenix/pull/1096#discussion_r559633500



##########
File path: phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
##########
@@ -2006,4 +2015,21 @@ public void run() {
         thread.setDaemon(true);
         thread.start();
     }
+
+    /**
+     * Confirms that no storeFile has refCount leakage
+     */
+    protected synchronized static void confirmStoreRefCountLeak()
+            throws Exception {
+        if (getUtility() != null) {
+            try {
+                CompatUtil.confirmStoreRefCountLeak(
+                    getUtility().getAdmin());
+            } catch (IOException e) {
+                LOGGER.error("StoreFile refCount is leaked", e);

Review comment:
       Okk I think we better let cluster shutdown happen the way it does today. 
We better use `finally` with catching storeFile refCount leak assertion catch 
so that not only we fail test but also let resources be freed up in individual 
test's `finally` block. I was thinking of taking care of cluster shutdown in 
`BaseTest` only as generic check, but now it seems better let individual test 
decide what they want to free up - cluster or just drop table or anything as 
per it's current behaviour.
   The only problem with current approach (generic freeup resource in 
`BaseTest`) is that if refCount leakage is encountered in one test and if we 
shutdown miniCluster in `@After`, other tests in that class will not run 
anyways.
   
   @stoty you are also fine with having `finally` in each test right?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


> Ensure store file reader refcount is zero at end of relevant unit tests
> -----------------------------------------------------------------------
>
>                 Key: PHOENIX-5296
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5296
>             Project: Phoenix
>          Issue Type: Test
>            Reporter: Andrew Kyle Purtell
>            Assignee: Viraj Jasani
>            Priority: Major
>              Labels: phoenix-hardening
>             Fix For: 5.1.0, 4.16.0
>
>
> Unit and integration tests for functional areas where the implementation 
> wraps scanners and uses a delegate pattern should check at the end of the 
> test that no scanners were leaked (check that all scanners including the 
> inner scanners were properly closed) by testing that the store reader 
> reference count is zero on all stores. 
> HBASE-22459 will offer a new metric and API which exposes this information. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to