Skip to content

Commit

Permalink
Fix Error Handling and Cleanup during Insert Bulk Process (babelfish-…
Browse files Browse the repository at this point in the history
…for-postgresql#2887)

This commit fixes an issue with the error handling and cleanup phase of the Insert Bulk Process.

1. For Error Handling there was a scenario where bulk_load_callback(0, 0, NULL, NULL) call for cleanup would flush the remaining rows during EndBulkCopy and could result in an error. To fix this, we move the transaction rollback logic from TSQL extension to TDS. We also improved it by using Savepoints in case of active transaction which is aligned with TSQL behaviour.
2. In this case, if we have a reset-connection after the Bulk Load TDS packet we werent cleaning up the Bulk Load state. To do so we reset the offset.
3. During Reset Connection TDS is not resetting any TSQL transaction semantic. To resolve this we introduce a wrapper of AbortOutOfAnyTransaction to reset NestedTranCount.
Issues Resolved
BABEL-5200, BABEL-5199, BABEL-5220

Authored-by: Kushaal Shroff [email protected]
Signed-off-by: Kushaal Shroff [email protected]
  • Loading branch information
KushaalShroff authored and Sharath BP committed Sep 3, 2024
1 parent a682c21 commit a054fd7
Show file tree
Hide file tree
Showing 14 changed files with 1,532 additions and 180 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ runs:
run: |
cd test/dotnet
dotnet build
VSTEST_DISABLE_STANDARD_OUTPUT_CAPTURING=1 \
babel_URL=localhost \
babel_port=1433 \
babel_databaseName=master \
Expand Down
Loading

0 comments on commit a054fd7

Please sign in to comment.