You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/12/06 17:47:41 UTC

[GitHub] [pinot] npawar commented on a diff in pull request #9705: Allow to configure multi-datadirs as instance configs and a Quickstart example about them

npawar commented on code in PR #9705:
URL: https://github.com/apache/pinot/pull/9705#discussion_r1041263917


##########
pinot-tools/src/main/java/org/apache/pinot/tools/MultiDirQuickstart.java:
##########
@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.tools;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.pinot.tools.admin.PinotAdministrator;
+import org.apache.pinot.tools.admin.command.QuickstartRunner;
+
+
+/**
+ * A Quickstart to demo how multi directory support works and its typical configs.
+ */
+public class MultiDirQuickstart extends Quickstart {
+  @Override
+  public List<String> types() {
+    return Arrays.asList("OFFLINE_MULTIDIR", "OFFLINE-MULTIDIR", "BATCH_MULTIDIR", "BATCH-MULTIDIR");
+  }
+
+  @Override
+  protected Map<String, Object> getConfigOverrides() {
+    Map<String, Object> properties = new HashMap<>(super.getConfigOverrides());
+    properties.put("pinot.server.instance.segment.directory.loader", "tierBased");
+    properties.put("controller.segment.relocator.frequencyPeriod", "60s");
+    properties.put("controller.segmentRelocator.initialDelayInSeconds", "10");
+    properties.put("controller.segmentRelocator.enableLocalTierMigration", "true");
+    /*
+     * One can also set `dataDir` as part of tierConfigs in TableConfig to overwrite the instance configs (or set as
+     * cluster configs), but it's recommended to use instance (or cluster) configs for consistency across tables.
+     * "tierBackendProperties": {
+     *     "dataDir": "/tmp/multidir_test/hotTier"
+     *  }
+     */
+    properties.put("pinot.server.instance.tierConfigs.0.tierName", "hotTier");

Review Comment:
   we can put these in cluster config as well? 



##########
pinot-tools/src/main/java/org/apache/pinot/tools/MultiDirQuickstart.java:
##########
@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.tools;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.pinot.tools.admin.PinotAdministrator;
+import org.apache.pinot.tools.admin.command.QuickstartRunner;
+
+
+/**
+ * A Quickstart to demo how multi directory support works and its typical configs.
+ */
+public class MultiDirQuickstart extends Quickstart {
+  @Override
+  public List<String> types() {
+    return Arrays.asList("OFFLINE_MULTIDIR", "OFFLINE-MULTIDIR", "BATCH_MULTIDIR", "BATCH-MULTIDIR");
+  }
+
+  @Override
+  protected Map<String, Object> getConfigOverrides() {
+    Map<String, Object> properties = new HashMap<>(super.getConfigOverrides());
+    properties.put("pinot.server.instance.segment.directory.loader", "tierBased");
+    properties.put("controller.segment.relocator.frequencyPeriod", "60s");
+    properties.put("controller.segmentRelocator.initialDelayInSeconds", "10");
+    properties.put("controller.segmentRelocator.enableLocalTierMigration", "true");
+    /*
+     * One can also set `dataDir` as part of tierConfigs in TableConfig to overwrite the instance configs (or set as
+     * cluster configs), but it's recommended to use instance (or cluster) configs for consistency across tables.
+     * "tierBackendProperties": {
+     *     "dataDir": "/tmp/multidir_test/hotTier"
+     *  }
+     */
+    properties.put("pinot.server.instance.tierConfigs.0.tierName", "hotTier");
+    properties.put("pinot.server.instance.tierConfigs.0.dataDir", "/tmp/multidir_test/hotTier");
+    properties.put("pinot.server.instance.tierConfigs.1.tierName", "coldTier");
+    properties.put("pinot.server.instance.tierConfigs.1.dataDir", "/tmp/multidir_test/coldTier");

Review Comment:
   looks like this "0" and "1" can be anything at all, and is being used just to distinguish the keys. would it be better to have this instead? this is also how we do it in FS configs I think
   ```
   pinot.server.instance.tierConfigs.tierNames=hotTier,coldTier
   pinot.server.instance.tierConfigs.hotTier.dataDir=/tmp/multidir_test/hotTier
   pinot.server.instance.tierConfigs.coldTier.dataDir=/tmp/multidir_test/coldTier
   ```



##########
pinot-tools/src/main/resources/examples/batch/airlineStats/airlineStats_offline_table_config.json:
##########
@@ -40,5 +42,21 @@
         "transformFunction": "fromEpochDays(DaysSinceEpoch)"
       }
     ]
-  }
+  },
+  "tierConfigs": [
+    {

Review Comment:
   wont setting this config automatically make all quickstarts do tier movements? as SegmentRelocator is on by default?



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org