Unverified Commit 120d3e0c authored by Arunprasad Rajkumar's avatar Arunprasad Rajkumar Committed by GitHub
Browse files

Fix data loss when reading large transaction bodies (#495)



The `read_from_stream` function in pgcopydb was encountering a data loss issue
when reading from a source system with transaction bodies containing more than
1024 inserts. The problem arose from the statically allocated array of size 1024
used to split lines within the function. When the buffer held more than 1024
lines, it caused subsequent lines to be ignored, resulting in data loss.

To resolve this issue, this commit introduces the following changes:
- We now count the number of lines in the buffer before splitting them.
- Dynamically allocate an array to hold the split lines, based on the line count.

Signed-off-by: default avatarArunprasad Rajkumar <ar.arunprasad@gmail.com>
parent b1a0bcfe
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment