Commit 8e8f182
authored
BCP fix done token spanning packet boundaries (babelfish-for-postgresql#4478)
Problem: When DONE token (13 bytes) was split across TDS packet boundaries, only the first byte (0xFD) would be checked, causing the remaining bytes in the next packet to be misinterpreted.
Actually we have always seen that done token gets truncated to fit in available space, I can see in some cases the done token is only 8 bytes at the end of the message - packet marked with EOM. If we're at EOM with incomplete DONE token, that's actually acceptable.
Solution:
Check if DONE token is present
Only fetch additional bytes if NOT at EOM and buffer has < 13 bytes
Accept incomplete DONE tokens at EOM (handles truncated tokens from optimizing clients)
JIRA: BABEL-63171 parent 550e11a commit 8e8f182
File tree
5 files changed
+68
-8
lines changed- contrib/babelfishpg_tds/src/backend/tds
- test/dotnet
- ExpectedOutput
- input
- InsertBulk
5 files changed
+68
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
905 | 920 | | |
906 | 921 | | |
907 | 922 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
913 | 913 | | |
914 | 914 | | |
915 | 915 | | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
0 commit comments