Ideas for improving Concurrency Tests
От | Amit Kapila |
---|---|
Тема | Ideas for improving Concurrency Tests |
Дата | |
Msg-id | 004201ce29f3$e36b12c0$aa413840$@kapila@huawei.com обсуждение исходный текст |
Список | pgsql-hackers |
<div class="WordSection1"><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Ideas forimproving Concurrency testing <br /><br /></span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">1.Synchronization points in server code - To have better controlfor concurrency testing, define synchronization points in server code which can be used as follows: <br /> <br /> heap_truncate(..) <br /> { <br /> .... <br /> <br /> SYNC_POINT(procid,'before_heap_open') <br /> rel = heap_open(rid,AccessExclusiveLock); <br /> relations = lappend(relations, rel); <br /> } <br /> <br /> exec_simple_query(..)<br /> { <br /> ... <br /> finish_xact_command(); <br /> SYNC_POINT(procid,'finish_xact_command') <br /><br /> /* <br /> * If there were no parsetrees, return EmptyQueryResponse message.<br /> */ <br /> if (!parsetree_list)<br /> NullCommand(dest); <br /> ... <br /> } <br /> <br /><br/> <br /> When code reaches at sync point it caneither emit a signal <br /> or wait for a signal <br /> <br /> Signal <br /> A value of a shared memoryvariable that will be interpretted by different <br /> SYNC POINTS based on it'svalue. <br /> <br /> Emit a signal <br /> Assign the value (the signal) to the shared memory variable ("set a flag") and <br /> broadcast a global condition to wake those waiting for a signal. <br /> <br /> Wait for a signal <br /> Loopover waiting for the global condition until the global value matches <br /> the wait-forsignal <br /><br /> To activate Synchronization points appropriate actions can be set. <br/> For Example, <br /> SET SYNC_POINT = 'before_heap_open WAIT_FOR commit';<br /> SET SYNC_POINT = 'after_finish_xact_command SIGNAL commit'; <br /> <br /> This above commands can activate the synchronization points named 'before_heap_open'<br /> and 'after_finish_xact_command'. <br /> <br /> <br /> session "s1" <br /> step s11 {SET SYNC_POINT = 'before_heap_openWAIT_FOR commit';} <br /> step s12 {Truncate tbl;} <br /> session"s2" <br /> step s21 {SET SYNC_POINT = 'after_finish_xact_command SIGNAL commit';} <br /> step s22 {Insert into tbl values(1);} <br /> <br /> The first activation requests the synchronization point to wait for <br /> another backend to emitthe signal 'commit', and second activation requests <br /> the synchronization point to emit thesignal 'commit', when the process's execution runs through <br /> the synchronization point. <br/> <br /> Above defined test will allow Truncate table to wait for Insertto finish <br /><br />2. Enhance Isolation Framework - Currently, at most one step can be waiting at a time. EnhanceConcurrency test framework (isolation tester) to make multiple sessions wait and then allow to release it serially.</span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif""> This might help in generating complex dead lock scenario's.</span><p class="MsoNormal"><spanstyle="font-size:10.0pt;font-family:"Arial","sans-serif""> </span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif""> </span><pclass="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Aboveideas could be useful to improve concurrency testing and canalso be helpful to generate test cases for some of the complicated bugs for which there is no direct test.</span><p class="MsoNormal"><spanstyle="font-size:10.0pt;font-family:"Arial","sans-serif"">This work is not a patch for 9.3, I justwanted an initial feedback. </span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif""> </span><pclass="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Feedback/Suggestions?</span><pclass="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif""> </span><pclass="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif""> </span><pclass="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Reference: <a href="http://dev.mysql.com/doc/internals/en/debug-sync-facility.html">http://dev.mysql.com/doc/internals/en/debug-sync-facility.html</a></span><p class="MsoNormal"><spanstyle="font-size:10.0pt;font-family:"Arial","sans-serif""> </span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif""> </span><pclass="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">WithRegards,</span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">AmitKapila.</span></div>
В списке pgsql-hackers по дате отправления:
Предыдущее
От: Tom LaneДата:
Сообщение: Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
Следующее
От: Heikki LinnakangasДата:
Сообщение: Re: [COMMITTERS] pgsql: Add PF_PRINTF_ATTRIBUTE to on_exit_msg_fmt.