yihua commented on code in PR #13103: URL: https://github.com/apache/hudi/pull/13103#discussion_r2033988717
########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { Review Comment: Similar here on the name: https://github.com/apache/hudi/pull/13103#discussion_r2033985377 ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; Review Comment: Avoid using underscore and split the phrases using dots. Rename to `storage.` to be consistent with the lock provider name. ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " + + "By default, writes to " + LOCKS_FOLDER_NAME + Path.SEPARATOR + + DEFAULT_TABLE_LOCK_FILE_NAME + ".json under the table base path."); + + public static final ConfigProperty<Long> LOCK_VALIDITY_TIMEOUT_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "lock_validity_timeout_ms") + .defaultValue(TimeUnit.MINUTES.toMillis(5)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time each new lock is valid for." + + "The lock provider will attempt to renew its lock until it successful extends the lock lease period" + + "or the validity timeout is reached."); + + public static final ConfigProperty<Long> HEARTBEAT_POLL_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "heartbeat_poll_ms") Review Comment: ```suggestion .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "heartbeat.poll.ms") ``` ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " + + "By default, writes to " + LOCKS_FOLDER_NAME + Path.SEPARATOR + + DEFAULT_TABLE_LOCK_FILE_NAME + ".json under the table base path."); + + public static final ConfigProperty<Long> LOCK_VALIDITY_TIMEOUT_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "lock_validity_timeout_ms") + .defaultValue(TimeUnit.MINUTES.toMillis(5)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time each new lock is valid for." + + "The lock provider will attempt to renew its lock until it successful extends the lock lease period" + + "or the validity timeout is reached."); + + public static final ConfigProperty<Long> HEARTBEAT_POLL_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "heartbeat_poll_ms") + .defaultValue(TimeUnit.SECONDS.toMillis(30)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time to wait before renewing the lock. Defaults to 30 seconds."); + + public long getLockValidityTimeoutMs() { + return getLong(LOCK_VALIDITY_TIMEOUT_MS); + } + + public long getHeartbeatPollMs() { + return getLong(HEARTBEAT_POLL_MS); + } + + public String getHudiTableBasePath() { + // Required!! Review Comment: nit: remove ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " + + "By default, writes to " + LOCKS_FOLDER_NAME + Path.SEPARATOR + + DEFAULT_TABLE_LOCK_FILE_NAME + ".json under the table base path."); + + public static final ConfigProperty<Long> LOCK_VALIDITY_TIMEOUT_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "lock_validity_timeout_ms") + .defaultValue(TimeUnit.MINUTES.toMillis(5)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time each new lock is valid for." + + "The lock provider will attempt to renew its lock until it successful extends the lock lease period" + + "or the validity timeout is reached."); + + public static final ConfigProperty<Long> HEARTBEAT_POLL_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "heartbeat_poll_ms") + .defaultValue(TimeUnit.SECONDS.toMillis(30)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time to wait before renewing the lock. Defaults to 30 seconds."); + + public long getLockValidityTimeoutMs() { + return getLong(LOCK_VALIDITY_TIMEOUT_MS); + } + + public long getHeartbeatPollMs() { + return getLong(HEARTBEAT_POLL_MS); + } + + public String getHudiTableBasePath() { + // Required!! + return getString(BASE_PATH.key()); + } + + public String getLocksLocation() { + return getString(LOCK_INTERNAL_STORAGE_LOCATION); + } + + public static class Builder { + private final ConditionalWriteLockConfig lockConfig = new ConditionalWriteLockConfig(); + + public ConditionalWriteLockConfig build() { + lockConfig.setDefaults(ConditionalWriteLockConfig.class.getName()); + return lockConfig; + } + + public ConditionalWriteLockConfig.Builder fromProperties(TypedProperties props) { + lockConfig.getProps().putAll(props); + checkRequiredProps(); + return this; + } + + private void checkRequiredProps() { + String notExistsMsg = " does not exist!"; + if (Boolean.FALSE.equals(lockConfig.contains(BASE_PATH.key()))) { Review Comment: `!lockConfig.contains(BASE_PATH.key())` should work? ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " Review Comment: ```suggestion "For storage-based lock provider, the optional URI where lock files are written. " ``` ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") Review Comment: ```suggestion .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "location") ``` ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " Review Comment: ```suggestion + "Must be the same filesystem as the table path and should support conditional writes. " ``` ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " + + "By default, writes to " + LOCKS_FOLDER_NAME + Path.SEPARATOR + + DEFAULT_TABLE_LOCK_FILE_NAME + ".json under the table base path."); + + public static final ConfigProperty<Long> LOCK_VALIDITY_TIMEOUT_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "lock_validity_timeout_ms") + .defaultValue(TimeUnit.MINUTES.toMillis(5)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time each new lock is valid for." + + "The lock provider will attempt to renew its lock until it successful extends the lock lease period" + + "or the validity timeout is reached."); + + public static final ConfigProperty<Long> HEARTBEAT_POLL_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "heartbeat_poll_ms") + .defaultValue(TimeUnit.SECONDS.toMillis(30)) Review Comment: Similar here, should the unit be "second" so it's easier to config and read? ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX Review Comment: Rename variable name. ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " + + "By default, writes to " + LOCKS_FOLDER_NAME + Path.SEPARATOR + + DEFAULT_TABLE_LOCK_FILE_NAME + ".json under the table base path."); + + public static final ConfigProperty<Long> LOCK_VALIDITY_TIMEOUT_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "lock_validity_timeout_ms") + .defaultValue(TimeUnit.MINUTES.toMillis(5)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time each new lock is valid for." + + "The lock provider will attempt to renew its lock until it successful extends the lock lease period" + + "or the validity timeout is reached."); + + public static final ConfigProperty<Long> HEARTBEAT_POLL_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "heartbeat_poll_ms") + .defaultValue(TimeUnit.SECONDS.toMillis(30)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time to wait before renewing the lock. Defaults to 30 seconds."); Review Comment: ```suggestion "For storage-based conditional write lock provider, the amount of time to wait before renewing the lock. Defaults to 30 seconds."); ``` ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " + + "By default, writes to " + LOCKS_FOLDER_NAME + Path.SEPARATOR + + DEFAULT_TABLE_LOCK_FILE_NAME + ".json under the table base path."); + + public static final ConfigProperty<Long> LOCK_VALIDITY_TIMEOUT_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "lock_validity_timeout_ms") + .defaultValue(TimeUnit.MINUTES.toMillis(5)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time each new lock is valid for." + + "The lock provider will attempt to renew its lock until it successful extends the lock lease period" Review Comment: ```suggestion + "The lock provider will attempt to renew its lock until it successfully extends the lock lease period " ``` ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " + + "By default, writes to " + LOCKS_FOLDER_NAME + Path.SEPARATOR + + DEFAULT_TABLE_LOCK_FILE_NAME + ".json under the table base path."); + + public static final ConfigProperty<Long> LOCK_VALIDITY_TIMEOUT_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "lock_validity_timeout_ms") Review Comment: ```suggestion .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "validity.timeout.ms") ``` ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " + + "By default, writes to " + LOCKS_FOLDER_NAME + Path.SEPARATOR + + DEFAULT_TABLE_LOCK_FILE_NAME + ".json under the table base path."); + + public static final ConfigProperty<Long> LOCK_VALIDITY_TIMEOUT_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "lock_validity_timeout_ms") + .defaultValue(TimeUnit.MINUTES.toMillis(5)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time each new lock is valid for." Review Comment: ```suggestion "For storage-based lock provider, the amount of time each new lock is valid for. " ``` ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " + + "By default, writes to " + LOCKS_FOLDER_NAME + Path.SEPARATOR + + DEFAULT_TABLE_LOCK_FILE_NAME + ".json under the table base path."); + + public static final ConfigProperty<Long> LOCK_VALIDITY_TIMEOUT_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "lock_validity_timeout_ms") + .defaultValue(TimeUnit.MINUTES.toMillis(5)) + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For storage based conditional write lock provider, the amount of time each new lock is valid for." Review Comment: For simplicity, the docs can use `storage-based lock provider` instead of `storage-based conditional write lock provider`. ########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/ConditionalWriteLockConfig.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.hudi.client.transaction.lock; + +import org.apache.hudi.common.config.ConfigProperty; +import org.apache.hudi.common.config.HoodieConfig; +import org.apache.hudi.common.config.LockConfiguration; +import org.apache.hudi.common.config.TypedProperties; + +import org.apache.hadoop.fs.Path; + +import java.util.concurrent.TimeUnit; + +import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH; +import static org.apache.hudi.client.transaction.lock.ConditionalWriteLockProvider.DEFAULT_TABLE_LOCK_FILE_NAME; +import static org.apache.hudi.common.table.HoodieTableMetaClient.LOCKS_FOLDER_NAME; + +public class ConditionalWriteLockConfig extends HoodieConfig { + private static final String SINCE_VERSION_1_0_2 = "1.0.2"; + private static final String CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX = LockConfiguration.LOCK_PREFIX + + "conditional_write."; + public static final ConfigProperty<String> LOCK_INTERNAL_STORAGE_LOCATION = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "locks_location") + .defaultValue("") + .markAdvanced() + .sinceVersion(SINCE_VERSION_1_0_2) + .withDocumentation( + "For conditional write based lock provider, the optional URI where lock files are written. " + + "Must be the same filesystem as the table path and should conditional writes. " + + "By default, writes to " + LOCKS_FOLDER_NAME + Path.SEPARATOR + + DEFAULT_TABLE_LOCK_FILE_NAME + ".json under the table base path."); + + public static final ConfigProperty<Long> LOCK_VALIDITY_TIMEOUT_MS = ConfigProperty + .key(CONDITIONAL_WRITE_LOCK_PROPERTY_PREFIX + "lock_validity_timeout_ms") + .defaultValue(TimeUnit.MINUTES.toMillis(5)) Review Comment: If the value should never be below 1s, should the unit be "second" so it's easier to config and read? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
