Commit 9f326d6a authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.0

into serg.mylan:/usr/home/serg/Abk/mysql-5.0


sql/mysql_priv.h:
  Auto merged
parents baae624c 1438e06e
...@@ -161,7 +161,8 @@ bsdi*) optimize_def="-O2";; ...@@ -161,7 +161,8 @@ bsdi*) optimize_def="-O2";;
freebsd*) freebsd*)
optimize_def="-O2" optimize_def="-O2"
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
LDFLAGS="$LDFLAGS -pthread";; #LDFLAGS="$LDFLAGS -pthread"
;;
hpux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT";; hpux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT";;
irix*) optimize_def="-O2" irix*) optimize_def="-O2"
CPPFLAGS="$CPPFLAGS -D_SGI_MP_SOURCE";; CPPFLAGS="$CPPFLAGS -D_SGI_MP_SOURCE";;
......
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
void SetIV(const byte* iv) { memcpy(reg_, iv, blockSz_); } void SetIV(const byte* iv) { memcpy(reg_, iv, blockSz_); }
private: private:
byte reg_[MaxBlockSz]; byte __attribute__ ((aligned (sizeof(word32)))) reg_[MaxBlockSz];
byte tmp_[MaxBlockSz]; byte tmp_[MaxBlockSz];
int blockSz_; int blockSz_;
......
...@@ -948,12 +948,6 @@ int ha_berkeley::write_row(byte * record) ...@@ -948,12 +948,6 @@ int ha_berkeley::write_row(byte * record)
for (uint retry=0 ; retry < berkeley_trans_retry ; retry++) for (uint retry=0 ; retry < berkeley_trans_retry ; retry++)
{ {
key_map changed_keys(0); key_map changed_keys(0);
if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
{
if ((error=txn_begin(db_env, transaction, &sub_trans, 0))) /* purecov: deadcode */
break; /* purecov: deadcode */
DBUG_PRINT("trans",("starting subtransaction")); /* purecov: deadcode */
}
if (!(error=file->put(file, sub_trans, create_key(&prim_key, primary_key, if (!(error=file->put(file, sub_trans, create_key(&prim_key, primary_key,
key_buff, record), key_buff, record),
&row, key_type[primary_key]))) &row, key_type[primary_key])))
...@@ -983,12 +977,7 @@ int ha_berkeley::write_row(byte * record) ...@@ -983,12 +977,7 @@ int ha_berkeley::write_row(byte * record)
if (using_ignore) if (using_ignore)
{ {
int new_error = 0; int new_error = 0;
if (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS) if (!changed_keys.is_clear_all())
{
DBUG_PRINT("trans",("aborting subtransaction")); /* purecov: deadcode */
new_error=txn_abort(sub_trans); /* purecov: deadcode */
}
else if (!changed_keys.is_clear_all())
{ {
new_error = 0; new_error = 0;
for (uint keynr=0; for (uint keynr=0;
...@@ -1010,11 +999,6 @@ int ha_berkeley::write_row(byte * record) ...@@ -1010,11 +999,6 @@ int ha_berkeley::write_row(byte * record)
} }
} }
} }
else if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
{
DBUG_PRINT("trans",("committing subtransaction")); /* purecov: deadcode */
error=txn_commit(sub_trans, 0); /* purecov: deadcode */
}
if (error != DB_LOCK_DEADLOCK) if (error != DB_LOCK_DEADLOCK)
break; break;
} }
...@@ -1090,8 +1074,7 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed, ...@@ -1090,8 +1074,7 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
{ {
// Probably a duplicated key; restore old key and row if needed // Probably a duplicated key; restore old key and row if needed
last_dup_key=primary_key; last_dup_key=primary_key;
if (local_using_ignore && if (local_using_ignore)
!(thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
{ {
int new_error; int new_error;
if ((new_error=pack_row(&row, old_row, 0)) || if ((new_error=pack_row(&row, old_row, 0)) ||
...@@ -1202,12 +1185,6 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row) ...@@ -1202,12 +1185,6 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
for (uint retry=0 ; retry < berkeley_trans_retry ; retry++) for (uint retry=0 ; retry < berkeley_trans_retry ; retry++)
{ {
key_map changed_keys(0); key_map changed_keys(0);
if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
{
if ((error=txn_begin(db_env, transaction, &sub_trans, 0))) /* purecov: deadcode */
break; /* purecov: deadcode */
DBUG_PRINT("trans",("starting subtransaction")); /* purecov: deadcode */
}
/* Start by updating the primary key */ /* Start by updating the primary key */
if (!(error=update_primary_key(sub_trans, primary_key_changed, if (!(error=update_primary_key(sub_trans, primary_key_changed,
old_row, &old_prim_key, old_row, &old_prim_key,
...@@ -1223,15 +1200,6 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row) ...@@ -1223,15 +1200,6 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
{ {
if ((error=remove_key(sub_trans, keynr, old_row, &old_prim_key))) if ((error=remove_key(sub_trans, keynr, old_row, &old_prim_key)))
{ {
if (using_ignore && /* purecov: inspected */
(thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
{
int new_error;
DBUG_PRINT("trans",("aborting subtransaction"));
new_error=txn_abort(sub_trans);
if (new_error)
error = new_error;
}
table->insert_or_update= 0; table->insert_or_update= 0;
DBUG_RETURN(error); // Fatal error /* purecov: inspected */ DBUG_RETURN(error); // Fatal error /* purecov: inspected */
} }
...@@ -1254,12 +1222,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row) ...@@ -1254,12 +1222,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
if (using_ignore) if (using_ignore)
{ {
int new_error = 0; int new_error = 0;
if (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS) if (!changed_keys.is_clear_all())
{
DBUG_PRINT("trans",("aborting subtransaction")); /* purecov: deadcode */
new_error=txn_abort(sub_trans); /* purecov: deadcode */
}
else if (!changed_keys.is_clear_all())
new_error=restore_keys(transaction, &changed_keys, primary_key, new_error=restore_keys(transaction, &changed_keys, primary_key,
old_row, &old_prim_key, new_row, &prim_key, old_row, &old_prim_key, new_row, &prim_key,
thd_options); thd_options);
...@@ -1271,11 +1234,6 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row) ...@@ -1271,11 +1234,6 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
} }
} }
} }
else if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
{
DBUG_PRINT("trans",("committing subtransaction")); /* purecov: deadcode */
error=txn_commit(sub_trans, 0); /* purecov: deadcode */
}
if (error != DB_LOCK_DEADLOCK) if (error != DB_LOCK_DEADLOCK)
break; break;
} }
...@@ -1385,33 +1343,10 @@ int ha_berkeley::delete_row(const byte * record) ...@@ -1385,33 +1343,10 @@ int ha_berkeley::delete_row(const byte * record)
DB_TXN *sub_trans = transaction; DB_TXN *sub_trans = transaction;
for (uint retry=0 ; retry < berkeley_trans_retry ; retry++) for (uint retry=0 ; retry < berkeley_trans_retry ; retry++)
{ {
if (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS)
{
if ((error=txn_begin(db_env, transaction, &sub_trans, 0))) /* purecov: deadcode */
break; /* purecov: deadcode */
DBUG_PRINT("trans",("starting sub transaction")); /* purecov: deadcode */
}
error=remove_keys(sub_trans, record, &row, &prim_key, &keys); error=remove_keys(sub_trans, record, &row, &prim_key, &keys);
if (!error && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
{
DBUG_PRINT("trans",("ending sub transaction")); /* purecov: deadcode */
error=txn_commit(sub_trans, 0); /* purecov: deadcode */
}
if (error) if (error)
{ /* purecov: inspected */ { /* purecov: inspected */
DBUG_PRINT("error",("Got error %d",error)); DBUG_PRINT("error",("Got error %d",error));
if (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS)
{
/* retry */
int new_error;
DBUG_PRINT("trans",("aborting subtransaction"));
if ((new_error=txn_abort(sub_trans)))
{
error=new_error; // This shouldn't happen
break;
}
}
else
break; // No retry - return error break; // No retry - return error
} }
if (error != DB_LOCK_DEADLOCK) if (error != DB_LOCK_DEADLOCK)
......
...@@ -218,59 +218,72 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; ...@@ -218,59 +218,72 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define TEST_CORE_ON_SIGNAL 256 /* Give core if signal */ #define TEST_CORE_ON_SIGNAL 256 /* Give core if signal */
#define TEST_NO_STACKTRACE 512 #define TEST_NO_STACKTRACE 512
#define TEST_SIGINT 1024 /* Allow sigint on threads */ #define TEST_SIGINT 1024 /* Allow sigint on threads */
#define TEST_SYNCHRONIZATION 2048 /* get server to do sleep in some #define TEST_SYNCHRONIZATION 2048 /* get server to do sleep in
places */ some places */
#endif #endif
/* /*
This is included in the server and in the client. This is included in the server and in the client.
Options for select set by the yacc parser (stored in lex->options). Options for select set by the yacc parser (stored in lex->options).
None of the 32 defines below should have its value changed, or this will
break replication. XXX:
log_event.h defines OPTIONS_WRITTEN_TO_BIN_LOG to specify what THD
options list are written into binlog. These options can NOT change their
values, or it will break replication between version.
context is encoded as following:
SELECT - SELECT_LEX_NODE::options
THD - THD::options
intern - neither. used only as
func(..., select_node->options | thd->options | OPTION_XXX, ...)
TODO: separate three contexts above, move them to separate bitfields.
*/ */
#define SELECT_DISTINCT (1L << 0) #define SELECT_DISTINCT (1L << 0) // SELECT, user
#define SELECT_STRAIGHT_JOIN (1L << 1) #define SELECT_STRAIGHT_JOIN (1L << 1) // SELECT, user
#define SELECT_DESCRIBE (1L << 2) #define SELECT_DESCRIBE (1L << 2) // SELECT, user
#define SELECT_SMALL_RESULT (1L << 3) #define SELECT_SMALL_RESULT (1L << 3) // SELECT, user
#define SELECT_BIG_RESULT (1L << 4) #define SELECT_BIG_RESULT (1L << 4) // SELECT, user
#define OPTION_FOUND_ROWS (1L << 5) #define OPTION_FOUND_ROWS (1L << 5) // SELECT, user
#define OPTION_TO_QUERY_CACHE (1L << 6) #define OPTION_TO_QUERY_CACHE (1L << 6) // SELECT, user
#define SELECT_NO_JOIN_CACHE (1L << 7) /* Intern */ #define SELECT_NO_JOIN_CACHE (1L << 7) // intern
#define OPTION_BIG_TABLES (1L << 8) /* for SQL OPTION */ #define OPTION_BIG_TABLES (1L << 8) // THD, user
#define OPTION_BIG_SELECTS (1L << 9) /* for SQL OPTION */ #define OPTION_BIG_SELECTS (1L << 9) // THD, user
#define OPTION_LOG_OFF (1L << 10) #define OPTION_LOG_OFF (1L << 10) // THD, user
#define OPTION_UPDATE_LOG (1L << 11) /* update log flag */ #define OPTION_UPDATE_LOG (1L << 11) // THD, user, unused
#define TMP_TABLE_ALL_COLUMNS (1L << 12) #define TMP_TABLE_ALL_COLUMNS (1L << 12) // SELECT, intern
#define OPTION_WARNINGS (1L << 13) #define OPTION_WARNINGS (1L << 13) // THD, user
#define OPTION_AUTO_IS_NULL (1L << 14) #define OPTION_AUTO_IS_NULL (1L << 14) // THD, user, binlog
#define OPTION_FOUND_COMMENT (1L << 15) #define OPTION_FOUND_COMMENT (1L << 15) // SELECT, intern, parser
#define OPTION_SAFE_UPDATES (1L << 16) #define OPTION_SAFE_UPDATES (1L << 16) // THD, user
#define OPTION_BUFFER_RESULT (1L << 17) #define OPTION_BUFFER_RESULT (1L << 17) // SELECT, user
#define OPTION_BIN_LOG (1L << 18) #define OPTION_BIN_LOG (1L << 18) // THD, user
#define OPTION_NOT_AUTOCOMMIT (1L << 19) #define OPTION_NOT_AUTOCOMMIT (1L << 19) // THD, user
#define OPTION_BEGIN (1L << 20) #define OPTION_BEGIN (1L << 20) // THD, intern
#define OPTION_TABLE_LOCK (1L << 21) #define OPTION_TABLE_LOCK (1L << 21) // THD, intern
#define OPTION_QUICK (1L << 22) #define OPTION_QUICK (1L << 22) // SELECT (for DELETE)
#define OPTION_QUOTE_SHOW_CREATE (1L << 23) #define OPTION_QUOTE_SHOW_CREATE (1L << 23) // THD, user
#define OPTION_INTERNAL_SUBTRANSACTIONS (1L << 24)
/* Thr following is used to detect a conflict with DISTINCT
in the user query has requested */
#define SELECT_ALL (1L << 24) // SELECT, user, parser
/* Set if we are updating a non-transaction safe table */ /* Set if we are updating a non-transaction safe table */
#define OPTION_STATUS_NO_TRANS_UPDATE (1L << 25) #define OPTION_STATUS_NO_TRANS_UPDATE (1L << 25) // THD, intern
/* The following can be set when importing tables in a 'wrong order' /* The following can be set when importing tables in a 'wrong order'
to suppress foreign key checks */ to suppress foreign key checks */
#define OPTION_NO_FOREIGN_KEY_CHECKS (1L << 26) #define OPTION_NO_FOREIGN_KEY_CHECKS (1L << 26) // THD, user, binlog
/* The following speeds up inserts to InnoDB tables by suppressing unique /* The following speeds up inserts to InnoDB tables by suppressing unique
key checks in some cases */ key checks in some cases */
#define OPTION_RELAXED_UNIQUE_CHECKS (1L << 27) #define OPTION_RELAXED_UNIQUE_CHECKS (1L << 27) // THD, user, binlog
#define SELECT_NO_UNLOCK (1L << 28) #define SELECT_NO_UNLOCK (1L << 28) // SELECT, intern
#define OPTION_SCHEMA_TABLE (1L << 29) #define OPTION_SCHEMA_TABLE (1L << 29) // SELECT, intern
/* Flag set if setup_tables already done */ /* Flag set if setup_tables already done */
#define OPTION_SETUP_TABLES_DONE (1L << 30) #define OPTION_SETUP_TABLES_DONE (1L << 30) // intern
/* Thr following is used to detect a conflict with DISTINCT /* If not set then the thread will ignore all warnings with level notes. */
in the user query has requested */ #define OPTION_SQL_NOTES (1L << 31) // THD, user
#define SELECT_ALL (ULL(1) << 32)
/* /*
Maximum length of time zone name that we support Maximum length of time zone name that we support
...@@ -281,9 +294,6 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; ...@@ -281,9 +294,6 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
/* The rest of the file is included in the server only */ /* The rest of the file is included in the server only */
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
/* If not set then the thread will ignore all warnings with level notes. */
#define OPTION_SQL_NOTES (1L << 31)
/* Bits for different SQL modes modes (including ANSI mode) */ /* Bits for different SQL modes modes (including ANSI mode) */
#define MODE_REAL_AS_FLOAT 1 #define MODE_REAL_AS_FLOAT 1
#define MODE_PIPES_AS_CONCAT 2 #define MODE_PIPES_AS_CONCAT 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment