Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Unexpected EOF error when batch InsertReplace table entities with Go SDK (issue #2519) #2521

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

blueww
Copy link
Member

@blueww blueww commented Dec 24, 2024

Fix issue : #2519

currently latest Go SDK will fail with "Unexpected EOF" when run table batch TransactionTypeInsertReplace or TransactionTypeAdd. (TransactionTypeInsertMerge won't fail)

The root cause is : There are 3 "\r\n" after etag in responds from product Azure, but only 2 "\r\n" in the responds from Azurite.

Responds from product Azure:

358
--batchresponse_4d6c18c7-3a5f-4e71-96be-5ab90f68bf16
Content-Type: multipart/mixed; boundary=changesetresponse_d9a53c97-d6eb-4038-929f-6ffc409948e5

--changesetresponse_d9a53c97-d6eb-4038-929f-6ffc409948e5
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 204 No Content
X-Content-Type-Options: nosniff
Cache-Control: no-cache
DataServiceVersion: 1.0;
ETag: W/"datetime'2024-12-23T09%3A20%3A10.1623783Z'"


--changesetresponse_d9a53c97-d6eb-4038-929f-6ffc409948e5
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 204 No Content
X-Content-Type-Options: nosniff
Cache-Control: no-cache
DataServiceVersion: 1.0;
ETag: W/"datetime'2024-12-23T09%3A20%3A10.1623783Z'"


--changesetresponse_d9a53c97-d6eb-4038-929f-6ffc409948e5--
--batchresponse_4d6c18c7-3a5f-4e71-96be-5ab90f68bf16--

0

Responds from Azurite:

--batchresponse_615a699f-840f-4061-9bee-000c1e53dc10
Content-Type: multipart/mixed; boundary=changesetresponse_a0eae326-3560-4221-9149-5c8fce619643

--changesetresponse_a0eae326-3560-4221-9149-5c8fce619643
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 204 No Content
X-Content-Type-Options: nosniff
Cache-Control: no-cache
DataServiceVersion: 3.0;
ETag: W/\"datetime'2024-12-23T09%3A21%3A30.3112261Z'\"

--changesetresponse_a0eae326-3560-4221-9149-5c8fce619643
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 204 No Content
X-Content-Type-Options: nosniff
Cache-Control: no-cache
DataServiceVersion: 3.0;
ETag: W/\"datetime'2024-12-23T09%3A21%3A30.3112265Z'\"

--changesetresponse_a0eae326-3560-4221-9149-5c8fce619643--

--batchresponse_615a699f-840f-4061-9bee-000c1e53dc10--

From https://github.com/Azure/Azurite/blob/main/src/table/batch/TableBatchSerialization.ts we can see:
Following 2 functions has 1 addtional "\r\n" after Etag, so they works with Go SDK.

  • serializeTableMergeEntityBatchResponse()
  • serializeTableQueryEntityWithPartitionAndRowKeyBatchResponse()

Following 2 functions doesn't have additional "\r\n" after Etag, so they doesn't work.

  • serializeTableInsertEntityBatchResponse()
  • serializeTableUpdateEntityBatchResponse()

After add additional "\r\n" after Etag in serializeTableInsertEntityBatchResponse() and serializeTableUpdateEntityBatchResponse(), the issue if fixed with Go SDK in my manual test.

This PR fix this issue, and manually validated it works.

As the issue only repro with Go SDK, it's not easy to add test case to cover this scenario.

===========================================

Thanks for contribution! Please go through following checklist before sending PR.

PR Branch Destination

  • For Azurite V3, please send PR to main branch.
  • For legacy Azurite V2, please send PR to legacy-dev branch.

Always Add Test Cases

Make sure test cases are added to cover the code change.

Add Change Log

Add change log for the code change in Upcoming Release section in ChangeLog.md.

Development Guideline

Please go to CONTRIBUTION.md for steps about setting up development environment and recommended Visual Studio Code extensions.

Replace table entities with Go SDK (issue Azure#2519)
@blueww blueww merged commit d95c7cc into Azure:main Jan 2, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants