tablesync.c.diff
application/octet-stream
Filename: tablesync.c.diff
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/replication/logical/tablesync.c | 11 | 11 |
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index eb718114297..1dee2480e2f 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -126,7 +126,7 @@
List *table_states_not_ready = NIL;
-static StringInfo copybuf = NULL;
+static StringInfoData copybuf = {0};
/*
* Wait until the relation sync state is set in the catalog to the expected
@@ -649,13 +649,13 @@ copy_read_data(void *outbuf, int minread, int maxread)
int avail;
/* If there are some leftover data from previous read, use it. */
- avail = copybuf->len - copybuf->cursor;
+ avail = copybuf.len - copybuf.cursor;
if (avail)
{
if (avail > maxread)
avail = maxread;
- memcpy(outbuf, ©buf->data[copybuf->cursor], avail);
- copybuf->cursor += avail;
+ memcpy(outbuf, ©buf.data[copybuf.cursor], avail);
+ copybuf.cursor += avail;
maxread -= avail;
bytesread += avail;
}
@@ -680,16 +680,16 @@ copy_read_data(void *outbuf, int minread, int maxread)
else
{
/* Process the data */
- copybuf->data = buf;
- copybuf->len = len;
- copybuf->cursor = 0;
+ copybuf.data = buf;
+ copybuf.len = len;
+ copybuf.cursor = 0;
- avail = copybuf->len - copybuf->cursor;
+ avail = copybuf.len - copybuf.cursor;
if (avail > maxread)
avail = maxread;
- memcpy(outbuf, ©buf->data[copybuf->cursor], avail);
+ memcpy(outbuf, ©buf.data[copybuf.cursor], avail);
outbuf = (char *) outbuf + avail;
- copybuf->cursor += avail;
+ copybuf.cursor += avail;
maxread -= avail;
bytesread += avail;
}
@@ -1199,7 +1199,7 @@ copy_table(Relation rel)
lrel.nspname, lrel.relname, res->err)));
walrcv_clear_result(res);
- copybuf = makeStringInfo();
+ memset(©buf, 0, sizeof(copybuf));
pstate = make_parsestate(NULL);
(void) addRangeTableEntryForRelation(pstate, rel, AccessShareLock,