You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "adoroszlai (via GitHub)" <gi...@apache.org> on 2023/01/31 08:53:51 UTC

[GitHub] [ozone] adoroszlai commented on a diff in pull request #4220: HDDS-7844. EC: Add normal and low priority to replication supervisor and commands

adoroszlai commented on code in PR #4220:
URL: https://github.com/apache/ozone/pull/4220#discussion_r1091176445


##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestReplicationSupervisor.java:
##########
@@ -350,6 +357,121 @@ public void taskWithObsoleteTermIsDropped() {
     Assert.assertEquals(0, supervisor.getReplicationSuccessCount());
   }
 
+  @Test
+  public void testPriorityOrdering() throws InterruptedException {
+    long deadline = clock.millis() + 1000;
+    long containerId = 1;
+    long term = 1;
+    OzoneConfiguration conf = new OzoneConfiguration();
+    ReplicationServer.ReplicationConfig repConf =
+        conf.getObject(ReplicationServer.ReplicationConfig.class);
+    repConf.setReplicationMaxStreams(1);
+    ReplicationSupervisor supervisor =
+        new ReplicationSupervisor(null, repConf, clock);
+
+    final CountDownLatch indicateRunning = new CountDownLatch(1);
+    final CountDownLatch completeRunning = new CountDownLatch(1);
+    // Going to create 5 tasks below, so this counter needs to be set to 5.
+    final CountDownLatch tasksCompleteLatch = new CountDownLatch(5);
+
+    supervisor.addTask(new BlockingTask(containerId, deadline, term,
+        indicateRunning, completeRunning));
+    // Wait for the first task to block the single threaded executor
+    indicateRunning.await();
+
+    List<String> completionOrder = new ArrayList<>();
+    // Now load some tasks out of order.
+    clock.fastForward(10);
+    supervisor.addTask(new OrderedTask(containerId, deadline, term, clock,
+        LOW, "LOW_10", completionOrder, tasksCompleteLatch));
+    clock.rewind(5);
+    supervisor.addTask(new OrderedTask(containerId, deadline, term, clock,
+        LOW, "LOW_5", completionOrder, tasksCompleteLatch));
+
+    supervisor.addTask(new OrderedTask(containerId, deadline, term, clock,
+        NORMAL, "HIGH_5", completionOrder, tasksCompleteLatch));
+    clock.rewind(4);
+    supervisor.addTask(new OrderedTask(containerId, deadline, term, clock,
+        NORMAL, "HIGH_1", completionOrder, tasksCompleteLatch));
+    clock.fastForward(10);
+    supervisor.addTask(new OrderedTask(containerId, deadline, term, clock,
+        NORMAL, "HIGH_11", completionOrder, tasksCompleteLatch));
+
+    List<String> expectedOrder = new ArrayList<>();
+    expectedOrder.add("HIGH_1");
+    expectedOrder.add("HIGH_5");

Review Comment:
   :hand:



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

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