PostgreSQL
Check-in [e846fca3d6]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Suppress some more valgrind whining about btree_gist. A couple of functions didn't bother to zero out pad bytes in datums that would ultimately go to disk. Harmless, but valgrind doesn't know that.
Timelines: family | ancestors | descendants | both | trunk | WIN32_DEV | REL9_0_ALPHA4_BRANCH
Files: files | file ages | folders
SHA1:e846fca3d633c7a22b2d0ef1ef273d1db6713031
User & Date: tgl@sss.pgh.pa.us 2014-05-16 19:29:02
Context
2014-05-16
20:51
Make sure chr(int) can't create invalid UTF8 sequences. Several years ago we changed chr(int) so that if the database encoding is UTF8, it would interpret its argument as a Unicode code point and exp... check-in: ee787097fc user: tgl@sss.pgh.pa.us tags: trunk, WIN32_DEV, REL9_0_ALPHA4_BRANCH
19:29
Suppress some more valgrind whining about btree_gist. A couple of functions didn't bother to zero out pad bytes in datums that would ultimately go to disk. Harmless, but valgrind doesn't know that. check-in: e846fca3d6 user: tgl@sss.pgh.pa.us tags: trunk, WIN32_DEV, REL9_0_ALPHA4_BRANCH
19:18
Fix a second cause of undersized pallocs for btree_gist indexes on macaddr. gbt_macad_union also allocated 12-byte structs where we really need 16. Per report from Andres Freund. No back-patch sinc... check-in: 9fae83a1b0 user: tgl@sss.pgh.pa.us tags: trunk, WIN32_DEV, REL9_0_ALPHA4_BRANCH
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to contrib/btree_gist/btree_utils_var.c.

66
67
68
69
70
71
72


73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
...
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
}


GBT_VARKEY *
gbt_var_key_copy(const GBT_VARKEY_R *u, bool force_node)
{
	GBT_VARKEY *r = NULL;



	if (u->lower == u->upper && !force_node)
	{							/* leaf key mode */
		r = (GBT_VARKEY *) palloc(VARSIZE(u->lower) + VARHDRSZ);
		memcpy(VARDATA(r), u->lower, VARSIZE(u->lower));
		SET_VARSIZE(r, VARSIZE(u->lower) + VARHDRSZ);
	}
	else
	{							/* node key mode  */
		r = (GBT_VARKEY *) palloc(INTALIGN(VARSIZE(u->lower)) + VARSIZE(u->upper) + VARHDRSZ);
		memcpy(VARDATA(r), u->lower, VARSIZE(u->lower));
		memcpy(VARDATA(r) + INTALIGN(VARSIZE(u->lower)), u->upper, VARSIZE(u->upper));
		SET_VARSIZE(r, INTALIGN(VARSIZE(u->lower)) + VARSIZE(u->upper) + VARHDRSZ);
	}
	return r;
}


static GBT_VARKEY *
gbt_var_leaf2node(GBT_VARKEY *leaf, const gbtree_vinfo *tinfo)
................................................................................
	int32		si;
	char	   *out2;

	len1 = Min(len1, (cpf_length + 1));
	len2 = Min(len2, (cpf_length + 1));

	si = 2 * VARHDRSZ + INTALIGN(len1 + VARHDRSZ) + len2;
	out = (GBT_VARKEY *) palloc(si);
	SET_VARSIZE(out, si);

	memcpy(VARDATA(out), r.lower, len1 + VARHDRSZ);
	SET_VARSIZE(VARDATA(out), len1 + VARHDRSZ);

	out2 = VARDATA(out) + INTALIGN(len1 + VARHDRSZ);
	memcpy(out2, r.upper, len2 + VARHDRSZ);







>
>



|
|
|



|
|
|
|







 







|







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
...
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
}


GBT_VARKEY *
gbt_var_key_copy(const GBT_VARKEY_R *u, bool force_node)
{
	GBT_VARKEY *r = NULL;
	int32		lowersize = VARSIZE(u->lower);
	int32		uppersize = VARSIZE(u->upper);

	if (u->lower == u->upper && !force_node)
	{							/* leaf key mode */
		r = (GBT_VARKEY *) palloc(lowersize + VARHDRSZ);
		memcpy(VARDATA(r), u->lower, lowersize);
		SET_VARSIZE(r, lowersize + VARHDRSZ);
	}
	else
	{							/* node key mode  */
		r = (GBT_VARKEY *) palloc0(INTALIGN(lowersize) + uppersize + VARHDRSZ);
		memcpy(VARDATA(r), u->lower, lowersize);
		memcpy(VARDATA(r) + INTALIGN(lowersize), u->upper, uppersize);
		SET_VARSIZE(r, INTALIGN(lowersize) + uppersize + VARHDRSZ);
	}
	return r;
}


static GBT_VARKEY *
gbt_var_leaf2node(GBT_VARKEY *leaf, const gbtree_vinfo *tinfo)
................................................................................
	int32		si;
	char	   *out2;

	len1 = Min(len1, (cpf_length + 1));
	len2 = Min(len2, (cpf_length + 1));

	si = 2 * VARHDRSZ + INTALIGN(len1 + VARHDRSZ) + len2;
	out = (GBT_VARKEY *) palloc0(si);
	SET_VARSIZE(out, si);

	memcpy(VARDATA(out), r.lower, len1 + VARHDRSZ);
	SET_VARSIZE(VARDATA(out), len1 + VARHDRSZ);

	out2 = VARDATA(out) + INTALIGN(len1 + VARHDRSZ);
	memcpy(out2, r.upper, len2 + VARHDRSZ);