Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ public enum TSStatusCode {
PIPE_PUSH_META_TIMEOUT(1813),
PIPE_PUSH_META_NOT_ENOUGH_MEMORY(1814),
PIPE_RECEIVER_PARALLEL_OR_USER_CONFLICT_EXCEPTION(1815),
PIPE_TRANSFER_FILE_STRUCTURE_CORRUPTION(1816),

// Subscription
SUBSCRIPTION_VERSION_ERROR(1900),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3204,6 +3204,14 @@ private DataNodePipeMessages() {}
"Deletion resource manager for DataRegion %s is closed or deleted.";
public static final String LOG_DELETION_PERSIST_ARG_TIMED_OUT_WAITING_FOR_ARG_DELETIONS_TO_FLUSH_BEFORE_SHUTDOWN_52469B0D =
"Deletion persist-{}: timed out waiting for {} deletions to flush before shutdown.";
public static final String MESSAGE_PIPE_TRANSFER_CRC_MISMATCH_CRC_MISMATCH_EXPECTED_ARG_BUT_RECEIVED_ARG_AD3D3CBD =
"[PIPE_TRANSFER_CRC_MISMATCH] CRC mismatch: expected %d but received %d";
public static final String LOG_RECEIVER_REPORTED_STRUCTURAL_CORRUPTION_IN_TSFILE_ARG_SENDER_SHA_256_ARG_RECEIVER_STATUS_ARG_026A14BB =
"Receiver reported structural corruption in TsFile {}; sender SHA-256: {}; receiver status: {}";
public static final String LOG_CRC_MISMATCH_WHILE_TRANSFERRING_TSFILE_ARG_SENDER_SHA_256_ARG_NETWORK_TRANSMISSION_CORRUPTED_THE_PAYLOAD_ARG_DE6B6FAD =
"CRC mismatch while transferring TsFile {} (sender SHA-256: {}); network transmission corrupted the payload: {}";
public static final String LOG_FAILED_TO_ENFORCE_MAXIMUM_SIZE_FOR_ACTIVE_LOAD_FAILURE_DIRECTORY_ARG_D2F9631D =
"Failed to enforce maximum size for active load failure directory {}.";

public static final String
LOG_TABLET_OF_TABLE_ARG_ESTIMATED_ARG_ROWS_ARG_BYTES_FILLED_ARG_ROWS_ARG_BYTES_B6C86C00 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1912,4 +1912,6 @@ private StorageEngineMessages() {}
"source files are cleaned up";

public static final String EXCEPTION_TASK_FINISHED_A075ACB1 = "task finished";
public static final String EXCEPTION_TSFILE_STRUCTURE_CORRUPTION_TSFILE_ARG_IS_STRUCTURALLY_CORRUPTED_AT_OFFSET_ARG_1_MEANS_UNKNOWN_SHA_256_ARG_ARG_71F6105D =
"[TSFILE_STRUCTURE_CORRUPTION] TsFile %s is structurally corrupted at offset %d (-1 means unknown; SHA-256: %s): %s";
}
Original file line number Diff line number Diff line change
Expand Up @@ -2977,6 +2977,14 @@ private DataNodePipeMessages() {}
"DataRegion %s 的删除资源管理器已关闭或已删除。";
public static final String LOG_DELETION_PERSIST_ARG_TIMED_OUT_WAITING_FOR_ARG_DELETIONS_TO_FLUSH_BEFORE_SHUTDOWN_52469B0D =
"Deletion persist-{}:关闭前等待 {} 条删除记录持久化超时。";
public static final String MESSAGE_PIPE_TRANSFER_CRC_MISMATCH_CRC_MISMATCH_EXPECTED_ARG_BUT_RECEIVED_ARG_AD3D3CBD =
"[PIPE_TRANSFER_CRC_MISMATCH] CRC 不匹配:预期值 %d,实际值 %d";
public static final String LOG_RECEIVER_REPORTED_STRUCTURAL_CORRUPTION_IN_TSFILE_ARG_SENDER_SHA_256_ARG_RECEIVER_STATUS_ARG_026A14BB =
"接收端报告 TsFile {} 结构损坏;发送端 SHA-256: {};接收端状态:{}";
public static final String LOG_CRC_MISMATCH_WHILE_TRANSFERRING_TSFILE_ARG_SENDER_SHA_256_ARG_NETWORK_TRANSMISSION_CORRUPTED_THE_PAYLOAD_ARG_DE6B6FAD =
"传输 TsFile {} 时 CRC 不匹配(发送端 SHA-256: {});网络传输导致数据包损坏:{}";
public static final String LOG_FAILED_TO_ENFORCE_MAXIMUM_SIZE_FOR_ACTIVE_LOAD_FAILURE_DIRECTORY_ARG_D2F9631D =
"无法限制 Active LOAD 失败目录 {} 的最大大小。";

public static final String
LOG_TABLET_OF_TABLE_ARG_ESTIMATED_ARG_ROWS_ARG_BYTES_FILLED_ARG_ROWS_ARG_BYTES_B6C86C00 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1814,4 +1814,6 @@ private StorageEngineMessages() {}
public static final String EXCEPTION_SOURCE_FILES_ARE_CLEANED_UP_83638D68 = "源文件已清理";

