Skip to content
Merged
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 @@ -115,6 +115,7 @@
import static io.trino.server.DynamicFilterService.DynamicFiltersStats;
import static io.trino.spi.StandardErrorCode.NOT_FOUND;
import static io.trino.spi.StandardErrorCode.TRANSACTION_ALREADY_ABORTED;
import static io.trino.spi.StandardErrorCode.TRANSACTION_ALREADY_COMMITED;
import static io.trino.spi.StandardErrorCode.USER_CANCELED;
import static io.trino.spi.connector.StandardWarningCode.SPOOLING_NOT_SUPPORTED;
import static io.trino.spi.resourcegroups.QueryType.SELECT;
Expand Down Expand Up @@ -431,7 +432,8 @@ private void collectCatalogMetadataMetrics()
// the transaction can be committed or aborted concurrently, after the check is done.
}
catch (RuntimeException e) {
if (!(e instanceof TrinoException trinoException && TRANSACTION_ALREADY_ABORTED.toErrorCode().equals(trinoException.getErrorCode()))) {
if (!(e instanceof TrinoException trinoException && (TRANSACTION_ALREADY_ABORTED.toErrorCode().equals(trinoException.getErrorCode()) ||
TRANSACTION_ALREADY_COMMITED.toErrorCode().equals(trinoException.getErrorCode())))) {
QUERY_STATE_LOG.error(e, "Error collecting query catalog metadata metrics: %s", queryId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import static io.trino.spi.StandardErrorCode.MULTI_CATALOG_WRITE_CONFLICT;
import static io.trino.spi.StandardErrorCode.READ_ONLY_VIOLATION;
import static io.trino.spi.StandardErrorCode.TRANSACTION_ALREADY_ABORTED;
import static io.trino.spi.StandardErrorCode.TRANSACTION_ALREADY_COMMITED;
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.stream.Collectors.toList;
Expand Down Expand Up @@ -384,7 +385,7 @@ public void checkOpenTransaction()
if (completedStatus != null) {
if (completedStatus) {
// Should not happen normally
throw new IllegalStateException("Current transaction already committed");
throw new TrinoException(TRANSACTION_ALREADY_COMMITED, "Current transaction already committed");
}
throw new TrinoException(TRANSACTION_ALREADY_ABORTED, "Current transaction is aborted, commands ignored until end of transaction block");
}
Expand Down Expand Up @@ -521,7 +522,7 @@ public synchronized ListenableFuture<Void> asyncAbort()
if (!completedSuccessfully.compareAndSet(null, false)) {
if (completedSuccessfully.get()) {
// Should not happen normally
return immediateFailedFuture(new IllegalStateException("Current transaction already committed"));
return immediateFailedFuture(new TrinoException(TRANSACTION_ALREADY_COMMITED, "Current transaction already committed"));
}
// Already done
return immediateVoidFuture();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public enum StandardErrorCode
INVALID_BRANCH_PROPERTY(136, USER_ERROR),
INVALID_DEFAULT_COLUMN_VALUE(137, USER_ERROR),
INVALID_GRACE_PERIOD(138, USER_ERROR),
TRANSACTION_ALREADY_COMMITED(139, USER_ERROR),

GENERIC_INTERNAL_ERROR(65536, INTERNAL_ERROR),
TOO_MANY_REQUESTS_FAILED(65537, INTERNAL_ERROR),
Expand Down