Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.hadoop.hbase.regionserver.wal;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -51,6 +52,7 @@
import org.apache.hadoop.hbase.wal.WAL;
import org.apache.hadoop.hbase.wal.WALFactory;
import org.apache.hadoop.hbase.wal.WALSplitter;
import org.apache.phoenix.compat.hbase.CompatUtil;
import org.apache.phoenix.end2end.NeedsOwnMiniClusterTest;
import org.apache.phoenix.hbase.index.IndexTestingUtils;
import org.apache.phoenix.hbase.index.TableName;
Expand Down Expand Up @@ -151,9 +153,12 @@ protected void startCluster() throws Exception {

@After
public void tearDown() throws Exception {
boolean refCountLeaked = CompatUtil.isAnyStoreRefCountLeaked(
UTIL.getHBaseCluster().getMaster());
UTIL.shutdownMiniHBaseCluster();
UTIL.shutdownMiniDFSCluster();
UTIL.shutdownMiniZKCluster();
assertFalse("refCount leaked", refCountLeaked);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,10 @@ public void setUp() throws SQLException {
}

@After
public void tearDown() throws SQLException {
public void tearDown() throws Exception {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
conn.close();
assertFalse("refCount leaked", refCountLeaked);
}

private String initAtable() throws SQLException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.apache.phoenix.util.PropertiesUtil;
Expand Down Expand Up @@ -101,8 +99,10 @@ public void initTable() throws Exception {
}

@After
public void cleanUp(){
tableName=null;
public void cleanUp() throws Exception {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
tableName = null;
assertFalse("refCount leaked", refCountLeaked);
}

@Parameters(name="DerivedTableIT_{index}") // name is used by failsafe as file name in reports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ public void setup() throws Exception {
}

@After
public void cleanUp() throws SQLException {
public void cleanUp() throws Exception {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
deleteTenantData(descViewName);
deleteTenantData(viewName1);
deleteTenantData(viewName2);
deleteTenantData(ascViewName);
deleteTenantData(tableName);
deleteTenantData(tableName2);
assertFalse("refCount leaked", refCountLeaked);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

Expand Down Expand Up @@ -149,6 +150,7 @@ public void createIndexToolTables() throws Exception {

@After
public void cleanup() throws Exception {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
deleteAllRows(conn,
Expand All @@ -158,6 +160,7 @@ public void cleanup() throws Exception {
}
EnvironmentEdgeManager.reset();
resetIndexRegionObserverFailPoints();
assertFalse("refCount leaked", refCountLeaked);
}

private void setIndexRowStatusesToVerified(Connection conn, String dataTableFullName, String indexTableFullName) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import static org.apache.phoenix.mapreduce.index.PhoenixScrutinyJobCounters.VALID_ROW_COUNT;
import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
Expand Down Expand Up @@ -94,13 +95,16 @@ public class IndexScrutinyToolForTenantIT extends IndexScrutinyToolBaseIT {
connGlobal.commit();
}

@After public void teardown() throws SQLException {
@After
public void teardown() throws Exception {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
if (connGlobal != null) {
connGlobal.close();
}
if (connTenant != null) {
connTenant.close();
}
assertFalse("refCount leaked", refCountLeaked);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ public IndexScrutinyToolIT(String dataTableDdl, String indexTableDdl) throws Exc

}

@After public void teardown() throws SQLException {
@After
public void teardown() throws Exception {
if (conn != null) {
conn.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

public class IndexToolForDeleteBeforeRebuildIT extends ParallelStatsDisabledIT {
private Connection conn;
Expand Down Expand Up @@ -120,9 +121,11 @@ private void upsertRow(PreparedStatement stmt, String tenantId, int id, String n
}

@After
public void teardown() throws SQLException {
public void teardown() throws Exception {
if (conn != null) {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
conn.close();
assertFalse("refCount leaked", refCountLeaked);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

import com.google.common.collect.Maps;

import static org.junit.Assert.assertFalse;

public class IndexToolTimeRangeIT extends BaseUniqueNamesOwnClusterIT {
private static final String
CREATE_TABLE_DDL = "CREATE TABLE %s (ID INTEGER NOT NULL PRIMARY KEY, "
Expand Down Expand Up @@ -219,6 +221,8 @@ public void tickTime() {

@AfterClass
public static synchronized void teardown() {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
tearDownMiniCluster(2);
assertFalse("refCount leaked", refCountLeaked);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ public void setupTables() throws Exception {
}

@After
public void clearCountersForScanGrouper() {
public void clearCountersForScanGrouper() throws Exception {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
TestingMapReduceParallelScanGrouper.clearNumCallsToGetRegionBoundaries();
assertFalse("refCount leaked", refCountLeaked);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import static org.apache.phoenix.util.TestUtil.assertRowHasExpectedValueAtSCN;
import static org.apache.phoenix.util.TestUtil.assertTableHasTtl;
import static org.apache.phoenix.util.TestUtil.assertTableHasVersions;
import static org.junit.Assert.assertFalse;

@NeedsOwnMiniClusterTest
public class MaxLookbackIT extends BaseUniqueNamesOwnClusterIT {
Expand Down Expand Up @@ -90,7 +91,9 @@ public void beforeTest(){

@AfterClass
public static synchronized void afterClass() {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
EnvironmentEdgeManager.reset();
assertFalse("refCount leaked", refCountLeaked);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ public final void doSetup(boolean systemMappingEnabled) throws Exception {
public void tearDownMiniCluster() {
try {
if (testUtil != null) {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
testUtil.shutdownMiniCluster();
testUtil = null;
assertFalse("refCount leaked", refCountLeaked);
}
} catch (Exception e) {
// ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ public static synchronized void doSetup() throws Exception {
}

@After
public void assertNoUnfreedMemory() throws SQLException {
Connection conn = DriverManager.getConnection(getUrl());
try {
public void assertNoUnfreedMemory() throws Exception {
boolean refCountLeaked = isAnyStoreRefCountLeaked();
try (Connection conn = DriverManager.getConnection(getUrl())) {
long unfreedBytes = conn.unwrap(PhoenixConnection.class).getQueryServices().clearCache();
assertEquals(0,unfreedBytes);
} finally {
conn.close();
assertEquals(0, unfreedBytes);
}
assertFalse("refCount leaked", refCountLeaked);
}

@Test
Expand Down
Loading