HBASE-25016 Should close ResultScanner in MetaTableAccessor.scanByRegionEncodedName

Closes #2390

Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
niuyulin 2020-09-13 17:32:42 +05:30 committed by Viraj Jasani
parent fe776306d0
commit a393fc594c
No known key found for this signature in database
GPG Key ID: B3D6C0B41C8ADFD5
1 changed files with 5 additions and 4 deletions

View File

@ -244,13 +244,14 @@ public final class MetaTableAccessor {
* @throws IOException if any errors occur while querying META.
*/
public static Result scanByRegionEncodedName(Connection connection, String regionEncodedName)
throws IOException {
throws IOException {
RowFilter rowFilter =
new RowFilter(CompareOperator.EQUAL, new SubstringComparator(regionEncodedName));
new RowFilter(CompareOperator.EQUAL, new SubstringComparator(regionEncodedName));
Scan scan = getMetaScan(connection, 1);
scan.setFilter(rowFilter);
ResultScanner resultScanner = getMetaHTable(connection).getScanner(scan);
return resultScanner.next();
try (ResultScanner resultScanner = getMetaHTable(connection).getScanner(scan)) {
return resultScanner.next();
}
}
/**