~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/transaction_services.h

* Completes the blueprint for splitting the XA Resource Manager
  API from the storage engine API:

We add a new plugin::XaResourceManager abstract interface class
which exposes the X/Open XA distributed transaction protocol for
resource managers.

We add a new plugin::MonitoredInTransaction base class from
which all plugins that need monitored by Drizzle's transaction
manager (drizzled::TransactionServices component) derive.

All plugin::StorageEngine's now derive from plugin::MonitoredInTransaction
since all storage engines a monitored by the transaction manager
and the Session keeps a "slot" available for keeping the engine's
per-session data state.  In a future patch, the transaction log's
XaApplier plugin will also derive from MonitoredInTransaction, as
the transaction log, in XA mode, is also monitored by Drizzle's
transaction manager and automatically enlisted in XA transactions.

* Updates all documentation in /drizzled/transaction_services.cc
  to accurately reflect Drizzle's new transaction management
  process and explicit transaction and statement boundaries.

* Kills off dead code:

  binlog_format_names
  ha_init()
  total_ha, total_ha_2pc (no longer necessary, as the above-mentioned
  abstract base classes provide all of this functionality)
  StorageEngine::slot (now plugin::MonitoredInTransaction::getId())
  TransactionalStorageEngine::two_phase_commit (same as above)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
4
 *  Copyright (C) 2008 Sun Microsystems
5
 
 *  Copyright (c) Jay Pipes <jaypipes@gmail.com>
 
5
 *  Copyright (c) 2010 Jay Pipes <jaypipes@gmail.com>
6
6
 *
7
7
 *  This program is free software; you can redistribute it and/or modify
8
8
 *  it under the terms of the GNU General Public License as published by
31
31
/* some forward declarations needed */
32
32
namespace plugin
33
33
{
 
34
  class MonitoredInTransaction;
 
35
  class XaResourceManager;
34
36
  class TransactionalStorageEngine;
35
37
}
36
38
 
87
89
   * Put in assert()s to test this.
88
90
   *
89
91
   * @param[in] Session pointer
90
 
   * @param[in] Resource which will be participating
 
92
   * @param[in] Descriptor for the resource which will be participating
 
93
   * @param[in] Pointer to the TransactionalStorageEngine resource
91
94
   */
92
95
  void registerResourceForStatement(Session *session,
 
96
                                    plugin::MonitoredInTransaction *monitored,
93
97
                                    plugin::TransactionalStorageEngine *engine);
94
98
 
95
99
  /**
 
100
   * Marks an XA storage engine as participating in a statement
 
101
   * transaction.
 
102
   *
 
103
   * @note
 
104
   * 
 
105
   * This method is idempotent
 
106
   *
 
107
   * @todo
 
108
   *
 
109
   * This method should not be called more than once per resource
 
110
   * per statement, and therefore should not need to be idempotent.
 
111
   * Put in assert()s to test this.
 
112
   *
 
113
   * @param[in] Session pointer
 
114
   * @param[in] Descriptor for the resource which will be participating
 
115
   * @param[in] Pointer to the TransactionalStorageEngine resource
 
116
   * @param[in] Pointer to the XaResourceManager resource manager
 
117
   */
 
118
  void registerResourceForStatement(Session *session,
 
119
                                    plugin::MonitoredInTransaction *monitored,
 
120
                                    plugin::TransactionalStorageEngine *engine,
 
121
                                    plugin::XaResourceManager *resource_manager);
 
122
 
 
123
  /**
96
124
   * Registers a resource manager in the "normal" transaction.
97
125
   *
98
126
   * @note
117
145
   * TransactionServices::registerResourceForStatement method.
118
146
   */
119
147
  void registerResourceForTransaction(Session *session,
 
148
                                      plugin::MonitoredInTransaction *monitored,
120
149
                                      plugin::TransactionalStorageEngine *engine);
 
150
  void registerResourceForTransaction(Session *session,
 
151
                                      plugin::MonitoredInTransaction *monitored,
 
152
                                      plugin::TransactionalStorageEngine *engine,
 
153
                                      plugin::XaResourceManager *resource_manager);
121
154
};
122
155
 
123
156
} /* namespace drizzled */