Skip to content

Create If Not Exists Transaction Operation Type - #3724

Open
LizardLump wants to merge 5 commits into
developmentfrom
aflores-dev-create_if_not_exists
Open

Create If Not Exists Transaction Operation Type#3724
LizardLump wants to merge 5 commits into
developmentfrom
aflores-dev-create_if_not_exists

Conversation

@LizardLump

Copy link
Copy Markdown
Contributor

No description provided.

@LizardLump
LizardLump requested a review from 006627 August 26, 2026 14:23
@LizardLump LizardLump self-assigned this Aug 26, 2026
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement labels Aug 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you added a new OperationState.SKIPPED however I think you've missed to update the constraint for tables transactional_model_operation_log, transactional_storage_path_consolidated_operation and transactional_storage_path_operation_log.

Also, since the introduction of flyway in 6.3.0 shouldn't these changes go in a new versioned migration instead of modifying v1? @006627

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eduardojst10 Yes, since Flyway was introduced in 6.3.0, these changes should go into a new versioned migration rather than modifying V1.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest commit moves and adds schema changes in the new V3 flyway schema migration

@006627 006627 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A potential rollback issue has already been reported internally. Due to a race condition, a failed transaction could roll back an agent created by another transaction.

For now, the proposal is to never roll back OPTIMISTIC_CREATE_IF_NOT_EXISTS, treating it like READ in rollback().

The reason is that a PREMIS agent is not tied to a specific transaction, so rolling it back could remove an agent created or used by another transaction.

This is a trade-off, as agents created by a failed transaction would remain instead of being removed.

Comment thread roda-core/roda-core/src/main/java/org/roda/core/storage/StorageService.java Outdated
@LizardLump
LizardLump force-pushed the aflores-dev-create_if_not_exists branch from 2874a30 to 9caf957 Compare September 3, 2026 07:06
@LizardLump
LizardLump force-pushed the aflores-dev-create_if_not_exists branch from 9caf957 to bd1a0e5 Compare September 3, 2026 10:19
@LizardLump

Copy link
Copy Markdown
Contributor Author

A potential rollback issue has already been reported internally. Due to a race condition, a failed transaction could roll back an agent created by another transaction.

For now, the proposal is to never roll back OPTIMISTIC_CREATE_IF_NOT_EXISTS, treating it like READ in rollback().

The reason is that a PREMIS agent is not tied to a specific transaction, so rolling it back could remove an agent created or used by another transaction.

This is a trade-off, as agents created by a failed transaction would remain instead of being removed.

As of the current commit, optimistic creates are no longer rolled back in storage, same as with delete operations.

@LizardLump
LizardLump requested a review from 006627 September 3, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants