[chore](restore) Log partition visible version (#37414)

Cherry-pick #36920.
This commit is contained in:
walter
2024-07-08 18:58:16 +08:00
committed by GitHub
parent 5280e277e7
commit 4c5a7b26e2
2 changed files with 6 additions and 3 deletions

View File

@ -1123,6 +1123,7 @@ public class RestoreJob extends AbstractJob {
// generate new partition id
long newPartId = env.getNextId();
long oldPartId = remotePart.getId();
remotePart.setIdForRestore(newPartId);
// indexes
@ -1142,9 +1143,11 @@ public class RestoreJob extends AbstractJob {
// save version info for creating replicas
long visibleVersion = remotePart.getVisibleVersion();
LOG.info("reset partition {} for restore, visible version: {}, old partition id: {}",
newPartId, visibleVersion, oldPartId);
// tablets
Map<Tag, Integer> nextIndexs = Maps.newHashMap();
Map<Tag, Integer> nextIndexes = Maps.newHashMap();
for (MaterializedIndex remoteIdx : remotePart.getMaterializedIndices(IndexExtState.VISIBLE)) {
int schemaHash = remoteTbl.getSchemaHashByIndexId(remoteIdx.getId());
int remotetabletSize = remoteIdx.getTablets().size();
@ -1159,7 +1162,7 @@ public class RestoreJob extends AbstractJob {
// replicas
try {
Pair<Map<Tag, List<Long>>, TStorageMedium> beIdsAndMedium = Env.getCurrentSystemInfo()
.selectBackendIdsForReplicaCreation(replicaAlloc, nextIndexs, null, false, false);
.selectBackendIdsForReplicaCreation(replicaAlloc, nextIndexes, null, false, false);
Map<Tag, List<Long>> beIds = beIdsAndMedium.first;
for (Map.Entry<Tag, List<Long>> entry : beIds.entrySet()) {
for (Long beId : entry.getValue()) {

View File

@ -1470,7 +1470,7 @@ public class DatabaseTransactionMgr {
protected void unprotectedCommitTransaction2PC(TransactionState transactionState, Database db) {
// transaction state is modified during check if the transaction could committed
if (transactionState.getTransactionStatus() != TransactionStatus.PRECOMMITTED) {
LOG.warn("Unknow exception. state of transaction [{}] changed, failed to commit transaction",
LOG.warn("Unknown exception. state of transaction [{}] changed, failed to commit transaction",
transactionState.getTransactionId());
return;
}