-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-5023] Switching default Write Executor type to SIMPLE
#7476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4611e79
b91d344
0c4ab58
a3544b9
b6c60a0
d9c17b3
e3ea066
bb322f5
6a6bced
0173a0e
dcdbe36
9956563
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,8 @@ | |
| import org.apache.hudi.common.util.ReflectionUtils; | ||
| import org.apache.hudi.common.util.StringUtils; | ||
| import org.apache.hudi.common.util.ValidationUtils; | ||
| import org.apache.hudi.common.util.VisibleForTesting; | ||
| import org.apache.hudi.common.util.queue.DisruptorWaitStrategyType; | ||
| import org.apache.hudi.common.util.queue.ExecutorType; | ||
| import org.apache.hudi.config.metrics.HoodieMetricsCloudWatchConfig; | ||
| import org.apache.hudi.config.metrics.HoodieMetricsConfig; | ||
|
|
@@ -97,8 +99,7 @@ | |
| import java.util.function.Supplier; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import static org.apache.hudi.common.util.queue.ExecutorType.BOUNDED_IN_MEMORY; | ||
| import static org.apache.hudi.common.util.queue.ExecutorType.DISRUPTOR; | ||
| import static org.apache.hudi.common.util.queue.ExecutorType.SIMPLE; | ||
| import static org.apache.hudi.config.HoodieCleanConfig.CLEANER_POLICY; | ||
| import static org.apache.hudi.table.marker.ConflictDetectionUtils.getDefaultEarlyConflictDetectionStrategy; | ||
|
|
||
|
|
@@ -158,10 +159,10 @@ public class HoodieWriteConfig extends HoodieConfig { | |
| .withDocumentation("Key generator class, that implements `org.apache.hudi.keygen.KeyGenerator` " | ||
| + "extract a key out of incoming records."); | ||
|
|
||
| public static final ConfigProperty<String> EXECUTOR_TYPE = ConfigProperty | ||
| public static final ConfigProperty<String> WRITE_EXECUTOR_TYPE = ConfigProperty | ||
| .key("hoodie.write.executor.type") | ||
| .defaultValue(BOUNDED_IN_MEMORY.name()) | ||
| .withValidValues(BOUNDED_IN_MEMORY.name(), DISRUPTOR.name()) | ||
| .defaultValue(SIMPLE.name()) | ||
| .withValidValues(Arrays.stream(ExecutorType.values()).map(Enum::name).toArray(String[]::new)) | ||
| .sinceVersion("0.13.0") | ||
| .withDocumentation("Set executor which orchestrates concurrent producers and consumers communicating through a message queue." | ||
| + "BOUNDED_IN_MEMORY(default): Use LinkedBlockingQueue as a bounded in-memory queue, this queue will use extra lock to balance producers and consumer" | ||
|
|
@@ -271,15 +272,15 @@ public class HoodieWriteConfig extends HoodieConfig { | |
| .defaultValue(String.valueOf(4 * 1024 * 1024)) | ||
| .withDocumentation("Size of in-memory buffer used for parallelizing network reads and lake storage writes."); | ||
|
|
||
| public static final ConfigProperty<String> WRITE_DISRUPTOR_BUFFER_SIZE = ConfigProperty | ||
| public static final ConfigProperty<String> WRITE_EXECUTOR_DISRUPTOR_BUFFER_SIZE = ConfigProperty | ||
| .key("hoodie.write.executor.disruptor.buffer.size") | ||
| .defaultValue(String.valueOf(1024)) | ||
| .sinceVersion("0.13.0") | ||
| .withDocumentation("The size of the Disruptor Executor ring buffer, must be power of 2"); | ||
|
|
||
| public static final ConfigProperty<String> WRITE_WAIT_STRATEGY = ConfigProperty | ||
| public static final ConfigProperty<String> WRITE_EXECUTOR_DISRUPTOR_WAIT_STRATEGY = ConfigProperty | ||
| .key("hoodie.write.executor.disruptor.wait.strategy") | ||
| .defaultValue("BLOCKING_WAIT") | ||
| .defaultValue(DisruptorWaitStrategyType.BLOCKING_WAIT.name()) | ||
| .sinceVersion("0.13.0") | ||
| .withDocumentation("Strategy employed for making Disruptor Executor wait on a cursor. Other options are " | ||
| + "SLEEPING_WAIT, it attempts to be conservative with CPU usage by using a simple busy wait loop" | ||
|
|
@@ -1107,7 +1108,7 @@ public String getKeyGeneratorClass() { | |
| } | ||
|
|
||
| public ExecutorType getExecutorType() { | ||
| return ExecutorType.valueOf(getStringOrDefault(EXECUTOR_TYPE).toUpperCase(Locale.ROOT)); | ||
| return ExecutorType.valueOf(getStringOrDefault(WRITE_EXECUTOR_TYPE).toUpperCase(Locale.ROOT)); | ||
| } | ||
|
|
||
| public boolean isCDCEnabled() { | ||
|
|
@@ -1175,12 +1176,12 @@ public int getWriteBufferLimitBytes() { | |
| return Integer.parseInt(getStringOrDefault(WRITE_BUFFER_LIMIT_BYTES_VALUE)); | ||
| } | ||
|
|
||
| public Option<String> getWriteExecutorWaitStrategy() { | ||
| return Option.of(getString(WRITE_WAIT_STRATEGY)); | ||
| public String getWriteExecutorDisruptorWaitStrategy() { | ||
| return getStringOrDefault(WRITE_EXECUTOR_DISRUPTOR_WAIT_STRATEGY); | ||
| } | ||
|
|
||
| public Option<Integer> getDisruptorWriteBufferSize() { | ||
| return Option.of(Integer.parseInt(getStringOrDefault(WRITE_DISRUPTOR_BUFFER_SIZE))); | ||
| public Integer getWriteExecutorDisruptorWriteBufferSize() { | ||
| return Integer.parseInt(getStringOrDefault(WRITE_EXECUTOR_DISRUPTOR_BUFFER_SIZE)); | ||
| } | ||
|
|
||
| public boolean shouldCombineBeforeInsert() { | ||
|
|
@@ -1987,7 +1988,7 @@ public ApiSite getDatadogApiSite() { | |
| public String getDatadogApiKey() { | ||
| if (props.containsKey(HoodieMetricsDatadogConfig.API_KEY.key())) { | ||
| return getString(HoodieMetricsDatadogConfig.API_KEY); | ||
|
|
||
| } else { | ||
| Supplier<String> apiKeySupplier = ReflectionUtils.loadClass( | ||
| getString(HoodieMetricsDatadogConfig.API_KEY_SUPPLIER)); | ||
|
|
@@ -2481,7 +2482,7 @@ public Builder withKeyGenerator(String keyGeneratorClass) { | |
| } | ||
|
|
||
| public Builder withExecutorType(String executorClass) { | ||
| writeConfig.setValue(EXECUTOR_TYPE, executorClass); | ||
| writeConfig.setValue(WRITE_EXECUTOR_TYPE, executorClass); | ||
| return this; | ||
| } | ||
|
|
||
|
|
@@ -2536,13 +2537,13 @@ public Builder withWriteBufferLimitBytes(int writeBufferLimit) { | |
| return this; | ||
| } | ||
|
|
||
| public Builder withWriteWaitStrategy(String waitStrategy) { | ||
| writeConfig.setValue(WRITE_WAIT_STRATEGY, String.valueOf(waitStrategy)); | ||
| public Builder withWriteExecutorDisruptorWaitStrategy(String waitStrategy) { | ||
| writeConfig.setValue(WRITE_EXECUTOR_DISRUPTOR_WAIT_STRATEGY, String.valueOf(waitStrategy)); | ||
| return this; | ||
| } | ||
|
|
||
| public Builder withWriteBufferSize(int size) { | ||
| writeConfig.setValue(WRITE_DISRUPTOR_BUFFER_SIZE, String.valueOf(size)); | ||
| public Builder withWriteExecutorDisruptorWriteBufferSize(long size) { | ||
| writeConfig.setValue(WRITE_EXECUTOR_DISRUPTOR_BUFFER_SIZE, String.valueOf(size)); | ||
| return this; | ||
| } | ||
|
|
||
|
|
@@ -2970,8 +2971,15 @@ private void validate() { | |
| } | ||
|
|
||
| public HoodieWriteConfig build() { | ||
| return build(true); | ||
| } | ||
|
|
||
| @VisibleForTesting | ||
| public HoodieWriteConfig build(boolean shouldValidate) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this method use the default scope/visibility instead of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Problem is that it's being used in tests in different packages
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. We should think about how to hide this, so it is not used by users accidentally. |
||
| setDefaults(); | ||
| validate(); | ||
| if (shouldValidate) { | ||
| validate(); | ||
| } | ||
| // Build WriteConfig at the end | ||
| return new HoodieWriteConfig(engineType, writeConfig.getProps()); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Let's take this in a separate PR) What is the unit of this config (B, KB, or MB)? We should mention the unit in the config naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline: will follow-up w/ separate PR addressing this