Duplicated row after promote in synchronous streaming replication - Mailing list pgsql-hackers
From | Dang Minh Huong |
---|---|
Subject | Duplicated row after promote in synchronous streaming replication |
Date | |
Msg-id | B44DAC9C-FD62-4BD1-88A7-89F184396E99@gmail.com Whole thread Raw |
Responses |
Re: Duplicated row after promote in synchronous streaming replication
|
List | pgsql-hackers |
<div style="font-family: HiraKakuProN-W3; font-size: 13px;">Hi all,</div><div style="font-family: HiraKakuProN-W3; font-size:13px;"><br /></div><span style="font-family: HiraKakuProN-W3; font-size: 13px;">I'm using PostgreSQL 9.1.10 formy HA project and have found this problem.</span><div style="font-family: HiraKakuProN-W3; font-size: 13px;"><br /></div><divstyle="font-family: HiraKakuProN-W3; font-size: 13px;">I did (multiple times) the following sequence in my primary/standbysynchronous replication environment,</div><div style="font-family: HiraKakuProN-W3; font-size: 13px;"><br/></div><div style="font-family: HiraKakuProN-W3; font-size: 13px;">1. Update rows in a table (which have primarykey constraint column) <span style="line-height: 14.25pt;">in active DB</span></div><div style="font-family: HiraKakuProN-W3;font-size: 13px;"><br /></div><div style="font-family: HiraKakuProN-W3; font-size: 13px;">2. Stop activeDB</div><div style="font-family: HiraKakuProN-W3; font-size: 13px;"><br /></div><div style="font-family: HiraKakuProN-W3;font-size: 13px;">3. Promote standby DB</div><div style="font-family: HiraKakuProN-W3; font-size: 13px;"><br/></div><div style="font-family: HiraKakuProN-W3; font-size: 13px;">4. Confirm the updated table in promoted standby(new primary) and found that, there's a duplicate updated row (number of row was increased).</div><div style="font-family:HiraKakuProN-W3; font-size: 13px;"><br /></div><div style="font-family: HiraKakuProN-W3; font-size: 13px;">Ithink it is a replication bug but wonder if it was fixed yet. </div><div style="font-family: HiraKakuProN-W3; font-size:13px;">Can somebody help me?</div><div style="font-family: HiraKakuProN-W3; font-size: 13px;"><br /></div><divstyle="font-family: HiraKakuProN-W3; font-size: 13px;">I'm not yet confirm PostgreSQL source, but here is <spanstyle="font-weight: bold; color: rgb(84, 84, 84); font-family: arial, sans-serif; font-size: small; line-height:18px; background-color: rgb(255, 255, 255);">my investigation result</span><span style="font-weight: bold; color:rgb(84, 84, 84); font-family: arial, sans-serif; font-size: small; line-height: 18px; background-color: rgb(255, 255,255);">.</span></div><div style="font-family: HiraKakuProN-W3; font-size: 13px;"><span style="line-height: 14.25pt;"><br/></span></div><div style="font-family: HiraKakuProN-W3; font-size: 13px;"><span style="line-height: 14.25pt;">Updatedtable before promoted were HOT update (index file was not changed).</span></div><div style="font-family:HiraKakuProN-W3; font-size: 13px;"><br /></div><div style="font-family: HiraKakuProN-W3; font-size: 13px;"><spanstyle="line-height: 14.25pt;">After promote i continue update that duplicated row (it returned two row updated),and confirm with pg_filedump, </span>i found the duplicated row and only one is related to primary key index constraint.</div><divstyle="font-family: HiraKakuProN-W3; font-size: 13px;"><br /></div><div style="font-family: HiraKakuProN-W3;font-size: 13px;">Compare with old active DB, i saw that after promote line pointer of updated row (duplicatedrow) is broken into two line pointer, the new one is related to primary index constraint and the other is notrelated to. Some thing like below, </div><div style="font-family: HiraKakuProN-W3; font-size: 13px;"><br /></div><divstyle="font-family: HiraKakuProN-W3; font-size: 13px;">Old active DB:</div><div style="font-family: HiraKakuProN-W3;font-size: 13px;">ctid(0,3)->ctid(0,6)->ctid(0,7)</div><div style="font-family: HiraKakuProN-W3; font-size:13px;"><br /></div><div style="font-family: HiraKakuProN-W3; font-size: 13px;">New active DB (after promote andupdate):</div><div style="font-family: HiraKakuProN-W3; font-size: 13px;">ctid(0,3)->ctid(0,9)</div><div style="font-family:HiraKakuProN-W3; font-size: 13px;">ctid(0,7)->ctid(0,10)</div><div style="font-family: HiraKakuProN-W3;font-size: 13px;"><br /></div><div style="font-family: HiraKakuProN-W3; font-size: 13px;">ctid(0,10) is notrelated to primary key index constraint.</div><div style="font-family: HiraKakuProN-W3; font-size: 13px;"><br /></div><divstyle="font-family: HiraKakuProN-W3; font-size: 13px;"><span style="line-height: 14.25pt;">Is something was wrongin redo log in standby DB? Or line pointer in HOT update feature?</span></div><div style="font-family: HiraKakuProN-W3;font-size: 13px;"><span style="line-height: 14.25pt;"><br /></span></div><div style="font-family: HiraKakuProN-W3;font-size: 13px;"><span style="line-height: 14.25pt;">Thanks and best regards,</span></div><div style="font-family:HiraKakuProN-W3; font-size: 13px;"><span style="line-height: 14.25pt;">Huong,</span></div>
pgsql-hackers by date: