JackieTien97 commented on code in PR #18304: URL: https://github.com/apache/iotdb/pull/18304#discussion_r3654158092
########## iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/CorruptedTsFileException.java: ########## @@ -0,0 +1,74 @@ +/* + * 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.iotdb.db.exception; + +import org.apache.tsfile.exception.TsFileRuntimeException; + +import java.io.File; + +/** + * Thrown when a TsFile is detected to be corrupted during query execution. Extends {@link + * TsFileRuntimeException} so it follows the existing TsFile error handling and bypasses all {@code + * catch (IOException)} blocks in the operator hierarchy. + */ +public class CorruptedTsFileException extends TsFileRuntimeException { Review Comment: extends IoTDBRuntimeException, add a new TSStatusCode for it, then add a else-if branch in ErrorHandlingUtils.onQueryException which won't print exception stack and only print message to info log ########## iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/schedule/AbstractDriverThread.java: ########## @@ -93,6 +94,19 @@ public void run() { next.setAbortCause( new IoTDBRuntimeException( rootCause.getMessage(), DATE_OUT_OF_RANGE.getStatusCode(), true)); + } else if (rootCause instanceof CorruptedTsFileException) { + // CorruptedTsFileException no longer chains the original IOException as its + // cause (it uses addSuppressed instead), so getRootCause returns the exception + // itself and we can match it here. + CorruptedTsFileException corruptedTsFileException = + (CorruptedTsFileException) rootCause; + logger.warn( Review Comment: if it's external tsfile, info is enough, for internal tsfile, maybe warn is better. -- 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]
