You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/01/21 09:23:52 UTC
[GitHub] [ozone] lokeshj1703 commented on a change in pull request #1828: HDDS-4477. Delete txnId in SCMMetadataStoreImpl may drop to 0 after SCM restart.
lokeshj1703 commented on a change in pull request #1828:
URL: https://github.com/apache/ozone/pull/1828#discussion_r561719236
##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java
##########
@@ -312,19 +335,19 @@ public int getNumOfValidTransactions() throws IOException {
public void addTransactions(Map<Long, List<Long>> containerBlocksMap)
throws IOException {
lock.lock();
- try {
- try(BatchOperation batch =
- scmMetadataStore.getStore().initBatchOperation()) {
- for (Map.Entry< Long, List< Long > > entry :
- containerBlocksMap.entrySet()) {
- long nextTXID = scmMetadataStore.getNextDeleteBlockTXID();
- DeletedBlocksTransaction tx = constructNewTransaction(nextTXID,
- entry.getKey(), entry.getValue());
- scmMetadataStore.getDeletedBlocksTXTable().putWithBatch(batch,
- nextTXID, tx);
- }
- scmMetadataStore.getStore().commitBatchOperation(batch);
+ try (BatchOperation batch = scmMetadataStore.getStore()
+ .initBatchOperation()) {
+ for (Map.Entry<Long, List<Long>> entry : containerBlocksMap.entrySet()) {
+ long nextTXID = getNextDeleteBlockTXID();
+ scmMetadataStore.getDeletedBlocksTXTable().putWithBatch(batch, nextTXID,
+ constructNewTransaction(nextTXID, entry.getKey(),
+ entry.getValue()));
}
+ scmMetadataStore.getDeletedBlocksTXTable()
+ .putWithBatch(batch, largestTxnIdHolderKey,
+ DeletedBlocksTransaction.newBuilder().setTxID(getCurrentTXID())
+ .setContainerID(1).setCount(1).build());
Review comment:
Addressed in latest commit.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org