fresh-borzoni commented on code in PR #3529:
URL: https://github.com/apache/fluss/pull/3529#discussion_r3478034669
##########
fluss-client/src/main/java/org/apache/fluss/client/write/WriterClient.java:
##########
@@ -176,10 +176,15 @@ private void doSend(WriteRecord record, WriteCallback
callback) {
TableInfo tableInfo = record.getTableInfo();
PhysicalTablePath physicalTablePath =
record.getPhysicalTablePath();
- dynamicPartitionCreator.checkAndCreatePartitionAsync(
- physicalTablePath,
- tableInfo.getPartitionKeys(),
- tableInfo.getTableConfig().getAutoPartitionStrategy());
+ // Skip on non-partitioned tables: the callee returns immediately
when
+ // partitionName is null, but the expensive AutoPartitionStrategy
argument
+ // would still be evaluated per record without this guard.
+ if (tableInfo.isPartitioned()) {
+ dynamicPartitionCreator.checkAndCreatePartitionAsync(
+ physicalTablePath,
+ tableInfo.getPartitionKeys(),
+ tableInfo.getTableConfig().getAutoPartitionStrategy());
Review Comment:
I wonder if instead of caching we can do a bit different.
The strategy is only actually used when a partition gets created, on the
common "already exists" path it's built and thrown away.
Instead of caching it, you could pass tableInfo into
checkAndCreatePartitionAsync and resolve getAutoPartitionStrategy() inside the
create branch.? Then the cached field + its thread-safety reasoning aren't
needed at all
WDYT?
--
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]