~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/* Copyright (C) 2005 MySQL AB
2
3
  This program is free software; you can redistribute it and/or modify
4
  it under the terms of the GNU General Public License as published by
5
  the Free Software Foundation; version 2 of the License.
6
7
  This program is distributed in the hope that it will be useful,
8
  but WITHOUT ANY WARRANTY; without even the implied warranty of
9
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
  GNU General Public License for more details.
11
12
  You should have received a copy of the GNU General Public License
13
  along with this program; if not, write to the Free Software
14
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
670.2.2 by Monty Taylor
Got rid of the rest of common_includes. Now on to server_includes.
16
#include <drizzled/server_includes.h>
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
17
#include <drizzled/table.h>
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
18
#include <mysys/my_dir.h>
19
#include <drizzled/error.h>
20
1 by brian
clean slate
21
#include "ha_blackhole.h"
22
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
23
#include <fcntl.h>
24
960.2.41 by Monty Taylor
Made StorageEngine name private. Added constructor param and accessor method.
25
#include <string>
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
26
#include <map>
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
27
#include <fstream>
28
#include <drizzled/message/table.pb.h>
29
#include <google/protobuf/io/zero_copy_stream.h>
30
#include <google/protobuf/io/zero_copy_stream_impl.h>
960.2.41 by Monty Taylor
Made StorageEngine name private. Added constructor param and accessor method.
31
32
using namespace std;
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
33
using namespace google;
960.2.41 by Monty Taylor
Made StorageEngine name private. Added constructor param and accessor method.
34
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
35
#define BLACKHOLE_EXT ".blk"
1039.3.1 by Stewart Smith
move bas_ext to StorageEngine instead of handler
36
37
static const char *ha_blackhole_exts[] = {
38
  NULL
39
};
40
1130.1.4 by Monty Taylor
Moved StorageEngine into plugin namespace.
41
class BlackholeEngine : public drizzled::plugin::StorageEngine
1 by brian
clean slate
42
{
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
43
  typedef map<string, BlackholeShare*> BlackholeMap;
44
  BlackholeMap blackhole_open_tables;
45
960.2.41 by Monty Taylor
Made StorageEngine name private. Added constructor param and accessor method.
46
public:
964.1.4 by Monty Taylor
Moved flags into private area.
47
  BlackholeEngine(const string &name_arg)
1233.1.3 by Brian Aker
Move more of the flags up to engine flags.
48
   : drizzled::plugin::StorageEngine(name_arg, HTON_FILE_BASED |
49
                                     HTON_NULL_IN_KEY |
50
                                     HTON_CAN_INDEX_BLOBS |
1236.1.2 by Brian Aker
Updating blackhole to skip store_lock. I've added a test to make sure that
51
                                     HTON_SKIP_STORE_LOCK |
1233.1.6 by Brian Aker
Remove table_flags from MyISAM.
52
                                     HTON_AUTO_PART_KEY |
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
53
                                     HTON_HAS_DATA_DICTIONARY),
54
    blackhole_open_tables()
1183.1.27 by Brian Aker
Fix issue where there are too many files in data directory. We now only
55
  {
56
    table_definition_ext= BLACKHOLE_EXT;
57
  }
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
58
1208.3.2 by brian
Update for Cursor renaming.
59
  virtual Cursor *create(TableShare &table,
960.2.29 by Monty Taylor
Updated blackhole.
60
                          MEM_ROOT *mem_root)
61
  {
1208.3.2 by brian
Update for Cursor renaming.
62
    return new (mem_root) ha_blackhole(*this, table);
960.2.29 by Monty Taylor
Updated blackhole.
63
  }
1039.3.1 by Stewart Smith
move bas_ext to StorageEngine instead of handler
64
65
  const char **bas_ext() const {
66
    return ha_blackhole_exts;
67
  }
1039.3.3 by Stewart Smith
Move handler::create to StorageEngine::create_table
68
1233.1.6 by Brian Aker
Remove table_flags from MyISAM.
69
  int doCreateTable(Session*,
1222.1.7 by Brian Aker
Remove HA_CREATE_INFO from createTable()
70
                    const char *,
71
                    Table&,
72
                    drizzled::message::Table&);
1103.5.2 by Toru Maesaka
Added tests for BLACKHOLE and also code to create and delete a empty file. This is so that the core can track if a table exists or not. This is required for proper implementation of DROP TABLE and otherwise the test suite will reject it
73
1233.1.6 by Brian Aker
Remove table_flags from MyISAM.
74
  int doDropTable(Session&, const string table_name);
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
75
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
76
  BlackholeShare *findOpenTable(const string table_name);
77
  void addOpenTable(const string &table_name, BlackholeShare *);
78
  void deleteOpenTable(const string &table_name);
79
1183.1.29 by Brian Aker
Clean up interface so that Truncate sets the propper engine when
80
  int doGetTableDefinition(Session& session,
81
                           const char* path,
1183.5.1 by Brian Aker
Extended definition interface (filename building should now be moved
82
                           const char *db,
83
                           const char *table_name,
84
                           const bool is_tmp,
85
                           drizzled::message::Table *table_proto);
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
86
1183.1.15 by Brian Aker
I_S now provides its own tables via the SE interface
87
  void doGetTableNames(CachedDirectory &directory, string&, set<string>& set_of_names)
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
88
  {
89
    CachedDirectory::Entries entries= directory.getEntries();
90
1233.1.9 by Brian Aker
Move max key stuff up to engine.
91
    for (CachedDirectory::Entries::iterator entry_iter= entries.begin();
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
92
         entry_iter != entries.end(); ++entry_iter)
93
    {
94
      CachedDirectory::Entry *entry= *entry_iter;
95
      string *filename= &entry->filename;
96
97
      assert(filename->size());
98
99
      const char *ext= strchr(filename->c_str(), '.');
100
101
      if (ext == NULL || my_strcasecmp(system_charset_info, ext, BLACKHOLE_EXT) ||
102
          is_prefix(filename->c_str(), TMP_FILE_PREFIX))
103
      {  }
104
      else
105
      {
106
        char uname[NAME_LEN + 1];
107
        uint32_t file_name_len;
108
109
        file_name_len= filename_to_tablename(filename->c_str(), uname, sizeof(uname));
110
        // TODO: Remove need for memory copy here
1233.1.9 by Brian Aker
Move max key stuff up to engine.
111
        uname[file_name_len - sizeof(BLACKHOLE_EXT) + 1]= '\0'; // Subtract ending, place NULL
1183.1.13 by Brian Aker
Fix pass by reference for directory object
112
        set_of_names.insert(uname);
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
113
      }
114
    }
115
  }
1233.1.9 by Brian Aker
Move max key stuff up to engine.
116
117
  /* The following defines can be increased if necessary */
