測試PostgreSQL代碼的故障注入(24頁).pdf

編號:87304 PDF 24頁 1.26MB 下載積分:VIP專享
下載報告請您先登錄!

測試PostgreSQL代碼的故障注入(24頁).pdf

1、Fault injection to test PostgreSQL codeAsim R P apraveenpivotal.io Pune,IndiaAgenda What is lacking in current testing frameworks?What is fault injection?Proposal to inject faults Tests to demonstrate proposed faultinjector patchTesting frameworks in PostgreSQL pg_regress(src/test/regress)A test is

2、written as a.sql file Expected output is saved as an answer file(.out)pg_regress runs a.sql file,compares the output with the answer isolation(src/test/isolation)tests concurrent transactions .spec file-SQL commands within each transaction and how to interleave themisolation:test that select waits f

3、or altersession“s1”setup BEGIN ISOLATION LEVEL READ COMMITTED;step“alter1”ALTER TABLE test ADD RENAME TO test2;step“commit1”COMMIT;session“s2”setup SET default_transaction_isolation=read committed;step“select2”SELECT*from test;permutation“alter1”“s2”“commit1”Testing frameworks in PostgreSQL TAP-test

4、s written in perl(Test:More)Orchestrate a cluster-master and one or more standby initdb,start/stop cluster,etc.src/test/perl/README src/test/modules(not run in CI)modular testing of a specific component,e.g.planner src/test/modules/READMEWhat is lacking in PostgreSQL tests?Test that a backend is kil

5、led after writing commit record but before updating the transaction status in pg_clog Is synchronous replication really synchronous?Was a cached plan reused?Anything comes to your mind?Fault injection Unconference discussion at PGcon 2019 in Ottawa Already being used in Greenplum Patch proposed on p

6、gsql-hackers:https:/www.postgresql.org/message-id/flat/CANXE4TdxdESX1jKw48xet-5GvBFVSq%3D4cgNeioTQff372KO45A%Fault point(./configure CPPFLAGS=-DFAULT_INJECTOR)Fault point-macro definitionSet a fault using its name CREATE EXTENSION faultinjector;Enable the“heap_insert”fault when a tuple is inserted i

7、nto“mytable”SELECT inject_fault(heap_insert,error,mytable,);Wait until the fault is triggered(blocking call)SELECT wait_until_triggered_fault(heap_insert,1);Check the status SELECT inject_fault(heap_insert,status);Reset the fault SELECT inject_fault(heap_insert,reset);More on inject_faultinject_faul

8、t(,trigger only after the fault point is reached as many number of times,stop after triggerring as many number of times(fault state completed)seconds to sleep in a sleep fault)inject_fault_remote()Same as inject_fault()Additional args:hostname and port number New libpq message to inject faults Usefu

9、l for testing standby servers in a clusterFault types error:elog(ERORR)leads to transaction abort skip:do nothing-indicates that the fault point was reached,also used for custom action suspend reset statusFault states injected but not triggered-SELECT inject_fault();completed-triggered maximum numbe

10、r of times,will no longer trigger triggered-reached during execution at least onceFaults offer fine grained control Enable complex testing scenarios Was a specific flag in shared memory set,and when?Was a branch in a function taken?Can be used in regress,isolation as well as TAP testsDemonstrative t

11、est:speculative insertCREATE TABLE test(key TEXT,data TEXT);CREATE UNIQUE INDEX ON test(key);T1:INSERT INTO test values(k1,inserted T1)ON CONFLICT DO UPDATE SET data=test.data|conflict update T1;T2:INSERT INTO test values(k1,inserted T2)ON CONFLICT DO UPDATE SET data=test.data|conflict update T2;Dem

12、onstrative test:speculative insertConflicts detected after a tuple is inserted into heap but before inserting into index are handled properly T1 goes first and inserts the tuple into heap Before T1 updates the index,T2 inserts into both,heap and the index.T2 sees no conflicts because T1 is still in

13、progress.T1 moves ahead.T1 should detect a conflict and abort.Demonstrative test:speculative insert Find it in the faultinjector patch:src/test/isolation/specs/insert-conflict-with-faults.specDemonstrative test:synchronous replicationEnsure that commits on master block until a synchronous standby ac

14、knowledges the commit Master writes a commit record The backend process on master starts waiting for standby to flush WAL upto the commit LSN Standby goes down before the WAL receiver writes WAL upto the commit LSNDemonstrative test:synchronous replication Find it in the faultinjector patch,its a TAP test:src/test/recovery/t/007_sync_rep.plTHANKS

友情提示

1、下載報告失敗解決辦法
2、PDF文件下載后,可能會被瀏覽器默認打開,此種情況可以點擊瀏覽器菜單,保存網頁到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站報告下載后的文檔和圖紙-無水印,預覽文檔經過壓縮,下載后原文更清晰。

本文(測試PostgreSQL代碼的故障注入(24頁).pdf)為本站 (云閑) 主動上傳,三個皮匠報告文庫僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對上載內容本身不做任何修改或編輯。 若此文所含內容侵犯了您的版權或隱私,請立即通知三個皮匠報告文庫(點擊聯系客服),我們立即給予刪除!

溫馨提示:如果因為網速或其他原因下載失敗請重新下載,重復下載不扣分。
客服
商務合作
小程序
服務號
折疊
午夜网日韩中文字幕,日韩Av中文字幕久久,亚洲中文字幕在线一区二区,最新中文字幕在线视频网站