Fix for #8053 - avoid setting lock on as-yet-uncomitted dataset #8056
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it: Fixes the Dataverses datasets/:import and :importddi API calls when release=yes
Which issue(s) this PR closes:
Closes #8053
Special notes for your reviewer: These two API calls, with release=yes appear to be the only two cases where a dataset is being created and published within the same transaction. Unfortunately, updates to the Publish command to create a DatasetLock in a separate transaction (which allow setting the lock earlier than waiting for the Publish (and potential workflow starting) to complete) fail as shown in the issue in this case - as the dataset has not yet been committed. The solution here just avoids trying to set a lock in this case (as no one can be editing the Dataset yet anyway). Alternately, I did verify that running the initial Import/CreateDataset command in a separate transaction, so that it completes before Publish is called, would also work. This would mean that any real problem in the Publish command would result in the dataset being imported but not released/published - that might be useful, but it's a change in functionality, whereas avoiding the lock appears to not affect anything aside from fixing the bug.
Suggestions on how to test this: Use release=true in the :import and :importddi API calls
Does this PR introduce a user interface change? If mockups are available, please link/include them here: no
Is there a release notes update needed for this change?: no
Additional documentation: I added notes in the code