118
  uint32_t max_supported_keys()          const { return BLACKHOLE_MAX_KEY; }
119
  uint32_t max_supported_key_length()    const { return BLACKHOLE_MAX_KEY_LENGTH; }
120
  uint32_t max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
1235.1.13 by Brian Aker
Next pass through interface to move index flag bits up to engine.
121
122
  uint32_t index_flags(enum  ha_key_alg) const
123
  {
124
    return (HA_READ_NEXT |
125
            HA_READ_PREV |
126
            HA_READ_RANGE |
127
            HA_READ_ORDER |
128
            HA_KEYREAD_ONLY);
129
  }
130
960.2.29 by Monty Taylor
Updated blackhole.
131
};
1 by brian
clean slate
132
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
133
134
BlackholeShare *BlackholeEngine::findOpenTable(const string table_name)
135
{
136
  BlackholeMap::iterator find_iter=
137
    blackhole_open_tables.find(table_name);
138
139
  if (find_iter != blackhole_open_tables.end())
140
    return (*find_iter).second;
141
  else
142
    return NULL;
143
}
144
145
void BlackholeEngine::addOpenTable(const string &table_name, BlackholeShare *share)
146
{
147
  blackhole_open_tables[table_name]= share;
148
}
149
150
void BlackholeEngine::deleteOpenTable(const string &table_name)
151
{
152
  blackhole_open_tables.erase(table_name);
153
}
154
155
1 by brian
clean slate
156
/* Static declarations for shared structures */
157
158
static pthread_mutex_t blackhole_mutex;
159
160
161
/*****************************************************************************
162
** BLACKHOLE tables
163
*****************************************************************************/
164
1208.3.2 by brian
Update for Cursor renaming.
165
ha_blackhole::ha_blackhole(drizzled::plugin::StorageEngine &engine_arg,
166
                           TableShare &table_arg)
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
167
  :Cursor(engine_arg, table_arg), share(NULL)
