Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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, 2006-09-07 11:37:27+02:00, jonas@stripped +3 -0
Merge perch.ndb.mysql.com:/home/jonas/src/drop5p14b
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-wl2325-5.0
MERGE: 1.2024.1.1
configure.in@stripped, 2006-09-07 11:37:26+02:00, jonas@stripped +0 -2
merge in slave opt. into drop 15
MERGE: 1.311.1.1
sql/ha_ndbcluster.cc@stripped, 2006-09-07 11:36:31+02:00, jonas@stripped +0 -0
Auto merged
MERGE: 1.245.1.1
sql/mysqld.cc@stripped, 2006-09-07 11:36:31+02:00, jonas@stripped +0 -0
Auto merged
MERGE: 1.488.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: jonas
# Host: perch.ndb.mysql.com
# Root: /home/jonas/src/mysql-5.1-wl2325-5.0/RESYNC
--- 1.489/sql/mysqld.cc 2006-09-07 11:37:31 +02:00
+++ 1.490/sql/mysqld.cc 2006-09-07 11:37:31 +02:00
@@ -355,6 +355,7 @@
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0;
my_bool opt_innodb;
+my_bool opt_slave_batch= 0;
#ifdef HAVE_NDBCLUSTER_DB
const char *opt_ndbcluster_connectstring= 0;
const char *opt_ndb_connectstring= 0;
@@ -4441,7 +4442,7 @@
OPT_SLAVE_LOAD_TMPDIR, OPT_NO_MIX_TYPE,
OPT_RPL_RECOVERY_RANK,OPT_INIT_RPL_ROLE,
OPT_RELAY_LOG, OPT_RELAY_LOG_INDEX, OPT_RELAY_LOG_INFO_FILE,
- OPT_SLAVE_SKIP_ERRORS, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE,
+ OPT_SLAVE_SKIP_ERRORS, OPT_SLAVE_BATCH, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE,
OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA,
OPT_SSL_CAPATH, OPT_SSL_CIPHER,
OPT_BACK_LOG, OPT_BINLOG_CACHE_SIZE,
@@ -5841,6 +5842,11 @@
"before giving up and stopping.",
(gptr*) &slave_trans_retries, (gptr*) &slave_trans_retries, 0,
GET_ULONG, REQUIRED_ARG, 10L, 0L, (longlong) ULONG_MAX, 0, 1, 0},
+ {"slave_allow_batching", OPT_SLAVE_BATCH,
+ "Allow slave to batch requests..",
+ (gptr*) &opt_slave_batch,
+ (gptr*) &opt_slave_batch,
+ 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
#endif /* HAVE_REPLICATION */
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
--- 1.248/sql/ha_ndbcluster.cc 2006-09-07 11:37:31 +02:00
+++ 1.249/sql/ha_ndbcluster.cc 2006-09-07 11:37:31 +02:00
@@ -85,6 +85,7 @@
#define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0
#define NDB_AUTO_INCREMENT_RETRIES 10
+#define BATCH_FLUSH_SIZE (32768)
#define ERR_PRINT(err) \
DBUG_PRINT("error", ("%d message: %s", err.code, err.message))
@@ -421,6 +422,7 @@
all= NULL;
stmt= NULL;
error= 0;
+ m_unsent_bytes= 0;
}
Thd_ndb::~Thd_ndb()
@@ -1118,6 +1120,10 @@
m_table_version= tab->getObjectVersion();
m_table= (void *)tab;
m_table_info= NULL; // Set in external lock
+ /*
+ Approx. write size in bytes over transporter
+ */
+ m_bytes_per_write= 12 + tab->getRowSizeInBytes() + 4 * tab->getNoOfColumns();
DBUG_RETURN(build_index_list(ndb, table, ILBP_OPEN));
}
@@ -2120,6 +2126,8 @@
NdbOperation *op;
int res;
THD *thd= current_thd;
+ Thd_ndb *thd_ndb= get_thd_ndb(thd);
+ uint unsent= thd_ndb->m_unsent_bytes;
m_write_op= TRUE;
DBUG_ENTER("write_row");
@@ -2218,20 +2226,22 @@
to NoCommit the transaction between each row.
Find out how this is detected!
*/
+ unsent+= m_bytes_per_write;
+ thd_ndb->m_unsent_bytes= unsent;
+
m_rows_inserted++;
no_uncommitted_rows_update(1);
- m_bulk_insert_not_flushed= TRUE;
- if ((m_rows_to_insert == (ha_rows) 1) ||
- ((m_rows_inserted % m_bulk_insert_rows) == 0) ||
+ if ((thd->options & OPTION_SLAVE_BATCH) == 0 ||
+ (unsent > BATCH_FLUSH_SIZE) ||
m_primary_key_update ||
set_blob_value)
{
// Send rows to NDB
DBUG_PRINT("info", ("Sending inserts to NDB, "\
- "rows_inserted:%d, bulk_insert_rows: %d",
- (int)m_rows_inserted, (int)m_bulk_insert_rows));
-
- m_bulk_insert_not_flushed= FALSE;
+ "rows_inserted:%d, unsent bytes: %d",
+ (int)m_rows_inserted, (int)unsent));
+
+ thd_ndb->m_unsent_bytes= 0;
if (m_transaction_on)
{
if (execute_no_commit(this,trans) != 0)
@@ -2465,10 +2475,12 @@
int ha_ndbcluster::delete_row(const byte *record)
{
THD *thd= current_thd;
+ Thd_ndb *thd_ndb= get_thd_ndb(thd);
NdbTransaction *trans= m_active_trans;
NdbScanOperation* cursor= m_active_cursor;
NdbOperation *op;
uint32 part_id;
+ uint unsent= thd_ndb->m_unsent_bytes;
int error;
DBUG_ENTER("delete_row");
m_write_op= TRUE;
@@ -2537,11 +2549,22 @@
}
}
- // Execute delete operation
- if (execute_no_commit(this,trans) != 0) {
- no_uncommitted_rows_execute_failure();
- DBUG_RETURN(ndb_err(trans));
+ /*
+ Poor approx. let delete ~ tabsize / 4
+ */
+ unsent += 12 + m_bytes_per_write >> 2;
+ if ((thd->options & OPTION_SLAVE_BATCH) == 0 ||
+ (unsent > BATCH_FLUSH_SIZE))
+ {
+ thd_ndb->m_unsent_bytes = 0;
+ // Execute delete operation
+ if (execute_no_commit(this,trans) != 0) {
+ no_uncommitted_rows_execute_failure();
+ DBUG_RETURN(ndb_err(trans));
+ }
+ DBUG_RETURN(0);
}
+ thd_ndb->m_unsent_bytes = unsent;
DBUG_RETURN(0);
}
@@ -3239,20 +3262,6 @@
else
m_rows_to_insert= rows;
- /*
- Calculate how many rows that should be inserted
- per roundtrip to NDB. This is done in order to minimize the
- number of roundtrips as much as possible. However performance will
- degrade if too many bytes are inserted, thus it's limited by this
- calculation.
- */
- const int bytesperbatch= 8192;
- bytes= 12 + tab->getRowSizeInBytes() + 4 * tab->getNoOfColumns();
- batch= bytesperbatch/bytes;
- batch= batch == 0 ? 1 : batch;
- DBUG_PRINT("info", ("batch: %d, bytes: %d", batch, bytes));
- m_bulk_insert_rows= batch;
-
DBUG_VOID_RETURN;
}
@@ -3265,14 +3274,18 @@
DBUG_ENTER("end_bulk_insert");
// Check if last inserts need to be flushed
- if (m_bulk_insert_not_flushed)
+
+ THD *thd= current_thd;
+ Thd_ndb *thd_ndb= get_thd_ndb(thd);
+
+ if ((thd->options & OPTION_SLAVE_BATCH) == 0 && thd_ndb->m_unsent_bytes)
{
NdbTransaction *trans= m_active_trans;
// Send rows to NDB
DBUG_PRINT("info", ("Sending inserts to NDB, "\
- "rows_inserted:%d, bulk_insert_rows: %d",
- (int) m_rows_inserted, (int) m_bulk_insert_rows));
- m_bulk_insert_not_flushed= FALSE;
+ "rows_inserted:%d, unsent bytes: %d",
+ (int) m_rows_inserted, (int)thd_ndb->m_unsent_bytes));
+ thd_ndb->m_unsent_bytes= 0;
if (execute_no_commit(this,trans) != 0) {
no_uncommitted_rows_execute_failure();
my_errno= error= ndb_err(trans);
@@ -4619,9 +4632,7 @@
m_ignore_no_key(FALSE),
m_rows_to_insert((ha_rows) 1),
m_rows_inserted((ha_rows) 0),
- m_bulk_insert_rows((ha_rows) 1024),
m_rows_changed((ha_rows) 0),
- m_bulk_insert_not_flushed(FALSE),
m_ops_pending(0),
m_skip_auto_increment(TRUE),
m_blobs_pending(0),
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2045) | jonas | 7 Sep |