๒๘/๑๑/๕๐

Pervasive SQL and transaction durability risks.

Solution Details

Solution ID: 00014597
What is Transaction Durability and what is the risk of turning it off?

Problem Description:

Problem Environment:
Pervasive.SQL 2000 Pervasive.SQL v7

Cause of this problem:
Solution Notes:
A Transaction-Durable file is a 6.x file with a unique key or a 7.x file with a unique key or system data defined, and which was not opened in Accelerated mode.

If the Microkernel Database Engine (MKDE) Transaction Durability option is set to YES and the file is Transaction-Durable, then the MKDE returns the status to the application after committing (saving) the entire transaction to the transaction log file. The MKDE does this when it encounters the end of the transaction, such as an End Transaction, or an Abort Transaction operation. That means, non-transaction operations, i.e., Btrieve operations not enclosed within a Begin Transaction and an End Transaction (or an Abort Transaction) operation are not durable.

If the Microkernel Database Engine (MKDE) Transaction Durability option is set to NO and the file is not Transaction-Durable, then the MKDE returns and the status to the application before committing (saving) the entire transaction.

Not durable means the application may receive a successful status for the ransaction or non-transaction operation, but there is a window in which a system failure may cause the operation to be lost because it was not yet written to the data file, although it may still be present in the system cache.

Hence, if the user wants the non-transaction operations to be durable, the operations should be placed within transactions and Transaction Durability set to YES.





จากคำอธิบายข้างต้นจะเห็นว่า ข้อมูลที่ถูก update โดยไม่มีการใส่ BEGIN - END transaction ครอบเอาไว้ อาจเป็นอันตรายข้อมูลหายได้ ถึงแม้ว่าโปรแกรมจะได้รับ status=0 กลับมาจาก database engine ก็ตาม ตามรูปซึ่ง dump มาจาก log file จะเห็นว่า ตรงบรรทัดที่ 2692 เป็นการ update Inv.BTR ที่อยู่ภายในกรอบของ BEGIN - END หลังจากนั้น บรรทัดที่ 2694 มีการสั่ง update Inv.BTR อีกครั้ง ซึ่งตรงกับคำอธิบายว่าเป็น Not durable ตรงจุดนี้เป็นจุดแรกที่เกิดความเสี่ยงข้อมูลหาย

ไม่มีความคิดเห็น:

Google