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 2020/10/22 07:46:01 UTC

[GitHub] [hadoop-ozone] lokeshj1703 opened a new pull request #1513: HDDS-4366. SCM deletion service should delete configured number of blocks every interval.

lokeshj1703 opened a new pull request #1513:
URL: https://github.com/apache/hadoop-ozone/pull/1513


   ## What changes were proposed in this pull request?
   
   SCM service currently uses datanode's configuration to determine the number of blocks to delete every interval. It should have its own congifuration for maximum number of blocks to delete in every interval.
   Further it currently scans the entire DB to fetch block deletion transactions. This can be avoided with this approach. With this patch service would always fetch configured number of blocks from the db.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-4366
   
   ## How was this patch tested?
   
   Existing UT
   


----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] lokeshj1703 commented on pull request #1513: HDDS-4366. SCM deletion service should delete configured number of blocks every interval.

Posted by GitBox <gi...@apache.org>.
lokeshj1703 commented on pull request #1513:
URL: https://github.com/apache/hadoop-ozone/pull/1513#issuecomment-715293590


   @bshashikant Thanks for reviewing the PR! I have added a commit which addresses the comments.


----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] lokeshj1703 commented on a change in pull request #1513: HDDS-4366. SCM deletion service should delete configured number of blocks every interval.

Posted by GitBox <gi...@apache.org>.
lokeshj1703 commented on a change in pull request #1513:
URL: https://github.com/apache/hadoop-ozone/pull/1513#discussion_r510827330



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java
##########
@@ -323,31 +322,54 @@ public void addTransactions(Map<Long, List<Long>> containerBlocksMap)
   public void close() throws IOException {
   }
 
+  private void getTransaction(DeletedBlocksTransaction tx,

Review comment:
       The function is used to fetch a single transaction so avoided s at end here.




----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] bshashikant commented on a change in pull request #1513: HDDS-4366. SCM deletion service should delete configured number of blocks every interval.

Posted by GitBox <gi...@apache.org>.
bshashikant commented on a change in pull request #1513:
URL: https://github.com/apache/hadoop-ozone/pull/1513#discussion_r510761184



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/SCMBlockDeletingService.java
##########
@@ -127,62 +112,65 @@ public int getPriority() {
 
     @Override
     public EmptyTaskResult call() throws Exception {
-      int dnTxCount = 0;
       long startTime = Time.monotonicNow();
       // Scan SCM DB in HB interval and collect a throttled list of
       // to delete blocks.
-      LOG.debug("Running DeletedBlockTransactionScanner");
-      DatanodeDeletedBlockTransactions transactions = null;
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Running DeletedBlockTransactionScanner");
+      }
+
       List<DatanodeDetails> datanodes = nodeManager.getNodes(NodeState.HEALTHY);
-      Map<Long, Long> transactionMap = null;
       if (datanodes != null) {
-        transactions = new DatanodeDeletedBlockTransactions(containerManager,
-            blockDeleteLimitSize, datanodes.size());
         try {
-          transactionMap = deletedBlockLog.getTransactions(transactions);
+          DatanodeDeletedBlockTransactions transactions =
+              deletedBlockLog.getTransactions(blockDeleteLimitSize);
+          Map<Long, Long> containerIdToMaxTxnId =
+              transactions.getContainerIdToTxnIdMap();
+
+          if (transactions.isEmpty()) {
+            return EmptyTaskResult.newResult();
+          }
+
+          for (Map.Entry<UUID, List<DeletedBlocksTransaction>> entry :
+              transactions.getDatanodeTransactionMap().entrySet()) {
+            UUID dnId = entry.getKey();
+            List<DeletedBlocksTransaction> dnTXs = entry.getValue();
+            if (!dnTXs.isEmpty()) {
+              // TODO commandQueue needs a cap.
+              // We should stop caching new commands if num of un-processed
+              // command is bigger than a limit, e.g 50. In case datanode goes
+              // offline for sometime, the cached commands be flooded.
+              eventPublisher.fireEvent(SCMEvents.RETRIABLE_DATANODE_COMMAND,
+                  new CommandForDatanode<>(dnId,
+                      new DeleteBlocksCommand(dnTXs)));
+              if (LOG.isDebugEnabled()) {
+                LOG.debug(
+                    "Added delete block command for datanode {} in the queue,"
+                        + " number of delete block transactions: {}{}", dnId,
+                    dnTXs.size(), LOG.isTraceEnabled() ?
+                        ", TxID list: " + String.join(",",
+                            transactions.getTransactionIDList(dnId)) : "");
+              }
+            }
+          }
+
+          containerManager.updateDeleteTransactionId(containerIdToMaxTxnId);
+          LOG.info("Totally added {} blocks to be deleted for"
+                  + " {} datanodes, task elapsed time: {}ms",
+              transactions.getBlocksDeleted(),
+              transactions.getDatanodeTransactionMap().size(),
+              Time.monotonicNow() - startTime);
         } catch (IOException e) {
           // We may tolerant a number of failures for sometime

Review comment:
       tolerant ---> tolerate

##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java
##########
@@ -323,31 +322,54 @@ public void addTransactions(Map<Long, List<Long>> containerBlocksMap)
   public void close() throws IOException {
   }
 
+  private void getTransaction(DeletedBlocksTransaction tx,

Review comment:
       getTransaction -> getTransactions




----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org