Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
13b69a9
HBASE-26064 Introduce a StoreFileTracker to abstract the store file t…
Apache9 Jul 29, 2021
2eceabd
HBASE-25988 Store the store file list by a file (#3578)
Apache9 Aug 26, 2021
88321fc
HBASE-26079 Use StoreFileTracker when splitting and merging (#3617)
wchevreuil Sep 8, 2021
0ae94b8
HBASE-26224 Introduce a MigrationStoreFileTracker to support migratin…
Apache9 Sep 9, 2021
c184a92
HBASE-26246 Persist the StoreFileTracker configurations to TableDescr…
wchevreuil Sep 12, 2021
434ec97
HBASE-26248 Should find a suitable way to let users specify the store…
Apache9 Sep 14, 2021
70906cf
HBASE-26264 Add more checks to prevent misconfiguration on store file…
Apache9 Sep 15, 2021
c705d80
HBASE-26280 Use store file tracker when snapshoting (#3685)
Apache9 Sep 17, 2021
4f0a8a1
HBASE-26326 CreateTableProcedure fails when FileBasedStoreFileTracker…
wchevreuil Oct 13, 2021
201fadc
HBASE-26386 Refactor StoreFileTracker implementations to expose the s…
Apache9 Oct 21, 2021
5c8d55a
HBASE-26328 Clone snapshot doesn't load reference files into FILE SFT…
wchevreuil Oct 22, 2021
71bd286
HBASE-26263 [Rolling Upgrading] Persist the StoreFileTracker configur…
GeorryHuang Nov 6, 2021
eebda10
HBASE-26271 Cleanup the broken store files under data directory (#3786)
BukrosSzabolcs Nov 9, 2021
d24e09d
HBASE-26454 CreateTableProcedure still relies on temp dir and renames…
wchevreuil Nov 19, 2021
998af5d
HBASE-26064 Introduce a StoreFileTracker to abstract the store file t…
Apache9 Jul 29, 2021
3c0c21a
HBASE-26079 Use StoreFileTracker when splitting and merging (#3617)
wchevreuil Sep 8, 2021
d840dd3
HBASE-26286: Add support for specifying store file tracker when resto…
BukrosSzabolcs Nov 16, 2021
76f63a4
HBASE-26286: Add support for specifying store file tracker when resto…
BukrosSzabolcs Nov 19, 2021
444e852
HBASE-26286: Add support for specifying store file tracker when resto…
BukrosSzabolcs Dec 2, 2021
cc8bfa6
HBASE-26286: Add support for specifying store file tracker when resto…
BukrosSzabolcs Dec 2, 2021
b1bd8aa
HBASE-26286: Add support for specifying store file tracker when resto…
BukrosSzabolcs Dec 7, 2021
e1f22a9
HBASE-26286: Add support for specifying store file tracker when resto…
BukrosSzabolcs Dec 7, 2021
5c75a01
Merge branch 'HBASE-26067' into HBASE-26286
BukrosSzabolcs Dec 7, 2021
13c5ee6
HBASE-26286: Add support for specifying store file tracker when resto…
BukrosSzabolcs Dec 10, 2021
6dd88ed
Merge branch 'HBASE-26286' of https://github.com/BukrosSzabolcs/hbase…
BukrosSzabolcs Dec 10, 2021
a73b285
HBASE-26286: Add support for specifying store file tracker when resto…
BukrosSzabolcs Dec 13, 2021
5e6f4d4
Update hbase-server/src/main/java/org/apache/hadoop/hbase/master/proc…
BukrosSzabolcs Dec 15, 2021
7218812
HBASE-26286: Add support for specifying store file tracker when resto…
BukrosSzabolcs Dec 15, 2021
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 @@ -69,6 +69,7 @@
import org.apache.yetus.audience.InterfaceAudience;

import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList;
import org.apache.yetus.audience.InterfaceStability;

/**
* The administrative API for HBase. Obtain an instance from {@link Connection#getAdmin()} and
Expand Down Expand Up @@ -1620,7 +1621,7 @@ default void restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot)
* @throws IllegalArgumentException if the restore request is formatted incorrectly
*/
void restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot, boolean restoreAcl)
throws IOException, RestoreSnapshotException;
throws IOException, RestoreSnapshotException;

/**
* Create a new table by cloning the snapshot content.
Expand All @@ -1633,7 +1634,25 @@ void restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot, boolean
*/
default void cloneSnapshot(String snapshotName, TableName tableName)
throws IOException, TableExistsException, RestoreSnapshotException {
cloneSnapshot(snapshotName, tableName, false);
cloneSnapshot(snapshotName, tableName, false, null);
}

/**
* Create a new table by cloning the snapshot content.
* @param snapshotName name of the snapshot to be cloned
* @param tableName name of the table where the snapshot will be restored
* @param restoreAcl <code>true</code> to clone acl into newly created table
* @param customSFT specify the StoreFileTracker used for the table
* @throws IOException if a remote or network exception occurs
* @throws TableExistsException if table to be created already exists
* @throws RestoreSnapshotException if snapshot failed to be cloned
* @throws IllegalArgumentException if the specified table has not a valid name
*/
default void cloneSnapshot(String snapshotName, TableName tableName, boolean restoreAcl,
String customSFT)
throws IOException, TableExistsException, RestoreSnapshotException {
get(cloneSnapshotAsync(snapshotName, tableName, restoreAcl, customSFT), getSyncWaitTimeout(),
TimeUnit.MILLISECONDS);
}

/**
Expand Down Expand Up @@ -1680,8 +1699,25 @@ default Future<Void> cloneSnapshotAsync(String snapshotName, TableName tableName
* @throws RestoreSnapshotException if snapshot failed to be cloned
* @throws IllegalArgumentException if the specified table has not a valid name
*/
Future<Void> cloneSnapshotAsync(String snapshotName, TableName tableName, boolean restoreAcl)
throws IOException, TableExistsException, RestoreSnapshotException;
default Future<Void> cloneSnapshotAsync(String snapshotName, TableName tableName,
boolean restoreAcl)
throws IOException, TableExistsException, RestoreSnapshotException {
return cloneSnapshotAsync(snapshotName, tableName, restoreAcl, null);
}

/**
* Create a new table by cloning the snapshot content.
* @param snapshotName name of the snapshot to be cloned
* @param tableName name of the table where the snapshot will be restored
* @param restoreAcl <code>true</code> to clone acl into newly created table
* @param customSFT specify the StroreFileTracker used for the table
* @throws IOException if a remote or network exception occurs
* @throws TableExistsException if table to be created already exists
* @throws RestoreSnapshotException if snapshot failed to be cloned
* @throws IllegalArgumentException if the specified table has not a valid name
*/
Future<Void> cloneSnapshotAsync(String snapshotName, TableName tableName, boolean restoreAcl,
String customSFT) throws IOException, TableExistsException, RestoreSnapshotException;

/**
* Execute a distributed procedure on a cluster.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,14 +644,15 @@ public void restoreSnapshot(String snapshotName) throws IOException, RestoreSnap

@Override
public void restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot, boolean restoreAcl)
throws IOException, RestoreSnapshotException {
throws IOException, RestoreSnapshotException {
get(admin.restoreSnapshot(snapshotName, takeFailSafeSnapshot, restoreAcl));
}

@Override
public Future<Void> cloneSnapshotAsync(String snapshotName, TableName tableName,
boolean restoreAcl) throws IOException, TableExistsException, RestoreSnapshotException {
return admin.cloneSnapshot(snapshotName, tableName, restoreAcl);
boolean restoreAcl, String customSFT)
throws IOException, TableExistsException, RestoreSnapshotException {
return admin.cloneSnapshot(snapshotName, tableName, restoreAcl, customSFT);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,20 @@ default CompletableFuture<Void> cloneSnapshot(String snapshotName, TableName tab
* @param tableName name of the table where the snapshot will be restored
* @param restoreAcl <code>true</code> to restore acl of snapshot
*/
default CompletableFuture<Void> cloneSnapshot(String snapshotName, TableName tableName,
boolean restoreAcl) {
return cloneSnapshot(snapshotName, tableName, restoreAcl, null);
}

/**
* Create a new table by cloning the snapshot content.
* @param snapshotName name of the snapshot to be cloned
* @param tableName name of the table where the snapshot will be restored
* @param restoreAcl <code>true</code> to restore acl of snapshot
* @param customSFT specify the StroreFileTracker used for the table
*/
CompletableFuture<Void> cloneSnapshot(String snapshotName, TableName tableName,
boolean restoreAcl);
boolean restoreAcl, String customSFT);

/**
* List completed snapshots.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,14 @@ public CompletableFuture<Void> restoreSnapshot(String snapshotName) {

@Override
public CompletableFuture<Void> restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot,
boolean restoreAcl) {
boolean restoreAcl) {
return wrap(rawAdmin.restoreSnapshot(snapshotName, takeFailSafeSnapshot, restoreAcl));
}

@Override
public CompletableFuture<Void> cloneSnapshot(String snapshotName, TableName tableName,
boolean restoreAcl) {
return wrap(rawAdmin.cloneSnapshot(snapshotName, tableName, restoreAcl));
boolean restoreAcl, String customSFT) {
return wrap(rawAdmin.cloneSnapshot(snapshotName, tableName, restoreAcl, customSFT));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ public interface ColumnFamilyDescriptor {
* @return A clone value. Null if no mapping for the key
*/
Bytes getValue(Bytes key);
/**
* @param key The key.
* @return A clone value. Null if no mapping for the key
*/
String getValue(String key);
/**
* @param key The key.
* @return A clone value. Null if no mapping for the key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,12 @@ public byte[] getValue(byte[] key) {
return value == null ? null : value.get();
}

@Override
public String getValue(String key) {
Bytes rval = values.get(new Bytes(Bytes.toBytes(key)));
return rval == null ? null : Bytes.toString(rval.get(), rval.getOffset(), rval.getLength());
}

@Override
public Map<Bytes, Bytes> getValues() {
return Collections.unmodifiableMap(values);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ public CompletableFuture<Void> restoreSnapshot(String snapshotName, boolean take
} else if (!exists) {
// if table does not exist, then just clone snapshot into new table.
completeConditionalOnFuture(future,
internalRestoreSnapshot(snapshotName, finalTableName, restoreAcl));
internalRestoreSnapshot(snapshotName, finalTableName, restoreAcl, null));
} else {
addListener(isTableDisabled(finalTableName), (disabled, err4) -> {
if (err4 != null) {
Expand Down Expand Up @@ -2003,12 +2003,13 @@ private CompletableFuture<Void> restoreSnapshot(String snapshotName, TableName t
future.completeExceptionally(err);
} else {
// Step.2 Restore snapshot
addListener(internalRestoreSnapshot(snapshotName, tableName, restoreAcl),
addListener(internalRestoreSnapshot(snapshotName, tableName, restoreAcl, null),
(void2, err2) -> {
if (err2 != null) {
// Step.3.a Something went wrong during the restore and try to rollback.
addListener(
internalRestoreSnapshot(failSafeSnapshotSnapshotName, tableName, restoreAcl),
internalRestoreSnapshot(failSafeSnapshotSnapshotName, tableName, restoreAcl,
null),
(void3, err3) -> {
if (err3 != null) {
future.completeExceptionally(err3);
Expand Down Expand Up @@ -2036,7 +2037,7 @@ private CompletableFuture<Void> restoreSnapshot(String snapshotName, TableName t
});
return future;
} else {
return internalRestoreSnapshot(snapshotName, tableName, restoreAcl);
return internalRestoreSnapshot(snapshotName, tableName, restoreAcl, null);
}
}

Expand All @@ -2053,7 +2054,7 @@ private <T> void completeConditionalOnFuture(CompletableFuture<T> dependentFutur

@Override
public CompletableFuture<Void> cloneSnapshot(String snapshotName, TableName tableName,
boolean restoreAcl) {
boolean restoreAcl, String customSFT) {
CompletableFuture<Void> future = new CompletableFuture<>();
addListener(tableExists(tableName), (exists, err) -> {
if (err != null) {
Expand All @@ -2062,25 +2063,30 @@ public CompletableFuture<Void> cloneSnapshot(String snapshotName, TableName tabl
future.completeExceptionally(new TableExistsException(tableName));
} else {
completeConditionalOnFuture(future,
internalRestoreSnapshot(snapshotName, tableName, restoreAcl));
internalRestoreSnapshot(snapshotName, tableName, restoreAcl, customSFT));
}
});
return future;
}

private CompletableFuture<Void> internalRestoreSnapshot(String snapshotName, TableName tableName,
boolean restoreAcl) {
boolean restoreAcl, String customSFT) {
SnapshotProtos.SnapshotDescription snapshot = SnapshotProtos.SnapshotDescription.newBuilder()
.setName(snapshotName).setTable(tableName.getNameAsString()).build();
try {
ClientSnapshotDescriptionUtils.assertSnapshotRequestIsValid(snapshot);
} catch (IllegalArgumentException e) {
return failedFuture(e);
}
RestoreSnapshotRequest.Builder builder =
RestoreSnapshotRequest.newBuilder().setSnapshot(snapshot).setNonceGroup(ng.getNonceGroup())
.setNonce(ng.newNonce()).setRestoreACL(restoreAcl);
if(customSFT != null){
builder.setCustomSFT(customSFT);
}
return waitProcedureResult(this.<Long> newMasterCaller().action((controller, stub) -> this
.<RestoreSnapshotRequest, RestoreSnapshotResponse, Long> call(controller, stub,
RestoreSnapshotRequest.newBuilder().setSnapshot(snapshot).setNonceGroup(ng.getNonceGroup())
.setNonce(ng.newNonce()).setRestoreACL(restoreAcl).build(),
builder.build(),
(s, c, req, done) -> s.restoreSnapshot(c, req, done), (resp) -> resp.getProcId()))
.call());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ message RestoreSnapshotRequest {
optional uint64 nonce_group = 2 [default = 0];
optional uint64 nonce = 3 [default = 0];
optional bool restoreACL = 4 [default = false];
optional string customSFT = 5;
}

message RestoreSnapshotResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ message CloneSnapshotStateData {
repeated RegionInfo region_info = 4;
repeated RestoreParentToChildRegionsPair parent_to_child_regions_pair_list = 5;
optional bool restore_acl = 6;
optional string customSFT = 7;
}

enum RestoreSnapshotState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2617,8 +2617,8 @@ public TableDescriptor get() throws IOException {

}

public long restoreSnapshot(final SnapshotDescription snapshotDesc,
final long nonceGroup, final long nonce, final boolean restoreAcl) throws IOException {
public long restoreSnapshot(final SnapshotDescription snapshotDesc, final long nonceGroup,
final long nonce, final boolean restoreAcl, final String customSFT) throws IOException {
checkInitialized();
getSnapshotManager().checkSnapshotSupport();

Expand All @@ -2627,18 +2627,19 @@ public long restoreSnapshot(final SnapshotDescription snapshotDesc,
getClusterSchema().getNamespace(dstTable.getNamespaceAsString());

return MasterProcedureUtil.submitProcedure(
new MasterProcedureUtil.NonceProcedureRunnable(this, nonceGroup, nonce) {
@Override
protected void run() throws IOException {
new MasterProcedureUtil.NonceProcedureRunnable(this, nonceGroup, nonce) {
@Override
protected void run() throws IOException {
setProcId(
getSnapshotManager().restoreOrCloneSnapshot(snapshotDesc, getNonceKey(), restoreAcl));
}
getSnapshotManager().restoreOrCloneSnapshot(snapshotDesc, getNonceKey(), restoreAcl,
customSFT));
}

@Override
protected String getDescription() {
return "RestoreSnapshotProcedure";
}
});
@Override
protected String getDescription() {
return "RestoreSnapshotProcedure";
}
});
}

private void checkTableExists(final TableName tableName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ public RestoreSnapshotResponse restoreSnapshot(RpcController controller,
RestoreSnapshotRequest request) throws ServiceException {
try {
long procId = server.restoreSnapshot(request.getSnapshot(), request.getNonceGroup(),
request.getNonce(), request.getRestoreACL());
request.getNonce(), request.getRestoreACL(), request.getCustomSFT());
return RestoreSnapshotResponse.newBuilder().setProcId(procId).build();
} catch (ForeignException e) {
throw new ServiceException(e.getCause());
Expand Down
Loading