~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table/concurrent.cc

  • Committer: Monty Taylor
  • Date: 2011-03-10 18:09:05 UTC
  • mfrom: (2225.2.2 refactor)
  • mto: This revision was merged to the branch mainline in revision 2228.
  • Revision ID: mordred@inaugust.com-20110310180905-ttx05t7q7ff6nl7c
Merge Olad: Refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
 
21
#include <config.h>
22
22
 
23
23
#include <sys/types.h>
24
24
#include <sys/stat.h>
25
25
#include <fcntl.h>
26
26
 
27
 
#include "drizzled/session.h"
28
 
#include "plugin/myisam/myisam.h"
29
 
#include "drizzled/plugin/transactional_storage_engine.h"
30
 
 
31
 
#include "drizzled/table.h"
 
27
#include <drizzled/session.h>
 
28
#include <plugin/myisam/myisam.h>
 
29
#include <drizzled/plugin/transactional_storage_engine.h>
 
30
 
 
31
#include <drizzled/table/instance.h>
 
32
 
 
33
#include <drizzled/table.h>
32
34
 
33
35
namespace drizzled
34
36
{
66
68
  if (session->getKilled())
67
69
    return true;
68
70
 
69
 
  TableIdentifier identifier(table_list->getSchemaName(), table_list->getTableName());
 
71
  identifier::Table identifier(table_list->getSchemaName(), table_list->getTableName());
70
72
  if (open_unireg_entry(session, table_list->getTableName(), identifier))
71
73
  {
72
74
    intern_close_table();
119
121
 
120
122
int table::Concurrent::open_unireg_entry(Session *session,
121
123
                                         const char *alias,
122
 
                                         TableIdentifier &identifier)
 
124
                                         identifier::Table &identifier)
123
125
{
124
126
  int error;
125
127
  TableShare::shared_ptr share;
127
129
 
128
130
  safe_mutex_assert_owner(table::Cache::singleton().mutex().native_handle());
129
131
retry:
130
 
  if (not (share= TableShare::getShareCreate(session,
131
 
                                             identifier,
132
 
                                             error)))
 
132
  if (not (share= table::instance::Shared::make_shared(session, identifier, error)))
133
133
  {
134
134
    return 1;
135
135
  }
148
148
      share->resetVersion();                        // Mark share as old
149
149
      if (discover_retry_count++)               // Retry once
150
150
      {
151
 
        TableShare::release(share);
 
151
        table::instance::release(share);
152
152
        return 1;
153
153
      }
154
154
 
173
173
      */
174
174
      if (share->getTableCount() != 1)
175
175
      {
176
 
        TableShare::release(share);
 
176
        table::instance::release(share);
177
177
        return 1;
178
178
      }
 
179
 
179
180
      /* Free share and wait until it's released by all threads */
180
 
      TableShare::release(share);
 
181
      table::instance::release(share);
181
182
 
182
183
      if (not session->getKilled())
183
184
      {
185
186
        session->clear_error();                 // Clear error message
186
187
        goto retry;
187
188
      }
 
189
 
188
190
      return 1;
189
191
    }
190
192
 
191
 
    TableShare::release(share);
 
193
    table::instance::release(share);
192
194
 
193
195
    return 1;
194
196
  }
204
206
  // delete if this happens.
205
207
  if (getShare()->getType() == message::Table::STANDARD)
206
208
  {
207
 
    TableShare::release(getMutableShare());
 
209
    table::instance::release(getMutableShare());
208
210
  }
209
211
  else
210
212
  {