Copilot commented on code in PR #17800: URL: https://github.com/apache/pinot/pull/17800#discussion_r2879700382
########## pinot-spi/src/main/java/org/apache/pinot/spi/utils/PinotMd5Mode.java: ########## @@ -0,0 +1,46 @@ +/** + * 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.pinot.spi.utils; + +/** + * Global runtime switch for disabling MD5-dependent code paths in Pinot. + */ +public class PinotMd5Mode { + private static volatile boolean _pinotMd5Disabled = readFromSystemProperty(); + + private PinotMd5Mode() { + } + + public static synchronized void setPinotMd5Disabled(boolean pinotMd5Disabled) { + _pinotMd5Disabled = pinotMd5Disabled; + } + + public static synchronized boolean isPinotMd5Disabled() { Review Comment: `isPinotMd5Disabled()` (and the setter) are `synchronized` even though the backing field is already `volatile`. This getter is invoked in hot paths (e.g., `HashUtils.hashPrimaryKey(...)` during upsert/dedup hashing), so the monitor enter/exit can become a scalability bottleneck under ingestion load. Consider removing synchronization from the getter (and likely the setter too) and relying on `volatile` (or switching to `AtomicBoolean`) for visibility. ```suggestion public static void setPinotMd5Disabled(boolean pinotMd5Disabled) { _pinotMd5Disabled = pinotMd5Disabled; } public static boolean isPinotMd5Disabled() { ``` ########## pinot-plugins/pinot-file-system/pinot-adls/src/main/java/org/apache/pinot/plugin/filesystem/ADLSGen2PinotFS.java: ########## @@ -123,7 +125,14 @@ public ADLSGen2PinotFS(DataLakeFileSystemClient fileSystemClient) { @Override public void init(PinotConfiguration config) { - _enableChecksum = config.getProperty(ENABLE_CHECKSUM, false); + boolean checksumEnabled = config.getProperty(ENABLE_CHECKSUM, false); + if (checksumEnabled && PinotMd5Mode.isPinotMd5Disabled()) { + throw new IllegalStateException(String.format( + "ADLS checksum requires MD5, but MD5 is disabled via '%s=true'. Set '%s=false' or '%s=false'.", + CommonConstants.CONFIG_OF_PINOT_MD5_DISABLED, CommonConstants.CONFIG_OF_PINOT_MD5_DISABLED, + ENABLE_CHECKSUM)); + } + _enableChecksum = checksumEnabled; Review Comment: The PR description says ADLS checksum should be effectively disabled when `pinot.md5.disabled=true` (and only warn), but the implementation throws an `IllegalStateException` when `enableChecksum=true` and MD5 is disabled. Please align either the behavior (warn + force-disable checksum) or the PR description/tests to match the intended contract, since this changes how existing deployments behave under this configuration. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
