Commit 33bbac31 authored by gni/root@dev3-127.(none)'s avatar gni/root@dev3-127.(none)

Merge gni@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb

into  dev3-127.(none):/mnt/mysql/home/ngb/mysql-5.0-ndb-bj
parents 4dd03db7 052264b3
......@@ -483,13 +483,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
if (!got_error)
{
mi_set_key_active(share->state.key_map, sinfo->key);
if (param->testflag & T_STATISTICS)
update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique,
param->stats_method == MI_STATS_METHOD_IGNORE_NULLS?
sinfo->notnull: NULL,
(ulonglong) info->state->records);
if (!sinfo->buffpek.elements)
{
if (param->testflag & T_VERBOSE)
......@@ -501,6 +494,11 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
flush_ft_buf(sinfo) || flush_pending_blocks(sinfo))
got_error=1;
}
if (!got_error && param->testflag & T_STATISTICS)
update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique,
param->stats_method == MI_STATS_METHOD_IGNORE_NULLS?
sinfo->notnull: NULL,
(ulonglong) info->state->records);
}
my_free((gptr) sinfo->sort_keys,MYF(0));
my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff),
......
......@@ -2876,7 +2876,7 @@ drop view v1;
drop table t1;
drop database mysqldump_dbb;
use test;
create user mysqltest_1;
create user mysqltest_1@localhost;
create table t1(a int, b varchar(34));
reset master;
mysqldump: Couldn't execute 'FLUSH TABLES': Access denied; you need the RELOAD privilege for this operation (1227)
......@@ -2891,4 +2891,4 @@ CREATE TABLE `t1` (
`b` varchar(34) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
drop table t1;
drop user mysqltest_1;
drop user mysqltest_1@localhost;
......@@ -41,3 +41,14 @@ Table Op Msg_type Msg_text
test.t1 repair warning Number of rows changed from 0 to 1
test.t1 repair status OK
drop table t1;
CREATE TABLE t1(a INT, KEY(a));
INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
SET myisam_repair_threads=2;
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A 5 NULL NULL YES BTREE
SET myisam_repair_threads=@@global.myisam_repair_threads;
DROP TABLE t1;
......@@ -1273,7 +1273,7 @@ drop database mysqldump_dbb;
use test;
# Create user without sufficient privs to perform the requested operation
create user mysqltest_1;
create user mysqltest_1@localhost;
create table t1(a int, b varchar(34));
# To get consistent output, reset the master, starts over from first log
......@@ -1308,4 +1308,4 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
# Clean up
drop table t1;
drop user mysqltest_1;
drop user mysqltest_1@localhost;
......@@ -34,4 +34,15 @@ repair table t1;
repair table t1 use_frm;
drop table t1;
#
# BUG#18874 - Setting myisam_repair_threads > 1, index cardinality always 1
#
CREATE TABLE t1(a INT, KEY(a));
INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
SET myisam_repair_threads=2;
REPAIR TABLE t1;
SHOW INDEX FROM t1;
SET myisam_repair_threads=@@global.myisam_repair_threads;
DROP TABLE t1;
# End of 4.1 tests
......@@ -274,8 +274,18 @@ Backup::execCONTINUEB(Signal* signal)
BackupRecordPtr ptr;
c_backupPool.getPtr(ptr, ptr_I);
if (tabPtr_I == RNIL)
{
closeFiles(signal, ptr);
return;
}
jam();
TablePtr tabPtr;
ptr.p->tables.getPtr(tabPtr, tabPtr_I);
jam();
if(tabPtr.p->fragments.getSize())
{
FragmentPtr fragPtr;
tabPtr.p->fragments.getPtr(fragPtr, fragPtr_I);
......@@ -304,6 +314,8 @@ Backup::execCONTINUEB(Signal* signal)
filePtr.p->operation.dataBuffer.updateWritePtr(sz);
fragPtr_I++;
}
if (fragPtr_I == tabPtr.p->fragments.getSize())
{
signal->theData[0] = tabPtr.p->tableId;
......@@ -4243,6 +4255,12 @@ Backup::execSTOP_BACKUP_REQ(Signal* signal)
TablePtr tabPtr;
ptr.p->tables.first(tabPtr);
if (tabPtr.i == RNIL)
{
closeFiles(signal, ptr);
return;
}
signal->theData[0] = BackupContinueB::BACKUP_FRAGMENT_INFO;
signal->theData[1] = ptr.i;
signal->theData[2] = tabPtr.i;
......
......@@ -6412,6 +6412,11 @@ void Field_varstring::sql_type(String &res) const
}
uint Field_varstring::data_length(const char *from)
{
return length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
}
/*
Functions to create a packed row.
Here the number of length bytes are depending on the given max_length
......
......@@ -144,6 +144,11 @@ public:
table, which is located on disk).
*/
virtual uint32 pack_length_in_rec() const { return pack_length(); }
/*
data_length() return the "real size" of the data in memory.
*/
virtual uint32 data_length(const char *from) { return pack_length(); }
virtual uint32 sort_length() const { return pack_length(); }
virtual void reset(void) { bzero(ptr,pack_length()); }
virtual void reset_fields() {}
......@@ -1102,6 +1107,7 @@ public:
int key_cmp(const byte *str, uint length);
uint packed_col_length(const char *to, uint length);
uint max_packed_col_length(uint max_length);
uint data_length(const char *from);
uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; }
bool has_charset(void) const
......
......@@ -710,6 +710,28 @@ int ha_archive::write_row(byte *buf)
if (init_archive_writer())
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
/*
Varchar structures are constant in size but are not cleaned up request
to request. The following sets all unused space to null to improve
compression.
*/
for (Field **field=table->field ; *field ; field++)
{
DBUG_PRINT("archive",("Pack is %d\n", (*field)->pack_length()));
DBUG_PRINT("archive",("MyPack is %d\n", (*field)->data_length((char*) buf + (*field)->offset())));
if ((*field)->real_type() == MYSQL_TYPE_VARCHAR)
{
uint actual_length= (*field)->data_length((char*) buf + (*field)->offset());
uint offset= (*field)->offset() + actual_length +
(actual_length > 255 ? 2 : 1);
DBUG_PRINT("archive",("Offset is %d -> %d\n", actual_length, offset));
/*
if ((*field)->pack_length() + (*field)->offset() != offset)
bzero(buf + offset, (size_t)((*field)->pack_length() + (actual_length > 255 ? 2 : 1) - (*field)->data_length));
*/
}
}
share->rows_recorded++;
rc= real_write_row(buf, share->archive_write);
pthread_mutex_unlock(&share->mutex);
......
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