Skip to content

Commit

Permalink
Resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yuqi1129 committed Apr 16, 2024
1 parent d3b4bdf commit 76fbfef
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,15 @@ private void collectAndRemoveOldVersionData() throws IOException {
removeAllVersionsOfKey(rawKey, key, false);

LogHelper logHelper = decodeKey(key, transactionId);
kvBackend.delete(rawKey);
LOG.info(
"Physically delete key that has marked deleted: name identifier: '{}', entity type: '{}', createTime: '{}({})', key: '{}'",
"Physically delete key that has marked deleted: name identifier: '{}', entity type: '{}',"
+ " createTime: '{}({})', key: '{}'",
logHelper.identifier,
logHelper.type,
logHelper.createTimeAsString,
logHelper.createTimeInMs,
Bytes.wrap(key));
kvBackend.delete(rawKey);
keysDeletedCount++;
continue;
}
Expand All @@ -225,8 +226,10 @@ private void collectAndRemoveOldVersionData() throws IOException {
LogHelper logHelper = decodeKey(key, transactionId);
byte[] newVersionKey = newVersionOfKey.get(0).getKey();
LogHelper newVersionLogHelper = decodeKey(newVersionKey);
kvBackend.delete(rawKey);
LOG.info(
"Physically delete key that has newer version: name identifier: '{}', entity type: '{}', createTime: '{}({})', newVersion createTime: '{}({})',"
"Physically delete key that has newer version: name identifier: '{}', entity type: '{}',"
+ " createTime: '{}({})', newVersion createTime: '{}({})',"
+ " key: '{}', newVersion key: '{}'",
logHelper.identifier,
logHelper.type,
Expand All @@ -236,21 +239,20 @@ private void collectAndRemoveOldVersionData() throws IOException {
newVersionLogHelper.createTimeInMs,
Bytes.wrap(rawKey),
Bytes.wrap(newVersionKey));
kvBackend.delete(rawKey);
keysDeletedCount++;
}
}

// All keys in this transaction have been deleted, we can remove the commit mark.
if (keysDeletedCount == keysInTheTransaction.size()) {
kvBackend.delete(kv.getKey());
long timestamp = getTransactionId(transactionId) >> 18;
LOG.info(
"Physically delete commit mark: {}, createTime: '{}({})', key: '{}'",
Bytes.wrap(kv.getKey()),
DateFormatUtils.format(timestamp, TIME_STAMP_FORMAT),
timestamp,
Bytes.wrap(kv.getKey()));
kvBackend.delete(kv.getKey());
}
}

Expand Down Expand Up @@ -283,7 +285,8 @@ private void removeAllVersionsOfKey(byte[] rawKey, byte[] key, boolean includeSt

LogHelper logHelper = decodeKey(kv.getKey());
LOG.info(
"Physically delete key that has marked deleted: name identifier: '{}', entity type: '{}', createTime: '{}({})', key: '{}'",
"Physically delete key that has marked deleted: name identifier: '{}', entity type: '{}',"
+ " createTime: '{}({})', key: '{}'",
logHelper.identifier,
logHelper.type,
logHelper.createTimeAsString,
Expand All @@ -308,14 +311,14 @@ private void removeAllVersionsOfKey(byte[] rawKey, byte[] key, boolean includeSt

// Try to delete the commit mark.
if (allDropped) {
kvBackend.delete(transactionKey);
long timestamp = TransactionalKvBackendImpl.getTransactionId(transactionId) >> 18;
LOG.info(
"Physically delete commit mark: {}, createTime: '{}({})', key: '{}'",
Bytes.wrap(kv.getKey()),
DateFormatUtils.format(timestamp, TIME_STAMP_FORMAT),
timestamp,
Bytes.wrap(kv.getKey()));
kvBackend.delete(transactionKey);
}
}
}
Expand Down

0 comments on commit 76fbfef

Please sign in to comment.