Below is the list of changes that have just been committed into a local
5.1 repository of mikron. When mikron does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-03-06 22:53:04+01:00, mikron@stripped +20 -0
Merge 21.37.251.10.in-addr.arpa:/Users/mikron/mysql_clones/latest_wl3695
into 21.37.251.10.in-addr.arpa:/Users/mikron/mysql_clones/bench_9
MERGE: 1.2432.4.2
config/ac-macros/ha_ndbcluster.m4@stripped, 2007-03-06 22:47:35+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.26.2.1
configure.in@stripped, 2007-03-06 22:47:35+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.435.4.1
sql/ha_ndbcluster.cc@stripped, 2007-03-06 22:47:36+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.412.2.2
sql/ha_ndbcluster.h@stripped, 2007-03-06 22:47:36+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.165.6.1
sql/mysql_priv.h@stripped, 2007-03-06 22:47:36+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.479.1.1
sql/mysqld.cc@stripped, 2007-03-06 22:47:36+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.620.3.1
sql/sql_update.cc@stripped, 2007-03-06 22:47:36+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.222.1.1
sql/table.cc@stripped, 2007-03-06 22:47:36+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.272.1.2
sql/table.h@stripped, 2007-03-06 22:47:36+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.160.1.1
storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp@stripped, 2007-03-06 22:53:01+01:00, mikron@stripped +1 -1
Manual merge
MERGE: 1.14.4.1
storage/ndb/include/mgmapi/mgmapi_config_parameters.h@stripped, 2007-03-06 22:53:01+01:00, mikron@stripped +1 -2
Manual merge
MERGE: 1.32.1.2
storage/ndb/src/common/transporter/TransporterRegistry.cpp@stripped, 2007-03-06 22:47:36+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.70.1.1
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp@stripped, 2007-03-06 22:47:36+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.42.3.1
storage/ndb/src/kernel/vm/Configuration.cpp@stripped, 2007-03-06 22:47:37+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.57.1.1
storage/ndb/src/kernel/vm/Configuration.hpp@stripped, 2007-03-06 22:53:01+01:00, mikron@stripped +1 -1
Manual merge
MERGE: 1.23.1.1
storage/ndb/src/kernel/vm/ThreadConfig.cpp@stripped, 2007-03-06 22:53:01+01:00, mikron@stripped +3 -3
Manual merge
MERGE: 1.6.1.1
storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-03-06 22:47:37+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.99.1.3
storage/ndb/src/ndbapi/Ndb.cpp@stripped, 2007-03-06 22:47:37+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.88.1.1
storage/ndb/src/ndbapi/NdbScanOperation.cpp@stripped, 2007-03-06 22:47:37+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.105.1.7
storage/ndb/src/ndbapi/TransporterFacade.cpp@stripped, 2007-03-06 22:47:37+01:00, mikron@stripped +0 -0
Auto merged
MERGE: 1.59.1.1
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mikron
# Host: 21.37.251.10.in-addr.arpa
# Root: /Users/mikron/mysql_clones/bench_9/RESYNC
--- 1.439/configure.in 2007-03-06 22:34:09 +01:00
+++ 1.440/configure.in 2007-03-06 22:47:35 +01:00
@@ -1876,7 +1876,7 @@
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
- chsize cuserid fchmod fcntl \
+ chsize cuserid epoll_create fchmod fcntl \
fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \
--- 1.481/sql/mysql_priv.h 2007-02-14 01:09:33 +01:00
+++ 1.482/sql/mysql_priv.h 2007-03-06 22:47:36 +01:00
@@ -869,6 +869,9 @@
void set_key_field_ptr(KEY *key_info, const byte *new_buf,
const byte *old_buf);
+void include_partition_fields_in_used_fields(Field **ptr,
+ MY_BITMAP *read_set);
+
bool mysql_backup_table(THD* thd, TABLE_LIST* table_list);
bool mysql_restore_table(THD* thd, TABLE_LIST* table_list);
@@ -1391,6 +1394,7 @@
bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables, bool have_lock = FALSE);
void copy_field_from_tmp_record(Field *field,int offset);
+bool check_constant_expressions(List<Item> *values);
bool fill_record(THD *thd, Field **field, List<Item> &values,
bool ignore_errors);
bool fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields,
@@ -1454,7 +1458,7 @@
int find_ref_key(KEY *key, uint key_count, byte *record, Field *field,
uint *key_length);
void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length);
-void key_restore(byte *to_record, byte *from_key, KEY *key_info,
+void key_restore(byte *to_record, const byte *from_key, const KEY *key_info,
uint key_length);
bool key_cmp_if_same(TABLE *form,const byte *key,uint index,uint key_length);
void key_unpack(String *to,TABLE *form,uint index);
--- 1.224/sql/sql_update.cc 2007-02-13 22:15:19 +01:00
+++ 1.225/sql/sql_update.cc 2007-03-06 22:47:36 +01:00
@@ -117,6 +117,7 @@
bool safe_update= test(thd->options & OPTION_SAFE_UPDATES);
bool used_key_is_modified, transactional_table, will_batch;
bool can_compare_record;
+ bool might_use_read_removal= FALSE;
int res;
int error, loc_error;
uint used_index= MAX_KEY, dup_key_found;
@@ -132,6 +133,7 @@
READ_RECORD info;
SELECT_LEX *select_lex= &thd->lex->select_lex;
bool need_reopen;
+ bool direct_update_loop;
ulonglong id;
DBUG_ENTER("mysql_update");
@@ -267,7 +269,7 @@
}
}
init_ftfuncs(thd, select_lex, 1);
-
+ table->file->column_bitmaps_signal(HA_COMPLETE_TABLE_BOTH_BITMAPS);
table->mark_columns_needed_for_update();
/* Check if we are modifying a key that we are used to search with */
@@ -426,7 +428,10 @@
}
if (table->key_read)
table->restore_column_maps_after_mark_index();
+ direct_update_loop= FALSE;
}
+ else
+ direct_update_loop= TRUE;
if (ignore)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
@@ -436,6 +441,22 @@
table->file->try_semi_consistent_read(1);
init_read_record(&info,thd,table,select,0,1);
+ if (!table->triggers &&
+ info.using_quick &&
+ !ignore &&
+ !using_limit &&
+ direct_update_loop)
+ {
+ /*
+ In certain cases the handler can avoid doing a real read before
+ the update. It should still maintain the semantics of the
+ handler interface but can generate reads instead of performing
+ them for real. This extra call tells the handler that this
+ is possible for this handler until next reset of handler.
+ */
+ might_use_read_removal=
+ table->file->read_before_write_removal_possible(&fields, &values);
+ }
updated= found= 0;
thd->count_cuted_fields= CHECK_FIELD_WARN; /* calc cuted fields */
thd->cuted_fields=0L;
@@ -627,6 +648,21 @@
thd->proc_info= "end";
VOID(table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY));
+ if (might_use_read_removal)
+ {
+ /*
+ updated counter is not valid when using read before write removal
+ optimisatisation so we read it from handler in info call.
+ More sophisticated handling of this would be required if it is
+ necessary to also support this optimisation in conjunction with
+ using LIMIT. Now the optimisation is disabled for IGNORE, LIMIT and
+ also when using BEFORE UPDATE triggers on table and also quite
+ hard checks on UPDATE statement. Still it is used very often with
+ all those limitations.
+ */
+ table->file->info(HA_STATUS_WRITTEN_ROWS);
+ updated= table->file->stats.rows_updated;
+ }
/*
Invalidate the table in the query cache if something changed.
This must be before binlog writing and ha_autocommit_...
--- 1.275/sql/table.cc 2007-02-14 01:09:34 +01:00
+++ 1.276/sql/table.cc 2007-03-06 22:47:36 +01:00
@@ -3853,7 +3853,7 @@
{
mark_columns_used_by_index_no_reset(s->primary_key, read_set);
/* signal change */
- file->column_bitmaps_signal();
+ file->column_bitmaps_signal(HA_CHANGE_TABLE_READ_BITMAP);
}
DBUG_VOID_RETURN;
}
@@ -3900,7 +3900,7 @@
key_read= 0;
(void) file->extra(HA_EXTRA_NO_KEYREAD);
default_column_bitmaps();
- file->column_bitmaps_signal();
+ file->column_bitmaps_signal(HA_CHANGE_TABLE_BOTH_BITMAPS);
DBUG_VOID_RETURN;
}
@@ -3939,7 +3939,7 @@
bitmap_set_bit(write_set, found_next_number_field->field_index);
if (s->next_number_key_offset)
mark_columns_used_by_index_no_reset(s->next_number_index, read_set);
- file->column_bitmaps_signal();
+ file->column_bitmaps_signal(HA_CHANGE_TABLE_BOTH_BITMAPS);
}
@@ -3973,7 +3973,7 @@
if ((*reg_field)->flags & PART_KEY_FLAG)
bitmap_set_bit(read_set, (*reg_field)->field_index);
}
- file->column_bitmaps_signal();
+ file->column_bitmaps_signal(HA_CHANGE_TABLE_READ_BITMAP);
}
if (file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_DELETE)
{
@@ -3987,7 +3987,7 @@
else
{
mark_columns_used_by_index_no_reset(s->primary_key, read_set);
- file->column_bitmaps_signal();
+ file->column_bitmaps_signal(HA_CHANGE_TABLE_READ_BITMAP);
}
}
}
@@ -4026,7 +4026,7 @@
if (merge_keys.is_overlapping((*reg_field)->part_of_key))
bitmap_set_bit(read_set, (*reg_field)->field_index);
}
- file->column_bitmaps_signal();
+ file->column_bitmaps_signal(HA_CHANGE_TABLE_READ_BITMAP);
}
if (file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_DELETE)
{
@@ -4040,7 +4040,7 @@
else
{
mark_columns_used_by_index_no_reset(s->primary_key, read_set);
- file->column_bitmaps_signal();
+ file->column_bitmaps_signal(HA_CHANGE_TABLE_READ_BITMAP);
}
}
DBUG_VOID_RETURN;
--- 1.161/sql/table.h 2007-02-13 09:30:02 +01:00
+++ 1.162/sql/table.h 2007-03-06 22:47:36 +01:00
@@ -451,7 +451,7 @@
read_set= read_set_arg;
write_set= write_set_arg;
if (file)
- file->column_bitmaps_signal();
+ file->column_bitmaps_signal(HA_CHANGE_TABLE_BOTH_BITMAPS);
}
inline void column_bitmaps_set_no_signal(MY_BITMAP *read_set_arg,
MY_BITMAP *write_set_arg)
--- 1.33/storage/ndb/include/mgmapi/mgmapi_config_parameters.h 2007-02-20 17:57:50 +01:00
+++ 1.34/storage/ndb/include/mgmapi/mgmapi_config_parameters.h 2007-03-06 22:53:01 +01:00
@@ -113,6 +113,11 @@
#define CFG_DB_MEMREPORT_FREQUENCY 166
+#define CFG_DB_SCHED_EXEC_TIME 176
+#define CFG_DB_SCHED_SPIN_TIME 177
+#define CFG_DB_REALTIME_SCHEDULER 170
+#define CFG_DB_EXECUTE_LOCK_CPU 171
+#define CFG_DB_MAINT_LOCK_CPU 172
#define CFG_POLL_SOCKETS 180
#define CFG_DB_SGA 198 /* super pool mem */
--- 1.20/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp 2007-03-06 22:32:23 +01:00
+++ 1.21/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp 2007-03-06 22:53:01 +01:00
@@ -77,6 +77,7 @@
CmvmiExecuteLockCPU = 504,
CmvmiMaintLockCPU = 505,
CmvmiSchedulerSpinTimer = 506,
+ CmvmiPollSocketsInEpoll = 507,
// 1222-1225 DICT
LqhDumpAllDefinedTabs = 1332,
LqhDumpNoLogPages = 1333,
--- 1.101/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2007-02-21 09:05:35 +01:00
+++ 1.102/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2007-03-06 22:47:37 +01:00
@@ -561,6 +561,42 @@
STR_VALUE(MAX_INT_RNIL) },
{
+ CFG_DB_EXECUTE_LOCK_CPU,
+ "LockExecuteThreadToCPU",
+ DB_TOKEN,
+ "CPU ID indicating which CPU will run the execution thread",
+ ConfigInfo::CI_USED,
+ true,
+ ConfigInfo::CI_INT,
+ "65535",
+ "0",
+ "65535" },
+
+ {
+ CFG_DB_MAINT_LOCK_CPU,
+ "LockMaintThreadsToCPU",
+ DB_TOKEN,
+ "CPU ID indicating which CPU will run the maintenance threads",
+ ConfigInfo::CI_USED,
+ true,
+ ConfigInfo::CI_INT,
+ "65535",
+ "0",
+ "65535" },
+
+ {
+ CFG_DB_REALTIME_SCHEDULER,
+ "RealtimeScheduler",
+ DB_TOKEN,
+ "If yes, then NDB Cluster threads will be scheduled as real-time threads",
+ ConfigInfo::CI_USED,
+ true,
+ ConfigInfo::CI_BOOL,
+ "false",
+ "false",
+ "true" },
+
+ {
CFG_DB_MEMLOCK,
"LockPagesInMainMemory",
DB_TOKEN,
@@ -585,6 +621,30 @@
STR_VALUE(MAX_INT_RNIL) },
{
+ CFG_DB_SCHED_EXEC_TIME,
+ "SchedulerExecutionTimer",
+ DB_TOKEN,
+ "Number of microseconds to execute in scheduler before sending",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "50",
+ "0",
+ "11000" },
+
+ {
+ CFG_DB_SCHED_SPIN_TIME,
+ "SchedulerSpinTimer",
+ DB_TOKEN,
+ "Number of microseconds to execute in scheduler before sleeping",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "0",
+ "0",
+ "11000" },
+
+ {
CFG_DB_STOP_ON_ERROR,
"StopOnError",
DB_TOKEN,
@@ -1744,7 +1804,7 @@
false,
ConfigInfo::CI_INT,
MANDATORY,
- "1", "63" },
+ "1", MAX_NODES_STRING },
{
CFG_CONNECTION_SEND_SIGNAL_ID,
@@ -1981,7 +2041,7 @@
false,
ConfigInfo::CI_INT,
MANDATORY,
- "1", "63" },
+ "1", MAX_NODES_STRING },
{
CFG_CONNECTION_SEND_SIGNAL_ID,
@@ -2113,7 +2173,7 @@
false,
ConfigInfo::CI_INT,
MANDATORY,
- "1", "63" },
+ "1", MAX_NODES_STRING },
{
CFG_CONNECTION_HOSTNAME_1,
--- 1.79/storage/ndb/src/common/transporter/TransporterRegistry.cpp 2007-02-21 09:38:25 +01:00
+++ 1.80/storage/ndb/src/common/transporter/TransporterRegistry.cpp 2007-03-06 22:47:36 +01:00
@@ -1563,12 +1563,22 @@
bool
TransporterRegistry::start_clients()
{
+ char thread_object[128];
+ uint len;
+
m_run_start_clients_thread= true;
- m_start_clients_thread= NdbThread_Create(run_start_clients_C,
+ fill_thread_object((void*)thread_object, &len, FALSE);
+ m_start_clients_thread= NdbThread_CreateWithFunc(run_start_clients_C,
(void**)this,
32768,
"ndb_start_clients",
- NDB_THREAD_PRIO_LOW);
+ NDB_THREAD_PRIO_LOW,
+ add_thread_id,
+ thread_object,
+ len,
+ remove_thread_id,
+ thread_object,
+ len);
if (m_start_clients_thread == 0) {
m_run_start_clients_thread= false;
return false;
--- 1.45/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp 2007-03-06 18:54:03 +01:00
+++ 1.46/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp 2007-03-06 22:47:36 +01:00
@@ -1231,6 +1231,11 @@
}
}
+ if (arg == DumpStateOrd::CmvmiPollSocketsInEpoll)
+ {
+ Uint32 poll_sockets = signal->theData[1];
+ globalEmulatorData.theConfiguration->pollSocketsInEpoll(poll_sockets);
+ }
if (arg == DumpStateOrd::CmvmiTestLongSigWithDelay) {
unsigned i;
Uint32 loopCount = dumpState->args[1];
--- 1.58/storage/ndb/src/kernel/vm/Configuration.cpp 2007-02-20 17:57:50 +01:00
+++ 1.59/storage/ndb/src/kernel/vm/Configuration.cpp 2007-03-06 22:47:37 +01:00
@@ -37,6 +37,7 @@
#include "pc.hpp"
#include <LogLevel.hpp>
#include <NdbSleep.h>
+#include <NdbThread.h>
extern "C" {
void ndbSetOwnVersion();
@@ -203,7 +204,14 @@
_initialStart = true;
g_start_type |= (1 << NodeState::ST_INITIAL_START);
}
-
+
+ threadIdMutex = NdbMutex_Create();
+ if (!threadIdMutex)
+ {
+ ndbout_c("Failed to create threadIdMutex");
+ exit(-1);
+ }
+ initThreadArray();
return true;
}
@@ -448,6 +456,31 @@
"TimeBetweenWatchDogCheck missing");
}
+ if(iter.get(CFG_DB_SCHED_EXEC_TIME, &_schedulerExecutionTimer)){
+ ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
+ "SchedulerExecutionTimer missing");
+ }
+
+ if(iter.get(CFG_DB_SCHED_SPIN_TIME, &_schedulerSpinTimer)){
+ ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
+ "SchedulerSpinTimer missing");
+ }
+
+ if(iter.get(CFG_DB_REALTIME_SCHEDULER, &_realtimeScheduler)){
+ ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
+ "RealtimeScheduler missing");
+ }
+
+ if(iter.get(CFG_DB_EXECUTE_LOCK_CPU, &_executeLockCPU)){
+ ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
+ "LockExecuteThreadToCPU missing");
+ }
+
+ if(iter.get(CFG_DB_MAINT_LOCK_CPU, &_maintLockCPU)){
+ ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
+ "LockMaintThreadsToCPU missing");
+ }
+
/**
* Get paths
*/
@@ -504,6 +537,74 @@
}
int
+Configuration::schedulerExecutionTimer() const {
+ return _schedulerExecutionTimer;
+}
+
+void
+Configuration::schedulerExecutionTimer(int value) {
+ if (value < 11000)
+ _schedulerExecutionTimer = value;
+}
+
+int
+Configuration::schedulerSpinTimer() const {
+ return _schedulerSpinTimer;
+}
+
+void
+Configuration::schedulerSpinTimer(int value) {
+ if (value < 500)
+ value = 500;
+ _schedulerSpinTimer = value;
+}
+
+bool
+Configuration::realtimeScheduler() const
+{
+ return (bool)_realtimeScheduler;
+}
+
+void
+Configuration::realtimeScheduler(bool realtime_on)
+{
+ bool old_value = (bool)_realtimeScheduler;
+ _realtimeScheduler = (Uint32)realtime_on;
+ if (old_value != realtime_on)
+ setAllRealtimeScheduler();
+}
+
+Uint32
+Configuration::executeLockCPU() const
+{
+ return _executeLockCPU;
+}
+
+void
+Configuration::executeLockCPU(Uint32 value)
+{
+ Uint32 old_value = _executeLockCPU;
+ _executeLockCPU = value;
+ if (value != old_value)
+ setAllLockCPU(TRUE);
+}
+
+Uint32
+Configuration::maintLockCPU() const
+{
+ return _maintLockCPU;
+}
+
+void
+Configuration::maintLockCPU(Uint32 value)
+{
+ Uint32 old_value = _maintLockCPU;
+ _maintLockCPU = value;
+ if (value != old_value)
+ setAllLockCPU(FALSE);
+}
+
+int
Configuration::timeBetweenWatchDogCheck() const {
return _timeBetweenWatchDogCheck;
}
@@ -911,3 +1012,186 @@
Configuration::setInitialStart(bool val){
_initialStart = val;
}
+
+void
+Configuration::setAllRealtimeScheduler()
+{
+ Uint32 i;
+ for (i = 0; i < threadInfo.size(); i++)
+ {
+ if (threadInfo[i].type != NotInUse)
+ {
+ if (setRealtimeScheduler(threadInfo[i].threadHandle,
+ threadInfo[i].type,
+ FALSE))
+ return;
+ }
+ }
+}
+
+void
+Configuration::setAllLockCPU(bool exec_thread)
+{
+ Uint32 i;
+ for (i = 0; i < threadInfo.size(); i++)
+ {
+ if (threadInfo[i].type != NotInUse)
+ {
+ if (setLockCPU(threadInfo[i].threadId,
+ threadInfo[i].type,
+ exec_thread,
+ FALSE))
+ return;
+ }
+ }
+}
+
+int
+Configuration::setRealtimeScheduler(NDB_THAND_TYPE threadHandle,
+ enum ThreadTypes type,
+ bool init)
+{
+ /*
+ We ignore thread characteristics on platforms where we cannot
+ determine the thread id.
+ */
+ if (!threadHandle)
+ return 0;
+ if (!init || _realtimeScheduler)
+ {
+ int error_no;
+ ndbout << "Set scheduler " << _realtimeScheduler;
+ ndbout << " threadHandle = " << (int)threadHandle << endl;
+ if ((error_no = Ndb_SetScheduler(threadHandle, _realtimeScheduler,
+ (type != MainThread))))
+ {
+ ndbout << "Set scheduler failed with error_no = " << error_no << endl;
+ ;//Warning, no permission to set scheduler
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int
+Configuration::setLockCPU(NDB_TID_TYPE threadId,
+ enum ThreadTypes type,
+ bool exec_thread,
+ bool init)
+{
+ Uint32 cpu_id;
+ /*
+ We ignore thread characteristics on platforms where we cannot
+ determine the thread id.
+ We only set new lock CPU characteristics for the threads for which
+ it has changed
+ */
+ if (!threadId)
+ return 0;
+ if ((exec_thread && type != MainThread) ||
+ (!exec_thread && type == MainThread))
+ return 0;
+ if (type == MainThread)
+ cpu_id = _executeLockCPU;
+ else
+ cpu_id = _maintLockCPU;
+ if (!init ||
+ cpu_id != NO_LOCK_CPU)
+ {
+ int error_no;
+ ndbout << "Lock threadId = " << threadId;
+ ndbout << " to CPU id = " << cpu_id << endl;
+ if ((error_no = Ndb_LockCPU(threadId, cpu_id)))
+ {
+ ndbout << "Failed to lock CPU, error_no = " << error_no << endl;
+ ;//Warning, no permission to lock thread to CPU
+ return 1;
+ }
+ }
+ return 0;
+}
+
+void fill_thread_object(void *param, uint *len, bool server)
+{
+ struct ThreadContainer container;
+
+ memset((char*)&container, sizeof(container), 0);
+ container.conf = globalEmulatorData.theConfiguration;
+ container.type = server ? SocketServerThread : SocketClientThread;
+ memcpy((char*)param, (char*)&container, sizeof(container));
+ *len = sizeof(container);
+}
+
+void*
+add_thread_id(void *param)
+{
+ struct ThreadContainer container;
+
+ memcpy((char*)&container, param, sizeof(struct ThreadContainer));
+ container.index = container.conf->addThreadId(container.type);
+ memcpy(param, (char*)&container, sizeof(struct ThreadContainer));
+ return NULL;
+}
+
+void*
+remove_thread_id(void *param)
+{
+ struct ThreadContainer container;
+
+ memcpy((char*)&container, param, sizeof(struct ThreadContainer));
+ container.conf->removeThreadId(container.index);
+ return NULL;
+}
+
+Uint32 Configuration::addThreadId(enum ThreadTypes type)
+{
+ NDB_TID_TYPE threadId;
+ NDB_THAND_TYPE threadHandle;
+ Uint32 i, cpu_id;
+ NdbMutex_Lock(threadIdMutex);
+ for (i = 0; i < threadInfo.size(); i++)
+ {
+ if (threadInfo[i].type == NotInUse)
+ break;
+ }
+ if (i == threadInfo.size())
+ {
+ struct ThreadInfo tmp;
+ threadInfo.push_back(tmp);
+ }
+ threadHandle = Ndb_getThreadHandle();
+ threadInfo[i].threadHandle = threadHandle;
+ threadId = Ndb_getThreadId();
+ threadInfo[i].threadId = threadId;
+ threadInfo[i].type = type;
+ NdbMutex_Unlock(threadIdMutex);
+ setRealtimeScheduler(threadHandle, type, TRUE);
+ setLockCPU(threadId, type, (type == MainThread), TRUE);
+ return i;
+}
+
+void
+Configuration::removeThreadId(Uint32 index)
+{
+ NdbMutex_Lock(threadIdMutex);
+ threadInfo[index].threadId = 0;
+ threadInfo[index].threadHandle = 0;
+ threadInfo[index].type = NotInUse;
+ NdbMutex_Unlock(threadIdMutex);
+}
+
+void
+Configuration::initThreadArray()
+{
+ NdbMutex_Lock(threadIdMutex);
+ for (Uint32 i = 0; i < threadInfo.size(); i++)
+ {
+ threadInfo[i].threadId = 0;
+ threadInfo[i].threadHandle = 0;
+ threadInfo[i].type = NotInUse;
+ }
+ NdbMutex_Unlock(threadIdMutex);
+}
+
+template class Vector<struct ThreadInfo>;
+
--- 1.25/storage/ndb/src/kernel/vm/Configuration.hpp 2007-02-21 09:05:35 +01:00
+++ 1.26/storage/ndb/src/kernel/vm/Configuration.hpp 2007-03-06 22:53:01 +01:00
@@ -19,6 +19,37 @@
#include <util/BaseString.hpp>
#include <mgmapi.h>
#include <ndb_types.h>
+#include <NdbMutex.h>
+#include <NdbThread.h>
+
+enum ThreadTypes
+{
+ WatchDogThread = 1,
+ SocketServerThread = 2,
+ SocketClientThread = 3,
+ NdbfsThread = 3,
+ MainThread = 4,
+ NotInUse = 5
+};
+
+#define MAX_NDB_THREADS 256
+#define NO_LOCK_CPU 65535
+
+struct ThreadInfo
+{
+ NDB_TID_TYPE threadId;
+ NDB_THAND_TYPE threadHandle;
+ enum ThreadTypes type;
+};
+
+class Configuration;
+
+struct ThreadContainer
+{
+ Configuration *conf;
+ enum ThreadTypes type;
+ Uint32 index;
+};
class ConfigRetriever;
@@ -37,7 +68,35 @@
void closeConfiguration(bool end_session= true);
Uint32 lockPagesInMainMemory() const;
-
+
+ int schedulerExecutionTimer() const;
+ void schedulerExecutionTimer(int value);
+
+ int schedulerSpinTimer() const;
+ void schedulerSpinTimer(int value);
+
+ bool realtimeScheduler() const;
+ void realtimeScheduler(bool realtime_on);
+
+ Uint32 executeLockCPU() const;
+ void executeLockCPU(Uint32 value);
+
+ Uint32 maintLockCPU() const;
+ void maintLockCPU(Uint32 value);
+
+ void setAllRealtimeScheduler();
+ void setAllLockCPU(bool exec_thread);
+ int setLockCPU(NDB_TID_TYPE threadId,
+ enum ThreadTypes type,
+ bool exec_thread,
+ bool init);
+ int setRealtimeScheduler(NDB_THAND_TYPE threadHandle,
+ enum ThreadTypes type,
+ bool init);
+ Uint32 addThreadId(enum ThreadTypes type);
+ void removeThreadId(Uint32 index);
+ void initThreadArray();
+
int timeBetweenWatchDogCheck() const ;
void timeBetweenWatchDogCheck(int value);
@@ -87,7 +146,15 @@
Uint32 _maxErrorLogs;
Uint32 _lockPagesInMainMemory;
Uint32 _timeBetweenWatchDogCheck;
+ Uint32 _schedulerExecutionTimer;
+ Uint32 _schedulerSpinTimer;
+ Uint32 _realtimeScheduler;
+ Uint32 _executeLockCPU;
+ Uint32 _maintLockCPU;
Uint32 _pollSocketsInEpoll;
+
+ Vector<struct ThreadInfo> threadInfo;
+ NdbMutex *threadIdMutex;
ndb_mgm_configuration * m_ownConfig;
ndb_mgm_configuration * m_clusterConfig;
--- 1.8/storage/ndb/src/kernel/vm/ThreadConfig.cpp 2007-03-06 20:20:22 +01:00
+++ 1.9/storage/ndb/src/kernel/vm/ThreadConfig.cpp 2007-03-06 22:53:01 +01:00
@@ -141,6 +141,9 @@
globalEmulatorData.theConfiguration->schedulerExecutionTimer();
min_spin_time =
globalEmulatorData.theConfiguration->schedulerSpinTimer();
+ Uint32 poll_sockets =
+ globalEmulatorData.theConfiguration->pollSocketsInEpoll();
+ globalTransporterRegistry.set_poll_sockets_in_epoll(poll_sockets);
globalTransporterRegistry.update_connections();
globalData.incrementWatchDogCounter(5);
i = 0;
--- 1.60/storage/ndb/src/ndbapi/TransporterFacade.cpp 2007-02-21 09:38:25 +01:00
+++ 1.61/storage/ndb/src/ndbapi/TransporterFacade.cpp 2007-03-06 22:47:37 +01:00
@@ -60,6 +60,21 @@
* Call back functions
*****************************************************************************/
+void* add_thread_id(void *param)
+{
+ return NULL;
+}
+
+void *remove_thread_id(void *param)
+{
+ return NULL;
+}
+
+void fill_thread_object(void *param, uint *len, bool server)
+{
+ *len = 0;
+}
+
void
reportError(void * callbackObj, NodeId nodeId,
TransporterError errorCode, const char *info)
| Thread |
|---|
| • bk commit into 5.1 tree (mikron:1.2443) | mikael | 6 Mar |