You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/01/06 06:18:50 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #8717: Configurable data source for offloaded messages

sijie commented on a change in pull request #8717:
URL: https://github.com/apache/pulsar/pull/8717#discussion_r552390207



##########
File path: pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
##########
@@ -1336,11 +1338,35 @@ void run() throws PulsarAdminException {
                 , description = "ManagedLedger offload deletion lag in bytes")
         private Long offloadDeletionLagInMillis;
 
+        @Parameter(
+                names = {"--offloadedReadPriority", "-orp"},
+                description = "read priority for offloaded messages",
+                required = false
+        )
+        private String offloadReadPriorityStr;
+
         @Override
         void run() throws PulsarAdminException {
             String persistentTopic = validatePersistentTopic(params);
+
+            OffloadedReadPriority offloadedReadPriority = OffloadPolicies.DEFAULT_OFFLOADED_READ_PRIORITY;
+
+            if (this.offloadReadPriorityStr != null) {
+                try {
+                    offloadedReadPriority = OffloadedReadPriority.fromString(this.offloadReadPriorityStr);
+                    System.out.println("offloadedReadPriority = " + offloadedReadPriority);

Review comment:
       @Renkai Can we avoid using `System.out.println`?

##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/OffloadPolicies.java
##########
@@ -42,9 +46,58 @@
 @Data
 public class OffloadPolicies implements Serializable {
 
+    @InterfaceAudience.Public
+    @InterfaceStability.Stable
+    public enum OffloadedReadPriority {
+        /**
+         * For offloaded messages, readers will try to read from bookkeeper at first,
+         * if messages not exist at bookkeeper then read from offloaded storage.
+         */
+        BOOKKEEPER_FIRST("bookkeeper-first"),
+        /**
+         * For offloaded messages, readers will try to read from offloaded storage first,
+         * even they are still exist in bookkeeper.
+         */
+        OFFLOADED_FIRST("offloaded-first");

Review comment:
       I would suggest renaming `OFFLOADED_FIRST` to `TIERED_STORAGE_FIRST`.

##########
File path: pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
##########
@@ -1788,10 +1796,25 @@ void run() throws PulsarAdminException {
                     offloadAfterThresholdInBytes = offloadAfterThreshold;
                 }
             }
+            OffloadedReadPriority offloadedReadPriority = OffloadPolicies.DEFAULT_OFFLOADED_READ_PRIORITY;
+
+            if (this.offloadReadPriorityStr != null) {
+                try {
+                    offloadedReadPriority = OffloadedReadPriority.fromString(this.offloadReadPriorityStr);
+                    System.out.println("offloadedReadPriority = " + offloadedReadPriority);

Review comment:
       @Renkai Can we avoid using `System.out.println`?




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