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

Mingliang Liu commented on HBASE-21173:
---------------------------------------

 Thanks for working on this JIRA, [~andrewcheng]. In previous discussion, I 
thought calling {{HTU.closeRegionAndWAL()}} on closed/null region is no harm, 
while deleting the duplicate close may make some tests unhappy. So we were not 
very strict to make region close only once. Good discussion to revisit this.
 - The last one in {{testBulkLoadReplicationEnabled()}} was added after 
HBASE-21138 and can be removed here.
 - The {{HTU.closeRegionAndWAL()}} in {{testRegionInfoFileCreation()}} was 
followed by the assertion to verify that the .regioninfo file is still there. I 
saw the close-and-assertion happens in the same test method multiple times so I 
was not sure we could remove the close here.
 - In {{testSequenceId}} and {{testCloseCarryingSnapshot}}, the pattern in this 
patch, i.e. "{{region.close() && region = null}}", is not correct. The reason 
is that, it makes the {{HTU.closeRegionAndWAL()}} in {{teardown()}} a no-op, 
leaving WAL not closed. One fix is to not set the null value and leave the test 
as-is; a better one I think is as [~yuzhih...@gmail.com] suggested, we can 
replace the {{region.close()}} with {{HTU.closeRegionAndWAL()}}, and set 
{{this.region}} null value.
 - Other places to set {{this.region}} null value after 
{{HTU.closeRegionAndWAL()}} is good to explicitly make the 
{{HTU.closeRegionAndWAL()}} in {{tearDown}} a no-op.

> Remove the duplicate HRegion#close in TestHRegion
> -------------------------------------------------
>
>                 Key: HBASE-21173
>                 URL: https://issues.apache.org/jira/browse/HBASE-21173
>             Project: HBase
>          Issue Type: Bug
>          Components: test
>    Affects Versions: 3.0.0, 2.2.0
>            Reporter: Guangxu Cheng
>            Assignee: Guangxu Cheng
>            Priority: Major
>         Attachments: HBASE-21173.master.001.patch
>
>
>  After HBASE-21138, some test methods still have the duplicate 
> HRegion#close.So open this issue to remove the duplicate close



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to