1208.3.2 by brian
Update for Cursor renaming.
168
{ }
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
169
653 by Brian Aker
More solaris bits
170
int ha_blackhole::open(const char *name, int, uint32_t)
1 by brian
clean slate
171
{
172
  if (!(share= get_share(name)))
51.3.8 by Jay Pipes
Removed DBUG from CSV and Blackhole storage engines
173
    return(HA_ERR_OUT_OF_MEM);
1 by brian
clean slate
174
175
  thr_lock_data_init(&share->lock, &lock, NULL);
51.3.8 by Jay Pipes
Removed DBUG from CSV and Blackhole storage engines
176
  return(0);
1 by brian
clean slate
177
}
178
179
int ha_blackhole::close(void)
180
{
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
181
  free_share();
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
182
  return 0;
1 by brian
clean slate
183
}
184
1183.1.6 by Brian Aker
Simplify createTable()
185
int BlackholeEngine::doCreateTable(Session*, const char *path,
1222.1.7 by Brian Aker
Remove HA_CREATE_INFO from createTable()
186
                                   Table&,
1183.1.18 by Brian Aker
Fixed references to doCreateTable()
187
                                   drizzled::message::Table& proto)
1 by brian
clean slate
188
{
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
189
  string serialized_proto;
190
  string new_path;
191
192
  new_path= path;
193
  new_path+= BLACKHOLE_EXT;
1183.1.19 by Brian Aker
Three cleanups from build test.
194
  fstream output(new_path.c_str(), ios::out | ios::binary);
195
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
196
197
  if (! output)
198
    return 1;
199
1183.1.18 by Brian Aker
Fixed references to doCreateTable()
200
  if (! proto.SerializeToOstream(&output))
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
201
  {
202
    output.close();
203
    unlink(new_path.c_str());
204
    return 1;
205
  }
206
207
  return 0;
1103.5.2 by Toru Maesaka
Added tests for BLACKHOLE and also code to create and delete a empty file. This is so that the core can track if a table exists or not. This is required for proper implementation of DROP TABLE and otherwise the test suite will reject it
208
}
209
1183.1.29 by Brian Aker
Clean up interface so that Truncate sets the propper engine when
210
211
int BlackholeEngine::doDropTable(Session&, const string path)
1103.5.2 by Toru Maesaka
Added tests for BLACKHOLE and also code to create and delete a empty file. This is so that the core can track if a table exists or not. This is required for proper implementation of DROP TABLE and otherwise the test suite will reject it
212
{
1213 by Brian Aker
Fixes startup failures when temporary tables were left behind in a crash.
213
  string new_path(path);
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
214
215
  new_path+= BLACKHOLE_EXT;
216
1213 by Brian Aker
Fixes startup failures when temporary tables were left behind in a crash.
217
  int error= unlink(new_path.c_str());
218
219
  if (error != 0)
1103.5.3 by Toru Maesaka
Fix the curly brace in BLACKHOLE to follow the coding standard
220
  {
1213 by Brian Aker
Fixes startup failures when temporary tables were left behind in a crash.
221
    error= my_errno= errno;
1103.5.2 by Toru Maesaka
Added tests for BLACKHOLE and also code to create and delete a empty file. This is so that the core can track if a table exists or not. This is required for proper implementation of DROP TABLE and otherwise the test suite will reject it
222
  }
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
223
1213 by Brian Aker
Fixes startup failures when temporary tables were left behind in a crash.
224
  return error;
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
225
}
226
1183.1.29 by Brian Aker
Clean up interface so that Truncate sets the propper engine when
227
228
int BlackholeEngine::doGetTableDefinition(Session&,
229
                                          const char* path,
1183.5.1 by Brian Aker
Extended definition interface (filename building should now be moved
230
                                          const char *,
231
                                          const char *,
232
                                          const bool,
233
                                          drizzled::message::Table *table_proto)
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
234
{
235
  string new_path;
236
237
  new_path= path;
238
  new_path+= BLACKHOLE_EXT;
239
240
  int fd= open(new_path.c_str(), O_RDONLY);
241
242
  if (fd == -1)
243
  {
1217.1.4 by Brian Aker
Cleanup of return errors from engines (still... a better job could be done).
244
    return errno;
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
245
  }
246
247
  google::protobuf::io::ZeroCopyInputStream* input=
248
    new google::protobuf::io::FileInputStream(fd);
249
250
  if (! input)
1217.1.4 by Brian Aker
Cleanup of return errors from engines (still... a better job could be done).
251
    return HA_ERR_CRASHED_ON_USAGE;
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
252
253
  if (table_proto && ! table_proto->ParseFromZeroCopyStream(input))
254
  {
255
    close(fd);
1183.1.28 by Brian Aker
Memory leak fixed in blackhole
256
    delete input;
1217.1.4 by Brian Aker
Cleanup of return errors from engines (still... a better job could be done).
257
    return HA_ERR_CRASHED_ON_USAGE;
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
258
  }
259
1183.1.28 by Brian Aker
Memory leak fixed in blackhole
260
  delete input;
1183.1.10 by Brian Aker
Update blackhole engine to handle its own dictionary
261
  return EEXIST;
1 by brian
clean slate
262
}
263
653 by Brian Aker
More solaris bits
264
const char *ha_blackhole::index_type(uint32_t)
1 by brian
clean slate
265
{
249 by Brian Aker
Random key cleanup (it is a friday...)
266
  return("BTREE");
1 by brian
clean slate
267
}
268
653 by Brian Aker
More solaris bits
269
int ha_blackhole::write_row(unsigned char *)
1 by brian
clean slate
270
{
51.3.8 by Jay Pipes
Removed DBUG from CSV and Blackhole storage engines
271
  return(table->next_number_field ? update_auto_increment() : 0);
1 by brian
clean slate
272
}
273
653 by Brian Aker
More solaris bits
274
int ha_blackhole::rnd_init(bool)
1 by brian
clean slate
275
{
51.3.8 by Jay Pipes
Removed DBUG from CSV and Blackhole storage engines
276
  return(0);
1 by brian
clean slate
277
}
278
279
653 by Brian Aker
More solaris bits
280
int ha_blackhole::rnd_next(unsigned char *)
1 by brian
clean slate
281
{
51.3.8 by Jay Pipes
Removed DBUG from CSV and Blackhole storage engines
282
  return(HA_ERR_END_OF_FILE);
1 by brian
clean slate
283
}
284
285
653 by Brian Aker
More solaris bits
286
int ha_blackhole::rnd_pos(unsigned char *, unsigned char *)
1 by brian
clean slate
287
{
51.3.8 by Jay Pipes
Removed DBUG from CSV and Blackhole storage engines
288
  assert(0);
289
  return(0);
1 by brian
clean slate
290
}
291
292
653 by Brian Aker
More solaris bits
293
void ha_blackhole::position(const unsigned char *)
1 by brian
clean slate
294
{
51.3.8 by Jay Pipes
Removed DBUG from CSV and Blackhole storage engines
295
  assert(0);
296
  return;
1 by brian
clean slate
297
}
298
299
482 by Brian Aker
Remove uint.
300
int ha_blackhole::info(uint32_t flag)
1 by brian
clean slate
301
{
212.6.9 by Mats Kindahl
Removing extreneous explicit casts for blackhole storage engine.
302
  memset(&stats, 0, sizeof(stats));
1 by brian
clean slate
303
  if (flag & HA_STATUS_AUTO)
304
    stats.auto_increment_value= 1;
51.3.8 by Jay Pipes
Removed DBUG from CSV and Blackhole storage engines
305
  return(0);
1 by brian
clean slate
306
}
307
308
653 by Brian Aker
More solaris bits
309
int ha_blackhole::index_read_map(unsigned char *, const unsigned char *,
310
                                 key_part_map, enum ha_rkey_function)
311
{
312
  return(HA_ERR_END_OF_FILE);
313
}
314
315
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
316
int ha_blackhole::index_read_idx_map(unsigned char *, uint32_t, const unsigned char *,
653 by Brian Aker
More solaris bits
317
                                     key_part_map, enum ha_rkey_function)
318
{
319
  return(HA_ERR_END_OF_FILE);
320
}
321
322
323
int ha_blackhole::index_read_last_map(unsigned char *, const unsigned char *, key_part_map)
324
{
325
  return(HA_ERR_END_OF_FILE);
326
}
327
328
329
int ha_blackhole::index_next(unsigned char *)
330
{
331
  return(HA_ERR_END_OF_FILE);
332
}
333
334
335
int ha_blackhole::index_prev(unsigned char *)
336
{
337
  return(HA_ERR_END_OF_FILE);
338
}
339
340
341
int ha_blackhole::index_first(unsigned char *)
342
{
343
  return(HA_ERR_END_OF_FILE);
344
}
345
346
347
int ha_blackhole::index_last(unsigned char *)
1 by brian
clean slate
348
{
51.3.8 by Jay Pipes
Removed DBUG from CSV and Blackhole storage engines
349
  return(HA_ERR_END_OF_FILE);
1 by brian
clean slate
350
}
351
352
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
353
BlackholeShare *ha_blackhole::get_share(const char *table_name)
1 by brian
clean slate
354
{
355
  pthread_mutex_lock(&blackhole_mutex);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
356
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
357
  BlackholeEngine *a_engine= static_cast<BlackholeEngine *>(engine);
358
  share= a_engine->findOpenTable(table_name);
359
360
  if (share == NULL)
1 by brian
clean slate
361
  {
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
362
    share= new (nothrow) BlackholeShare(table_name);
363
    if (share == NULL)
1 by brian
clean slate
364
    {
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
365
      pthread_mutex_unlock(&blackhole_mutex);      
366
      return NULL;
1 by brian
clean slate
367
    }
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
368
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
369
    a_engine->addOpenTable(share->table_name, share);
1 by brian
clean slate
370
  }
371
  share->use_count++;
372
  pthread_mutex_unlock(&blackhole_mutex);
373
  return share;
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
374
1 by brian
clean slate
375
}
376
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
377
void ha_blackhole::free_share()
1 by brian
clean slate
378
{
379
  pthread_mutex_lock(&blackhole_mutex);
380
  if (!--share->use_count)
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
381
  {
382
    BlackholeEngine *a_engine= static_cast<BlackholeEngine *>(engine);
383
    a_engine->deleteOpenTable(share->table_name);
384
    delete share;
385
  }
1 by brian
clean slate
386
  pthread_mutex_unlock(&blackhole_mutex);
387
}
388
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
389
BlackholeShare::BlackholeShare(const string table_name_arg)
390
  : use_count(0), table_name(table_name_arg)
391
{
392
  thr_lock_init(&lock);
393
}
394
395
BlackholeShare::~BlackholeShare()
396
{
397
  thr_lock_delete(&lock);
398
}
399
1 by brian
clean slate
400
1130.1.4 by Monty Taylor
Moved StorageEngine into plugin namespace.
401
static drizzled::plugin::StorageEngine *blackhole_engine= NULL;
971.1.51 by Monty Taylor
New-style plugin registration now works.
402
1110.1.5 by Monty Taylor
Renamed PluginRegistry to plugin::Registry.
403
static int blackhole_init(drizzled::plugin::Registry &registry)
1 by brian
clean slate
404
{
971.1.51 by Monty Taylor
New-style plugin registration now works.
405
1192.5.9 by Monty Taylor
Made blackhole dynamic
406
  blackhole_engine= new BlackholeEngine("BLACKHOLE");
1130.1.8 by Monty Taylor
Added polymorphic add/remove methods around slot add/remove methods.
407
  registry.add(blackhole_engine);
971.1.51 by Monty Taylor
New-style plugin registration now works.
408
  
398.1.10 by Monty Taylor
Actually removed VOID() this time.
409
  pthread_mutex_init(&blackhole_mutex, MY_MUTEX_INIT_FAST);
1 by brian
clean slate
410
411
  return 0;
412
}
413
1110.1.5 by Monty Taylor
Renamed PluginRegistry to plugin::Registry.
414
static int blackhole_fini(drizzled::plugin::Registry &registry)
1 by brian
clean slate
415
{
1130.1.8 by Monty Taylor
Added polymorphic add/remove methods around slot add/remove methods.
416
  registry.remove(blackhole_engine);
960.2.29 by Monty Taylor
Updated blackhole.
417
  delete blackhole_engine;
418
1 by brian
clean slate
419
  pthread_mutex_destroy(&blackhole_mutex);
420
421
  return 0;
422
}
423
1228.1.5 by Monty Taylor
Merged in some naming things.
424
DRIZZLE_DECLARE_PLUGIN
1 by brian
clean slate
425
{
1241.10.2 by Monty Taylor
Added support for embedding the drizzle version number in the plugin file.
426
  DRIZZLE_VERSION_ID,
1 by brian
clean slate
427
  "BLACKHOLE",
177.4.3 by mark
ripped out more plugin ABI and API version checking, and plugin versions are now strings
428
  "1.0",
1 by brian
clean slate
429
  "MySQL AB",
430
  "/dev/null storage engine (anything you write to it disappears)",
431
  PLUGIN_LICENSE_GPL,
1103.5.1 by Toru Maesaka
Updated Blackhole to work with the current SE interface
432
  blackhole_init,     /* Plugin Init */
433
  blackhole_fini,     /* Plugin Deinit */
434
  NULL,               /* status variables */
435
  NULL,               /* system variables */
436
  NULL                /* config options   */
1 by brian
clean slate
437
}
1228.1.5 by Monty Taylor
Merged in some naming things.
438
DRIZZLE_DECLARE_PLUGIN_END;