From 6c7b7bf7b7df13d0b5cb81eafaee921cc3789573 Mon Sep 17 00:00:00 2001 From: melin Date: Thu, 7 Nov 2024 18:00:22 +0800 Subject: [PATCH] [core] add table name to the log when commit failed (#4475) --- .../main/java/org/apache/paimon/AbstractFileStore.java | 4 ++++ .../main/java/org/apache/paimon/AppendOnlyFileStore.java | 4 +--- .../main/java/org/apache/paimon/KeyValueFileStore.java | 4 +--- .../org/apache/paimon/operation/FileStoreCommitImpl.java | 8 ++++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/AbstractFileStore.java b/paimon-core/src/main/java/org/apache/paimon/AbstractFileStore.java index 55c1c72df482..14665961a8a7 100644 --- a/paimon-core/src/main/java/org/apache/paimon/AbstractFileStore.java +++ b/paimon-core/src/main/java/org/apache/paimon/AbstractFileStore.java @@ -72,6 +72,7 @@ abstract class AbstractFileStore implements FileStore { protected final FileIO fileIO; protected final SchemaManager schemaManager; protected final TableSchema schema; + protected final String tableName; protected final CoreOptions options; protected final RowType partitionType; private final CatalogEnvironment catalogEnvironment; @@ -83,12 +84,14 @@ protected AbstractFileStore( FileIO fileIO, SchemaManager schemaManager, TableSchema schema, + String tableName, CoreOptions options, RowType partitionType, CatalogEnvironment catalogEnvironment) { this.fileIO = fileIO; this.schemaManager = schemaManager; this.schema = schema; + this.tableName = tableName; this.options = options; this.partitionType = partitionType; this.catalogEnvironment = catalogEnvironment; @@ -209,6 +212,7 @@ public FileStoreCommitImpl newCommit(String commitUser, List cal return new FileStoreCommitImpl( fileIO, schemaManager, + tableName, commitUser, partitionType, options.partitionDefaultName(), diff --git a/paimon-core/src/main/java/org/apache/paimon/AppendOnlyFileStore.java b/paimon-core/src/main/java/org/apache/paimon/AppendOnlyFileStore.java index 30208cebb8cc..a06b98d7b30c 100644 --- a/paimon-core/src/main/java/org/apache/paimon/AppendOnlyFileStore.java +++ b/paimon-core/src/main/java/org/apache/paimon/AppendOnlyFileStore.java @@ -49,7 +49,6 @@ public class AppendOnlyFileStore extends AbstractFileStore { private final RowType bucketKeyType; private final RowType rowType; - private final String tableName; public AppendOnlyFileStore( FileIO fileIO, @@ -61,10 +60,9 @@ public AppendOnlyFileStore( RowType rowType, String tableName, CatalogEnvironment catalogEnvironment) { - super(fileIO, schemaManager, schema, options, partitionType, catalogEnvironment); + super(fileIO, schemaManager, schema, tableName, options, partitionType, catalogEnvironment); this.bucketKeyType = bucketKeyType; this.rowType = rowType; - this.tableName = tableName; } @Override diff --git a/paimon-core/src/main/java/org/apache/paimon/KeyValueFileStore.java b/paimon-core/src/main/java/org/apache/paimon/KeyValueFileStore.java index 8a3bf0b0fa2a..1c87a087e44e 100644 --- a/paimon-core/src/main/java/org/apache/paimon/KeyValueFileStore.java +++ b/paimon-core/src/main/java/org/apache/paimon/KeyValueFileStore.java @@ -70,7 +70,6 @@ public class KeyValueFileStore extends AbstractFileStore { private final Supplier> keyComparatorSupplier; private final Supplier logDedupEqualSupplier; private final MergeFunctionFactory mfFactory; - private final String tableName; public KeyValueFileStore( FileIO fileIO, @@ -86,7 +85,7 @@ public KeyValueFileStore( MergeFunctionFactory mfFactory, String tableName, CatalogEnvironment catalogEnvironment) { - super(fileIO, schemaManager, schema, options, partitionType, catalogEnvironment); + super(fileIO, schemaManager, schema, tableName, options, partitionType, catalogEnvironment); this.crossPartitionUpdate = crossPartitionUpdate; this.bucketKeyType = bucketKeyType; this.keyType = keyType; @@ -99,7 +98,6 @@ public KeyValueFileStore( options.changelogRowDeduplicate() ? ValueEqualiserSupplier.fromIgnoreFields(valueType, logDedupIgnoreFields) : () -> null; - this.tableName = tableName; } @Override diff --git a/paimon-core/src/main/java/org/apache/paimon/operation/FileStoreCommitImpl.java b/paimon-core/src/main/java/org/apache/paimon/operation/FileStoreCommitImpl.java index 9ce089992350..69efce918951 100644 --- a/paimon-core/src/main/java/org/apache/paimon/operation/FileStoreCommitImpl.java +++ b/paimon-core/src/main/java/org/apache/paimon/operation/FileStoreCommitImpl.java @@ -112,6 +112,7 @@ public class FileStoreCommitImpl implements FileStoreCommit { private final FileIO fileIO; private final SchemaManager schemaManager; + private final String tableName; private final String commitUser; private final RowType partitionType; private final String partitionDefaultName; @@ -142,6 +143,7 @@ public class FileStoreCommitImpl implements FileStoreCommit { public FileStoreCommitImpl( FileIO fileIO, SchemaManager schemaManager, + String tableName, String commitUser, RowType partitionType, String partitionDefaultName, @@ -165,6 +167,7 @@ public FileStoreCommitImpl( int commitMaxRetries) { this.fileIO = fileIO; this.schemaManager = schemaManager; + this.tableName = tableName; this.commitUser = commitUser; this.partitionType = partitionType; this.partitionDefaultName = partitionDefaultName; @@ -1331,8 +1334,9 @@ private void assertNoDelete( for (SimpleFileEntry entry : mergedEntries) { Preconditions.checkState( entry.kind() != FileKind.DELETE, - "Trying to delete file %s which is not previously added.", - entry.fileName()); + "Trying to delete file %s for table %s which is not previously added.", + entry.fileName(), + tableName); } } catch (Throwable e) { if (partitionExpire != null && partitionExpire.isValueExpiration()) {