Cherry-pick 'Avoid transient bogus page contents when creating a sequence.'
The sequence xlog record generated at the end of DefineSequence records the local tuple->t_data when the actual page item is available. Not using the actual page item caused gp_replica_check extension to fail for sequences because the tuple->t_data ctid would be replicated as (0,0) instead of the actual page item ctid (0,1). This is because tuple->t_data is used in the xlog record creation but its t_ctid is not set even if tuple->t_self is fine. To fix this, we cherry-pick and modify upstream fix. Reference commit message: commit 8d34f686 Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> Date: Tue Apr 22 09:50:47 2014 +0300 Avoid transient bogus page contents when creating a sequence. Don't use simple_heap_insert to insert the tuple to a sequence relation. simple_heap_insert creates a heap insertion WAL record, and replaying that will create a regular heap page without the special area containing the sequence magic constant, which is wrong for a sequence. That was not a bug because we always created a sequence WAL record after that, and replaying that overwrote the bogus heap page, and the transient state could never be seen by another backend because it was only done when creating a new sequence relation. But it's simpler and cleaner to avoid that in the first place.
Showing
想要评论请 注册 或 登录