~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table/concurrent.cc

  • Committer: Stewart Smith
  • Date: 2011-03-29 01:30:47 UTC
  • mto: (2257.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: stewart@flamingspork.com-20110329013047-5ujzfx6pahmwuko2
have CachedDirectory print out a warning if we can't stat() something in a directory. We should always have access to at least stat() things in directories Drizzle is running in (otherwise there is likely a problem)

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"
32
 
 
33
 
namespace drizzled
34
 
{
35
 
 
36
 
namespace table
37
 
{
 
27
#include <drizzled/session.h>
 
28
#include <plugin/myisam/myisam.h>
 
29
#include <drizzled/plugin/transactional_storage_engine.h>
 
30
#include <drizzled/table/instance.h>
 
31
#include <drizzled/table.h>
 
32
#include <drizzled/table_list.h>
 
33
 
 
34
namespace drizzled {
 
35
namespace table {
38
36
 
39
37
/*
40
38
  Open table which is already name-locked by this thread.
66
64
  if (session->getKilled())
67
65
    return true;
68
66
 
69
 
  TableIdentifier identifier(table_list->getSchemaName(), table_list->getTableName());
 
67
  identifier::Table identifier(table_list->getSchemaName(), table_list->getTableName());
70
68
  if (open_unireg_entry(session, table_list->getTableName(), identifier))
71
69
  {
72
70
    intern_close_table();
119
117
 
120
118
int table::Concurrent::open_unireg_entry(Session *session,
121
119
                                         const char *alias,
122
 
                                         TableIdentifier &identifier)
 
120
                                         identifier::Table &identifier)
123
121
{
124
122
  int error;
125
123
  TableShare::shared_ptr share;
127
125
 
128
126
  safe_mutex_assert_owner(table::Cache::singleton().mutex().native_handle());
129
127
retry:
130
 
  if (not (share= TableShare::getShareCreate(session,
131
 
                                             identifier,
132
 
                                             error)))
 
128
  if (not (share= table::instance::Shared::make_shared(session, identifier, error)))
133
129
  {
134
130
    return 1;
135
131
  }
148
144
      share->resetVersion();                        // Mark share as old
149
145
      if (discover_retry_count++)               // Retry once
150
146
      {
151
 
        TableShare::release(share);
 
147
        table::instance::release(share);
152
148
        return 1;
153
149
      }
154
150
 
173
169
      */
174
170
      if (share->getTableCount() != 1)
175
171
      {
176
 
        TableShare::release(share);
 
172
        table::instance::release(share);
177
173
        return 1;
178
174
      }
 
175
 
179
176
      /* Free share and wait until it's released by all threads */
180
 
      TableShare::release(share);
 
177
      table::instance::release(share);
181
178
 
182
179
      if (not session->getKilled())
183
180
      {
185
182
        session->clear_error();                 // Clear error message
186
183
        goto retry;
187
184
      }
 
185
 
188
186
      return 1;
189
187
    }
190
188
 
191
 
    TableShare::release(share);
 
189
    table::instance::release(share);
192
190
 
193
191
    return 1;
194
192
  }
204
202
  // delete if this happens.
205
203
  if (getShare()->getType() == message::Table::STANDARD)
206
204
  {
207
 
    TableShare::release(getMutableShare());
 
205
    table::instance::release(getMutableShare());
208
206
  }
209
207
  else
210
208
  {