8000 Fix off-by-one in size of transform messages array. by dimitri · Pull Request #283 · dimitri/pgcopydb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix off-by-one in size of transform messages array. #283

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

Merged
merged 1 commit into from
May 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/bin/pgcopydb/ld_transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,16 @@ stream_transform_file(char *jsonfilename, char *sqlfilename)
return false;
}

/* {action: B} {action: C} {action: K} {action: X} */
int maxMesgCount = content.count;
/*
* Message are like:
*
* {action: B} {action: C} {action: K} {action: X}
*
* And when we read a COMMIT message (or KEEPALIVE or SWITCH) we prepare
* for the next message already, which means we need one more entry in the
* array than the number of lines read in the JSON file.
*/
int maxMesgCount = content.count + 1;
LogicalMessageArray mesgs = { 0 };

/* the actual count is maintained in the for loop below */
Expand Down
0