You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/11/23 13:31:00 UTC

[GitHub] [ignite-3] sergeyuttsel commented on a diff in pull request #1339: IGNITE-18093 Distribution zones

sergeyuttsel commented on code in PR #1339:
URL: https://github.com/apache/ignite-3/pull/1339#discussion_r1030446501


##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneCfg.java:
##########
@@ -0,0 +1,187 @@
+/*
+ * 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.ignite.internal.distributionzones;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Distribution zone configuration.
+ */
+public class DistributionZoneCfg {
+    /** Zone name. */
+    private final String name;
+
+    /** Data nodes auto adjust timeout. */
+    private final Integer dataNodesAutoAdjust;
+
+    /** Data nodes auto adjust scale up timeout. */
+    private final Integer dataNodesAutoAdjustScaleUp;
+
+    /** Data nodes auto adjust scale down timeout. */
+    private final Integer dataNodesAutoAdjustScaleDown;
+
+    /**
+     * The constructor.
+     */
+    public DistributionZoneCfg(String name,
+                               Integer dataNodesAutoAdjust,
+                               Integer dataNodesAutoAdjustScaleUp,
+                               Integer dataNodesAutoAdjustScaleDown) {
+        this.name = name;
+        this.dataNodesAutoAdjust = dataNodesAutoAdjust;
+        this.dataNodesAutoAdjustScaleUp = dataNodesAutoAdjustScaleUp;
+        this.dataNodesAutoAdjustScaleDown = dataNodesAutoAdjustScaleDown;
+    }
+
+    /**
+     * Gets the zone name.
+     *
+     * @return The zone name.
+     */
+    @Nullable

Review Comment:
   fixed



##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneCfg.java:
##########
@@ -0,0 +1,187 @@
+/*
+ * 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.ignite.internal.distributionzones;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Distribution zone configuration.
+ */
+public class DistributionZoneCfg {
+    /** Zone name. */
+    private final String name;
+
+    /** Data nodes auto adjust timeout. */
+    private final Integer dataNodesAutoAdjust;
+
+    /** Data nodes auto adjust scale up timeout. */
+    private final Integer dataNodesAutoAdjustScaleUp;
+
+    /** Data nodes auto adjust scale down timeout. */
+    private final Integer dataNodesAutoAdjustScaleDown;
+
+    /**
+     * The constructor.
+     */
+    public DistributionZoneCfg(String name,
+                               Integer dataNodesAutoAdjust,
+                               Integer dataNodesAutoAdjustScaleUp,
+                               Integer dataNodesAutoAdjustScaleDown) {
+        this.name = name;
+        this.dataNodesAutoAdjust = dataNodesAutoAdjust;
+        this.dataNodesAutoAdjustScaleUp = dataNodesAutoAdjustScaleUp;
+        this.dataNodesAutoAdjustScaleDown = dataNodesAutoAdjustScaleDown;
+    }
+
+    /**
+     * Gets the zone name.
+     *
+     * @return The zone name.
+     */
+    @Nullable
+    public String name() {
+        return name;
+    }
+
+    /**
+     * Gets timeout in seconds between node added or node left topology event itself and data nodes switch.
+     *
+     * @return Data nodes auto adjust timeout.
+     */
+    @Nullable
+    public Integer dataNodesAutoAdjust() {
+        return dataNodesAutoAdjust;
+    }
+
+    /**
+     * Gets timeout in seconds between node added topology event itself and data nodes switch.
+     *
+     * @return Data nodes auto adjust scale up timeout.
+     */
+    @Nullable
+    public Integer dataNodesAutoAdjustScaleUp() {
+        return dataNodesAutoAdjustScaleUp;
+    }
+
+    /**
+     * Gets timeout in seconds between node left topology event itself and data nodes switch.
+     *
+     * @return Data nodes auto adjust scale down timeout.
+     */
+    @Nullable
+    public Integer dataNodesAutoAdjustScaleDown() {
+        return dataNodesAutoAdjustScaleDown;
+    }
+
+    /**
+     * Builder for distribution zone configuration.
+     */
+    public static class Builder {
+        /** Zone name. */
+        private String name;
+
+        /** Data nodes auto adjust timeout. */
+        private Integer dataNodesAutoAdjust;
+
+        /** Data nodes auto adjust scale up timeout. */
+        private Integer dataNodesAutoAdjustScaleUp;
+
+        /** Data nodes auto adjust scale down timeout. */
+        private Integer dataNodesAutoAdjustScaleDown;
+
+        /**
+         * The constructor.
+         */
+        public Builder() {
+
+        }
+
+        /**
+         * Sets zone name.
+         *
+         * @param name Name.
+         * @return This instance.
+         */
+        public Builder name(String name) {
+            this.name = name;
+
+            return this;
+        }
+
+        /**
+         * Sets timeout in seconds between node added or node left topology event itself and data nodes switch.
+         *
+         * @param dataNodesAutoAdjust Timeout.
+         * @return This instance.
+         */
+        public Builder dataNodesAutoAdjust(int dataNodesAutoAdjust) {
+            this.dataNodesAutoAdjust = dataNodesAutoAdjust;
+
+            return this;
+        }
+
+        /**
+         * Sets timeout in seconds between node added topology event itself and data nodes switch.
+         *
+         * @param dataNodesAutoAdjustScaleUp Timeout.
+         * @return This instance.
+         */
+        public Builder dataNodesAutoAdjustScaleUp(int dataNodesAutoAdjustScaleUp) {
+            this.dataNodesAutoAdjustScaleUp = dataNodesAutoAdjustScaleUp;
+
+            return this;
+        }
+
+        /**
+         * Sets timeout in seconds between node left topology event itself and data nodes switch.
+         *
+         * @param dataNodesAutoAdjustScaleDown Timeout in seconds between node left topology event itself
+         *                                     and data nodes switch.
+         * @return This instance.
+         */
+        public Builder dataNodesAutoAdjustScaleDown(int dataNodesAutoAdjustScaleDown) {
+            this.dataNodesAutoAdjustScaleDown = dataNodesAutoAdjustScaleDown;
+
+            return this;
+        }
+
+        /**
+         * Builds the distribution zone configuration.
+         *
+         * @return Distribution zone configuration.
+         */
+        public DistributionZoneCfg build() {
+            if (dataNodesAutoAdjust != null
+                    && (dataNodesAutoAdjustScaleUp != null || dataNodesAutoAdjustScaleDown != null)
+                ) {
+                throw new IllegalArgumentException(
+                        String.format("Not compatible parameters [dataNodesAutoAdjust=%s, "

Review Comment:
   I think it's not needed. The builder is a part of internal api that will be used by SQL module. SQL module will check query before a builder creation. So actually this exception will never be thrown.



##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneCfg.java:
##########
@@ -0,0 +1,187 @@
+/*
+ * 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.ignite.internal.distributionzones;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Distribution zone configuration.
+ */
+public class DistributionZoneCfg {
+    /** Zone name. */
+    private final String name;
+
+    /** Data nodes auto adjust timeout. */
+    private final Integer dataNodesAutoAdjust;
+
+    /** Data nodes auto adjust scale up timeout. */
+    private final Integer dataNodesAutoAdjustScaleUp;
+
+    /** Data nodes auto adjust scale down timeout. */
+    private final Integer dataNodesAutoAdjustScaleDown;
+
+    /**
+     * The constructor.
+     */
+    public DistributionZoneCfg(String name,

Review Comment:
   fixed



-- 
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: notifications-unsubscribe@ignite.apache.org

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