Skip to content

Commit

Permalink
HBASE-26826 Backport StoreFileTracker (HBASE-26067, HBASE-26584, and …
Browse files Browse the repository at this point in the history
…others) to branch-2.5

Signed-off-by: Josh Elser <[email protected]>
Reviewed-by: Wellington Ramos Chevreuil <[email protected]>
  • Loading branch information
apurtell committed Mar 26, 2022
1 parent 541d748 commit f9fa857
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2868,10 +2868,10 @@ private Future<Void> internalRestoreSnapshotAsync(final String snapshotName,
@Override
protected RestoreSnapshotResponse rpcCall() throws Exception {
final RestoreSnapshotRequest.Builder builder = RestoreSnapshotRequest.newBuilder()
.setSnapshot(snapshot)
.setNonceGroup(nonceGroup)
.setNonce(nonce)
.setRestoreACL(restoreAcl);
.setSnapshot(snapshot)
.setNonceGroup(nonceGroup)
.setNonce(nonce)
.setRestoreACL(restoreAcl);
if (customSFT != null) {
builder.setCustomSFT(customSFT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,9 +818,8 @@ public ModifyableTableDescriptor removeValue(Bytes key) {
/**
* Remove metadata represented by the key from the {@link #values} map
*
* @param key Key whose key and value we're to remove from TableDescriptor
* parameters.
* @return the modifyable TD
* @param key Key whose key and value we're to remove from TableDescriptor parameters
* @return the modifiable TD
*/
public ModifyableTableDescriptor removeValue(final byte[] key) {
return removeValue(new Bytes(key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
@Category(IntegrationTests.class)
public class IntegrationTestFileBasedSFTBulkLoad extends IntegrationTestBulkLoad {

private static final Logger LOG = LoggerFactory.getLogger(IntegrationTestFileBasedSFTBulkLoad.class);
private static final Logger LOG =
LoggerFactory.getLogger(IntegrationTestFileBasedSFTBulkLoad.class);

private static String NUM_MAPS_KEY = "hbase.IntegrationTestBulkLoad.numMaps";
private static String NUM_IMPORT_ROUNDS_KEY = "hbase.IntegrationTestBulkLoad.numImportRounds";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ public long timeOfOldestEdit() {
}

/**
* This method is protected under {@link HStore#lock} write lock,<br/>
* and this method is used by {@link HStore#updateStorefiles} after flushing is completed.<br/>
* This method is protected under HStore write lock.<br/>
* The passed snapshot was successfully persisted; it can be let go.
* @param id Id of the snapshot to clean out.
* @see MemStore#snapshot()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public String getFamilyName() {
}

/**
* This method is protected under {@link HStore#lock} read lock.
* This method is protected under HStore read lock.
*/
@Override
public List<KeyValueScanner> getScanners(long readPt) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2262,7 +2262,8 @@ private void initializeThreads() {
double brokenStoreFileCleanerDelayJitter = conf.getDouble(
BrokenStoreFileCleaner.BROKEN_STOREFILE_CLEANER_DELAY_JITTER,
BrokenStoreFileCleaner.DEFAULT_BROKEN_STOREFILE_CLEANER_DELAY_JITTER);
double jitterRate = (ThreadLocalRandom.current().nextDouble() - 0.5D) * brokenStoreFileCleanerDelayJitter;
double jitterRate = (ThreadLocalRandom.current().nextDouble() - 0.5D) *
brokenStoreFileCleanerDelayJitter;
long jitterValue = Math.round(brokenStoreFileCleanerDelay * jitterRate);
this.brokenStoreFileCleaner =
new BrokenStoreFileCleaner((int) (brokenStoreFileCleanerDelay + jitterValue),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public SecureBulkLoadListener(FileSystem fs, String stagingDir, Configuration co

@Override
public String prepareBulkLoad(final byte[] family, final String srcPath, boolean copyFile,
String customStaging ) throws IOException {
String customStaging) throws IOException {
Path p = new Path(srcPath);

//store customStaging for failedBulkLoad
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

package org.apache.hadoop.hbase.snapshot;

import static org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory.TRACKER_IMPL;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos;

@RunWith(Parameterized.class)
public class TestBulkloadBase {
Expand Down Expand Up @@ -135,7 +135,8 @@ protected HRegion testRegionWithFamiliesAndSpecifiedTableName(TableName tableNam
}

protected HRegion testRegionWithFamilies(byte[]... families) throws IOException {
TableName tableName = TableName.valueOf(name.getMethodName().substring(0, name.getMethodName().indexOf("[")));
TableName tableName =
TableName.valueOf(name.getMethodName().substring(0, name.getMethodName().indexOf("[")));
return testRegionWithFamiliesAndSpecifiedTableName(tableName, families);
}

Expand Down Expand Up @@ -175,7 +176,9 @@ private String createHFileForFamilies(byte[] family) throws IOException {

private static String generateUniqueName(final String suffix) {
String name = UUID.randomUUID().toString().replaceAll("-", "");
if (suffix != null) name += suffix;
if (suffix != null) {
name += suffix;
}
return name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ private void validateDaughterRegionsFiles(HRegion region, String orignalFileName
List<StoreFileInfo> infos = region.getRegionFileSystem().getStoreFiles("info");
final MutableBoolean foundLink = new MutableBoolean(false);
infos.stream().forEach(i -> {
i.getActiveFileName().contains(orignalFileName);
if(i.getActiveFileName().contains(untrackedFile)){
fail();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
*/
package org.apache.hadoop.hbase.regionserver;

import java.io.IOException;
import java.util.Random;
import java.util.UUID;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
Expand All @@ -42,9 +45,6 @@
import org.junit.experimental.categories.Category;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
import java.io.IOException;
import java.util.Random;
import java.util.UUID;

/**
* Tests for failedBulkLoad logic to make sure staged files are returned to their original location
Expand Down Expand Up @@ -232,7 +232,8 @@ public void testDeletedStagedFile() throws Exception {

private String createHFileForFamilies(byte[] family) throws IOException {
HFile.WriterFactory hFileFactory = HFile.getWriterFactoryNoCache(conf);
Path testDir = new Path(dfs.getWorkingDirectory() , new Path(name.getMethodName(), Bytes.toString(family)));
Path testDir = new Path(dfs.getWorkingDirectory(),
new Path(name.getMethodName(), Bytes.toString(family)));
if(!dfs.exists(testDir)){
dfs.mkdirs(testDir);
}
Expand All @@ -257,7 +258,9 @@ private String createHFileForFamilies(byte[] family) throws IOException {

private static String generateUniqueName(final String suffix) {
String name = UUID.randomUUID().toString().replaceAll("-", "");
if (suffix != null) name += suffix;
if (suffix != null) {
name += suffix;
}
return name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.apache.hadoop.hbase.CellComparatorImpl;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
import org.apache.hadoop.hbase.regionserver.compactions.CompactionContext;
import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequestImpl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ public static void createMobTable(final HBaseTestingUtility util, final TableNam
storeFileTracker, families);
}

public static void createPreSplitMobTable(final HBaseTestingUtility util, final TableName tableName,
int nRegions, final byte[]... families) throws IOException, InterruptedException {
public static void createPreSplitMobTable(final HBaseTestingUtility util,
final TableName tableName, int nRegions, final byte[]... families)
throws IOException, InterruptedException {
createMobTable(util, tableName, SnapshotTestingUtils.getSplitKeys(nRegions), 1, families);
}

Expand All @@ -77,9 +78,9 @@ public static void createMobTable(final HBaseTestingUtility util, final TableNam
createMobTable(util, tableName, splitKeys, regionReplication, storeFileTracker, null, families);
}

public static void createMobTable(HBaseTestingUtility util, TableName tableName, byte[][] splitKeys,
int regionReplication, String storeFileTracker, String cpClassName, byte[]... families)
throws IOException, InterruptedException {
public static void createMobTable(HBaseTestingUtility util, TableName tableName,
byte[][] splitKeys, int regionReplication, String storeFileTracker, String cpClassName,
byte[]... families) throws IOException, InterruptedException {
TableDescriptorBuilder builder =
TableDescriptorBuilder.newBuilder(tableName).setRegionReplication(regionReplication);
for (byte[] family : families) {
Expand Down

0 comments on commit f9fa857

Please sign in to comment.