~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.cc

This patch significantly reworks the way that
savepoints are handled:

1) Memory management

   Removes the trans_prealloc_size and trans_block_size
   variables which set up a separate mem_root for storing
   "savepoint data".  Without the binlog, this separate
   memory root, which by default allocated 1M *for every
   single transaction regardless of whether savepoints
   were used*, was not useful any more.

2) No more DIY linked lists of SAVEPOINT pointers

   The Session::transaction struct used to contain a 
   member "savepoints" which was of type pointer to
   SAVEPOINT.  This has been replaced with an STL
   std::deque<drizzled::NamedSavepoint> and the pointeri and
   linked-list fiddling is gone, replaced with STL conventions.

3) SAVEPOINT struct is now drizzled::NamedSavepoint

   The SAVEPOINT struct has been converted to an STL container-
   safe class called drizzled::NamedSavepoint.

4) RollbackToSavepoint, Savepoint, and ReleaseSavepoint

   RollbackToSavepoint, Savepoint, and ReleaseSavepoint classes
   have had their logic revamped and documented.

5) The innodb.test case had (has?) an error in it

   The innodb.test case was testing a wrong assertion that
   a ROLLBACK TO SAVEPOINT x; should result in an error if
   called twice in a row.  This is incorrect behaviour.  If
   a ROLLBACK TO SAVEPOINT x; is executed, the savepoint x
   should stay on the top of the savepoint stack.

6) XID and XID_STATE classes made STL-container-safe

   Places proper initializer lists and constructors for
   the XID and XID_STATE classes and removes use of the
   horrible memset(this, 0, sizeof(*this)); usage.

7) The various savepoint-handling routines use references

   A switch was made to the various savepoint-handling routines
   of TransactionServices to ensure only references to a 
   drizzled::NamedSavepoint were being passed, and not void pointers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
static void fix_completion_type(Session *session, enum_var_type type);
101
101
static void fix_max_join_size(Session *session, enum_var_type type);
102
102
static void fix_session_mem_root(Session *session, enum_var_type type);
103
 
static void fix_trans_mem_root(Session *session, enum_var_type type);
104
103
static void fix_server_id(Session *session, enum_var_type type);
105
104
static bool get_unsigned32(Session *session, set_var *var);
106
105
static bool get_unsigned64(Session *session, set_var *var);
190
189
                                                        &SV::query_prealloc_size,
191
190
                                                        false, fix_session_mem_root);
192
191
static sys_var_readonly sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
193
 
static sys_var_session_uint32_t sys_trans_alloc_block_size(&vars, "transaction_alloc_block_size",
194
 
                                                           &SV::trans_alloc_block_size,
195
 
                                                           false, fix_trans_mem_root);
196
 
static sys_var_session_uint32_t sys_trans_prealloc_size(&vars, "transaction_prealloc_size",
197
 
                                                        &SV::trans_prealloc_size,
198
 
                                                        false, fix_session_mem_root);
199
192
 
200
193
static sys_var_const_str_ptr sys_secure_file_priv(&vars, "secure_file_priv",
201
194
                                             &opt_secure_file_priv);
411
404
                        session->variables.query_prealloc_size);
412
405
}
413
406
 
414
 
 
415
 
static void fix_trans_mem_root(Session *session, enum_var_type type)
416
 
{
417
 
  if (type != OPT_GLOBAL)
418
 
    reset_root_defaults(&session->transaction.mem_root,
419
 
                        session->variables.trans_alloc_block_size,
420
 
                        session->variables.trans_prealloc_size);
421
 
}
422
 
 
423
 
 
424
407
static void fix_server_id(Session *, enum_var_type)
425
408
{
426
409
}