Author: mhillyer
Date: 2005-11-30 05:32:26 +0100 (Wed, 30 Nov 2005)
New Revision: 442
Log:
Added more transaction content, coverage of commit and rollback.
Modified:
branches/MikePluggable/trunk/refman-5.1/custom-engine.xml
Modified: branches/MikePluggable/trunk/refman-5.1/custom-engine.xml
===================================================================
--- branches/MikePluggable/trunk/refman-5.1/custom-engine.xml 2005-11-30 00:06:31 UTC (rev 441)
+++ branches/MikePluggable/trunk/refman-5.1/custom-engine.xml 2005-11-30 04:32:26 UTC (rev 442)
@@ -2508,13 +2508,13 @@
if (all_tx)
{
txn->tx_begin();
- trans_register_ha(thd, TRUE, &my_handler_hton);
+ trans_register_ha(thd, TRUE, &my_handler_hton);
}
else
if (txn->stmt == 0)
{
txn->stmt= txn->new_savepoint();
- trans_register_ha(thd, FALSE, &my_handler_hton);
+ trans_register_ha(thd, FALSE, &my_handler_hton);
}
}
else
@@ -2547,15 +2547,94 @@
<function>external_lock()</function> can be found in
<filename>ha_innodb.cc</filename>.
</para>
-
+
</section>
-<!-- END EXTERNAL_LOCK -->
+ </section>
+ <section id="custom-engine-transactions-rollback">
+
+ <title>Implementing ROLLBACK</title>
+
+ <para>
+ Of the two major transactional operations,
+ <literal>ROLLBACK</literal> is the more complicated to
+ implement. All operations that occured during the transactions
+ must be reversed so that all rows are unchanged from before the
+ transaction began.
+ </para>
+
+ <para>
+ To support <literal>ROLLBACK</literal>, create a function that
+ matches this definition:
+ </para>
+
+<programlisting>
+int (*rollback)(THD *thd, bool all);
+</programlisting>
+
+ <para>
+ The function name is then listed in the
+ <literal>rollback</literal> (thirteenth) entry of
+ <link linkend="custom-engine-handlerton">the handlerton</link>.
+ </para>
+
+ <para>
+ The <literal>THD</literal> parameter is used to identify the
+ transaction that needs to be rolled back, while the
+ <literal>bool all</literal> parameter FILL IN!!!.
+ </para>
+
+ <para>
+ Details of implementing a <literal>ROLLBACK</literal> operation
+ will vary by storage engine. Examples can be found in
+ <filename>ha_innodb.cc</filename> and
+ <filename>ha_berkeley.cc</filename>.
+ </para>
+
</section>
-<!-- END STARTING SECTION -->
+ <section id="custom-engine-transactions-commit">
+ <title>Implementing COMMIT</title>
+
+ <para>
+ During a commit operation, all changes made during a transaction
+ are made permanent and afterwards a rollback operation is not
+ possible. Depending on the transaction isolation used, this may
+ be the first time such changes are visible to other threads.
+ </para>
+
+ <para>
+ To support <literal>COMMIT</literal>, create a function that
+ matches this definition:
+ </para>
+
+<programlisting>
+ int (*commit)(THD *thd, bool all);
+ </programlisting>
+
+ <para>
+ The function name is then listed in the
+ <literal>rollback</literal> (twelfth) entry of
+ <link linkend="custom-engine-handlerton">the handlerton</link>.
+ </para>
+
+ <para>
+ The <literal>THD</literal> parameter is used to identify the
+ transaction that needs to be comitted, while the <literal>bool
+ all</literal> parameter FILL IN!!!.
+ </para>
+
+ <para>
+ Details of implementing a <literal>COMMIT</literal> operation
+ will vary by storage engine. Examples can be found in
+ <filename>ha_innodb.cc</filename> and
+ <filename>ha_berkeley.cc</filename>.
+ </para>
+
+ </section>
+
</section>
<section id="custom-engine-api-reference">
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r442 - branches/MikePluggable/trunk/refman-5.1 | mhillyer | 30 Nov |