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 2022/03/15 01:30:03 UTC

[GitHub] [pulsar] mattisonchao opened a new pull request #14684: Enhance fault tolerance when set auto topic creation

mattisonchao opened a new pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684


   ### Motivation
   
   We mention in the documentation that setting ``--num-partitions `` is not allowed when the user wants to use a non-partitioned AutoTopicCreation configuration. 
   
   ![Uploading image.png…]()
   
   But some users ignore this and get errors like:
   
   > Reason: Invalid configuration for autoTopicCreationOverride
   
   IMO, it's a bit confusing, not telling the user where they are invalid.
   For good fault tolerance, I think we can support the system to automatically correct such errors.
   
   ### Modifications
   
   - Support systems can automatic correct faults.
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   ### Documentation
   
   - [x] `no-need-doc` 
    
   
   


-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] mattisonchao commented on pull request #14684: Provide an accurate error message when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684#issuecomment-1067652577


   /pulsarbot rerun-failure-checks


-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] mattisonchao commented on a change in pull request #14684: Provide an accurate error message when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on a change in pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684#discussion_r827561550



##########
File path: pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ValidateResult.java
##########
@@ -0,0 +1,42 @@
+/**
+ * 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.pulsar.common.policies.data;
+
+import lombok.EqualsAndHashCode;

Review comment:
       ```suggestion
   ```

##########
File path: pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ValidateResult.java
##########
@@ -0,0 +1,42 @@
+/**
+ * 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.pulsar.common.policies.data;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;

Review comment:
       ```suggestion
   ```




-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] mattisonchao commented on pull request #14684: Enhance fault tolerance when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684#issuecomment-1067522612


   /pulsarbot rerun-failure-checks


-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] Technoboy- commented on a change in pull request #14684: Provide an accurate error message when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on a change in pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684#discussion_r827004026



##########
File path: pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ValidateResult.java
##########
@@ -0,0 +1,44 @@
+/**
+ * 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.pulsar.common.policies.data;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+
+@Getter
+@ToString
+@EqualsAndHashCode

Review comment:
       Remove `ToString` and `EqualsAndHashCode`




-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] mattisonchao commented on a change in pull request #14684: Provide an accurate error message when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on a change in pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684#discussion_r827560697



##########
File path: pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ValidateResult.java
##########
@@ -0,0 +1,44 @@
+/**
+ * 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.pulsar.common.policies.data;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+
+@Getter
+@ToString
+@EqualsAndHashCode

Review comment:
       Fixed, PTAL :)




-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] mattisonchao commented on a change in pull request #14684: Provide an accurate error message when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on a change in pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684#discussion_r827560281



##########
File path: pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ValidateResult.java
##########
@@ -0,0 +1,44 @@
+/**
+ * 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.pulsar.common.policies.data;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+
+@Getter
+@ToString

Review comment:
       ```suggestion
   ```

##########
File path: pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ValidateResult.java
##########
@@ -0,0 +1,44 @@
+/**
+ * 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.pulsar.common.policies.data;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+
+@Getter
+@ToString
+@EqualsAndHashCode

Review comment:
       ```suggestion
   ```




-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] codelipenghui merged pull request #14684: Provide an accurate error message when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684


   


-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] codelipenghui commented on a change in pull request #14684: Enhance fault tolerance when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684#discussion_r826577183



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -831,8 +831,11 @@ protected void internalSetAutoTopicCreation(AsyncResponse asyncResponse,
         validatePoliciesReadOnlyAccess();
         if (autoTopicCreationOverride != null) {
             if (!AutoTopicCreationOverrideImpl.isValidOverride(autoTopicCreationOverride)) {
-                throw new RestException(Status.PRECONDITION_FAILED,
-                        "Invalid configuration for autoTopicCreationOverride");
+                // To enhance error tolerance, automatic error correction
+                if (!autoTopicCreationOverride.autoFix()) {
+                    throw new RestException(Status.PRECONDITION_FAILED,
+                            "Invalid configuration for autoTopicCreationOverride");
+                }

Review comment:
       I think we should provide an accurate error message, not introduce auto-fix here. It will make the API more clear and straightforward




-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] mattisonchao commented on pull request #14684: Provide an accurate error message when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684#issuecomment-1068698228


   /pulsarbot rerun-failure-checks


-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] codelipenghui merged pull request #14684: Provide an accurate error message when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684


   


-- 
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@pulsar.apache.org

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



[GitHub] [pulsar] mattisonchao commented on a change in pull request #14684: Enhance fault tolerance when set ``autoTopicCreation ``

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on a change in pull request #14684:
URL: https://github.com/apache/pulsar/pull/14684#discussion_r826599052



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -831,8 +831,11 @@ protected void internalSetAutoTopicCreation(AsyncResponse asyncResponse,
         validatePoliciesReadOnlyAccess();
         if (autoTopicCreationOverride != null) {
             if (!AutoTopicCreationOverrideImpl.isValidOverride(autoTopicCreationOverride)) {
-                throw new RestException(Status.PRECONDITION_FAILED,
-                        "Invalid configuration for autoTopicCreationOverride");
+                // To enhance error tolerance, automatic error correction
+                if (!autoTopicCreationOverride.autoFix()) {
+                    throw new RestException(Status.PRECONDITION_FAILED,
+                            "Invalid configuration for autoTopicCreationOverride");
+                }

Review comment:
       Fixed, PTAL :)




-- 
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@pulsar.apache.org

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