|
37 | 37 | #include "paimon/common/utils/sensitive_config_utils.h" |
38 | 38 | #include "paimon/common/utils/string_utils.h" |
39 | 39 | #include "paimon/core/catalog/catalog_utils.h" |
40 | | -#include "paimon/core/catalog/commit_lock.h" |
41 | | -#include "paimon/core/catalog/renaming_snapshot_commit.h" |
42 | 40 | #include "paimon/core/catalog/snapshot_commit.h" |
43 | 41 | #include "paimon/core/catalog/version_managed_catalog.h" |
44 | 42 | #include "paimon/core/core_options.h" |
@@ -505,56 +503,6 @@ Result<std::unique_ptr<TableRead>> FileStoreTable::NewRead( |
505 | 503 | std::move(fallback_table_read), arrow_pool); |
506 | 504 | } |
507 | 505 |
|
508 | | -Result<std::unique_ptr<TableRead>> TableRead::Create(std::unique_ptr<ReadContext> ctx) { |
509 | | - PAIMON_RETURN_NOT_OK(ContextUtils::CheckOperatorContext(ctx, "read")); |
510 | | - PAIMON_ASSIGN_OR_RAISE(std::shared_ptr<Table> table, FileStoreTableFactory::Create(*ctx)); |
511 | | - return table->NewRead(std::move(ctx)); |
512 | | -} |
513 | | - |
514 | | -namespace { |
515 | | - |
516 | | -bool IsCatalogCommit(const CommitContext& ctx) { |
517 | | - return AsVersionManaged(ctx.GetCatalog()) != nullptr; |
518 | | -} |
519 | | - |
520 | | -Result<std::shared_ptr<SnapshotCommit>> NewSnapshotCommit( |
521 | | - const CommitContext& ctx, const std::optional<Identifier>& catalog_identifier, |
522 | | - const CoreOptions& options, const std::shared_ptr<SnapshotManager>& snapshot_manager) { |
523 | | - if (IsCatalogCommit(ctx)) { |
524 | | - if (!catalog_identifier) { |
525 | | - return Status::Invalid("a catalog commit requires a table identifier"); |
526 | | - } |
527 | | - PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<CommitLock> lock, |
528 | | - AsVersionManaged(ctx.GetCatalog()) |
529 | | - ->CreateCommitLock(catalog_identifier.value(), ctx.GetTableId(), |
530 | | - ctx.GetCommitUser(), options)); |
531 | | - // Reuse the caller's UUID so table recreation cannot redirect this commit. |
532 | | - return std::shared_ptr<SnapshotCommit>(std::make_shared<CatalogSnapshotCommit>( |
533 | | - ctx.GetCatalog(), catalog_identifier.value(), ctx.GetTableId(), std::move(lock))); |
534 | | - } |
535 | | - if (ctx.UseRESTCatalogCommit()) { |
536 | | - if (options.RestCommitAcquireLock()) { |
537 | | - return Status::Invalid(fmt::format( |
538 | | - "'{}' needs a commit through a REST catalog with WithCatalog(); a commit table " |
539 | | - "request built for the caller to send cannot hold a commit lease", |
540 | | - Options::REST_COMMIT_ACQUIRE_LOCK)); |
541 | | - } |
542 | | - return std::shared_ptr<SnapshotCommit>( |
543 | | - std::make_shared<CatalogSnapshotCommit>(ctx.GetTableId())); |
544 | | - } |
545 | | - // Catalogs without version management may still supply a table ID. |
546 | | - if (ctx.GetTableId() && ctx.GetCatalog() == nullptr) { |
547 | | - return Status::Invalid( |
548 | | - "a commit which publishes the snapshot by writing it to the table directory sends no " |
549 | | - "commit table request, so there is nowhere to put a table id; commit through a " |
550 | | - "catalog with WithCatalog() or ask for the request with UseRESTCatalogCommit()"); |
551 | | - } |
552 | | - return std::shared_ptr<SnapshotCommit>( |
553 | | - std::make_shared<RenamingSnapshotCommit>(options.GetFileSystem(), snapshot_manager)); |
554 | | -} |
555 | | - |
556 | | -} // namespace |
557 | | - |
558 | 506 | Result<std::unique_ptr<FileStoreCommit>> FileStoreTable::NewCommit( |
559 | 507 | std::unique_ptr<CommitContext> ctx) const { |
560 | 508 | PAIMON_RETURN_NOT_OK(ContextUtils::CheckOperatorContext(ctx, "commit")); |
@@ -642,10 +590,11 @@ Result<std::unique_ptr<FileStoreCommit>> FileStoreTable::NewCommit( |
642 | 590 | NewCommitScanSupplier(snapshot_manager, manifest_list, manifest_file, arrow_schema, options, |
643 | 591 | ctx->GetExecutor(), ctx->GetMemoryPool()); |
644 | 592 |
|
645 | | - PAIMON_ASSIGN_OR_RAISE(std::shared_ptr<SnapshotCommit> snapshot_commit, |
646 | | - SnapshotCommit::Create(ctx->GetCatalog(), catalog_identifier, options, |
647 | | - ctx->GetTableId(), ctx->UseRESTCatalogCommit(), |
648 | | - options.GetFileSystem(), snapshot_manager)); |
| 593 | + PAIMON_ASSIGN_OR_RAISE( |
| 594 | + std::shared_ptr<SnapshotCommit> snapshot_commit, |
| 595 | + SnapshotCommit::Create(ctx->GetCatalog(), catalog_identifier, options, ctx->GetTableId(), |
| 596 | + ctx->GetCommitUser(), ctx->UseRESTCatalogCommit(), |
| 597 | + options.GetFileSystem(), snapshot_manager)); |
649 | 598 |
|
650 | 599 | return std::make_unique<FileStoreCommitImpl>( |
651 | 600 | ctx->GetMemoryPool(), ctx->GetExecutor(), arrow_schema, root_path_, ctx->GetCommitUser(), |
|
0 commit comments