public static final String EXCEPTION_TASK_FINISHED_A075ACB1 = "任务已完成";
public static final String EXCEPTION_TSFILE_STRUCTURE_CORRUPTION_TSFILE_ARG_IS_STRUCTURALLY_CORRUPTED_AT_OFFSET_ARG_1_MEANS_UNKNOWN_SHA_256_ARG_ARG_71F6105D =
"[TSFILE_STRUCTURE_CORRUPTION] TsFile %s 在偏移 %d 处发生结构损坏(-1 表示未知;SHA-256: %s):%s";
}
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,7 @@ public class IoTDBConfig implements DefaultEncodingProvider {
+ IoTDBConstant.LOAD_TSFILE_FOLDER_NAME
+ File.separator
+ IoTDBConstant.LOAD_TSFILE_ACTIVE_LISTENING_FAILED_FOLDER_NAME;
private long loadActiveListeningFailDirMaxSizeInBytes = 100L * 1024 * 1024;
private long loadActiveListeningCheckIntervalSeconds = 5L;

private int loadActiveListeningMaxThreadNum = Runtime.getRuntime().availableProcessors();
Expand Down Expand Up @@ -4464,6 +4465,16 @@ public void setLoadActiveListeningFailDir(String loadActiveListeningFailDir) {
this.loadActiveListeningFailDir = addDataHomeDir(loadActiveListeningFailDir);
}

public long getLoadActiveListeningFailDirMaxSizeInBytes() {
return loadActiveListeningFailDirMaxSizeInBytes;
}

public void setLoadActiveListeningFailDirMaxSizeInBytes(
final long loadActiveListeningFailDirMaxSizeInBytes) {
this.loadActiveListeningFailDirMaxSizeInBytes =
Math.max(0, loadActiveListeningFailDirMaxSizeInBytes);
}

public String getLoadActiveListeningPipeDir() {
return loadActiveListeningPipeDir == null || Objects.equals(loadActiveListeningPipeDir, "")
? extDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2690,6 +2690,11 @@ private void loadLoadTsFileProps(TrimProperties properties) {
conf.setLoadActiveListeningFailDir(
properties.getProperty(
"load_active_listening_fail_dir", conf.getLoadActiveListeningFailDir()));
conf.setLoadActiveListeningFailDirMaxSizeInBytes(
Long.parseLong(
properties.getProperty(
"load_active_listening_fail_dir_max_size_in_bytes",
Long.toString(conf.getLoadActiveListeningFailDirMaxSizeInBytes()))));
conf.setLoadActiveListeningPipeDir(
properties.getProperty(
"load_active_listening_pipe_dir", conf.getLoadActiveListeningPipeDir()));
Expand Down Expand Up @@ -2863,6 +2868,11 @@ private void loadLoadTsFileHotModifiedProp(TrimProperties properties) throws IOE
properties.getProperty(
"load_active_listening_fail_dir",
ConfigurationFileUtils.getConfigurationDefaultValue("load_active_listening_fail_dir")));
conf.setLoadActiveListeningFailDirMaxSizeInBytes(
Long.parseLong(
properties.getProperty(
"load_active_listening_fail_dir_max_size_in_bytes",
Long.toString(conf.getLoadActiveListeningFailDirMaxSizeInBytes()))));
conf.setLoadActiveListeningPipeDir(
properties.getProperty(
"load_active_listening_pipe_dir", conf.getLoadActiveListeningPipeDir()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public abstract class TsFileInsertionEventParser implements AutoCloseable {

protected Iterable<TabletInsertionEvent> tabletInsertionIterable;

private long lastKnownOffset = -1;

protected TsFileInsertionEventParser(
final File tsFile,
final String pipeName,
Expand Down Expand Up @@ -232,6 +234,17 @@ protected TsFileInsertionEventParserMemoryBlock allocateGenericMemory(
return memoryManager.forceAllocate(name, sizeInBytes, getParentMemoryBlock(), sourceEvent);
}

public long getCurrentOffset() {
if (tsFileSequenceReader != null) {
try {
return tsFileSequenceReader.position();
} catch (final IOException ignored) {
return lastKnownOffset;
}
}
return lastKnownOffset;
}

/**
* @return {@link TabletInsertionEvent} in a streaming way
*/
Expand Down Expand Up @@ -327,6 +340,11 @@ public void close() {

try {
if (tsFileSequenceReader != null) {
try {
lastKnownOffset = tsFileSequenceReader.position();
} catch (final IOException ignored) {
lastKnownOffset = -1;
}
tsFileSequenceReader.close();
}
} catch (final IOException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.pipe.event.common.tsfile.parser;

public class TsFileParseFailureException extends RuntimeException {

private final long offset;

public TsFileParseFailureException(final long offset, final Throwable cause) {
super(cause);
this.offset = offset;
}

public long getOffset() {
return offset;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
import org.apache.iotdb.db.pipe.event.common.tsfile.parser.TsFileInsertionEventParser;
import org.apache.iotdb.db.pipe.event.common.tsfile.parser.TsFileInsertionEventParserMemoryBlock;
import org.apache.iotdb.db.pipe.event.common.tsfile.parser.TsFileInsertionEventParserMemoryManager;
import org.apache.iotdb.db.pipe.event.common.tsfile.parser.TsFileParseFailureException;
import org.apache.iotdb.db.pipe.event.common.tsfile.parser.util.ModsOperationUtil;
import org.apache.iotdb.db.pipe.resource.memory.PipeMemoryWeightUtil;
import org.apache.iotdb.db.storageengine.load.TsFileStructureCorruptionUtils;
import org.apache.iotdb.db.utils.TypeServices;
import org.apache.iotdb.db.utils.datastructure.PatternTreeMapFactory;
import org.apache.iotdb.pipe.api.event.dml.insertion.TabletInsertionEvent;
Expand Down Expand Up @@ -248,7 +250,11 @@ private TsFileInsertionEventScanParser(final ParserContext parserContext)
close();
}
} catch (final Exception e) {
final long offset = getCurrentOffset();
close();
if (offset >= 0 && TsFileStructureCorruptionUtils.isStructureCorruption(e)) {
throw new TsFileParseFailureException(offset, e);
}
throw e;
}
}
Expand Down
Loading
Loading