summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
Diffstat (limited to 'storage')
-rw-r--r--storage/archive/archive_reader.c14
-rw-r--r--storage/archive/azio.c30
-rw-r--r--storage/archive/ha_archive.cc101
-rw-r--r--storage/archive/ha_archive.h34
-rw-r--r--storage/blackhole/ha_blackhole.cc38
-rw-r--r--storage/blackhole/ha_blackhole.h22
-rw-r--r--storage/csv/ha_tina.cc56
-rw-r--r--storage/csv/ha_tina.h22
-rw-r--r--storage/csv/transparent_file.cc46
-rw-r--r--storage/csv/transparent_file.h4
-rw-r--r--storage/example/ha_example.cc36
-rw-r--r--storage/example/ha_example.h22
-rw-r--r--storage/federated/CMakeLists.txt3
-rw-r--r--storage/federated/ha_federated.cc54
-rw-r--r--storage/federated/ha_federated.h26
-rw-r--r--storage/heap/CMakeLists.txt3
-rw-r--r--storage/heap/_check.c4
-rw-r--r--storage/heap/_rectest.c2
-rw-r--r--storage/heap/ha_heap.cc28
-rw-r--r--storage/heap/ha_heap.h28
-rw-r--r--storage/heap/heapdef.h52
-rw-r--r--storage/heap/hp_block.c23
-rw-r--r--storage/heap/hp_clear.c4
-rw-r--r--storage/heap/hp_close.c2
-rw-r--r--storage/heap/hp_create.c20
-rw-r--r--storage/heap/hp_delete.c10
-rw-r--r--storage/heap/hp_hash.c73
-rw-r--r--storage/heap/hp_info.c2
-rw-r--r--storage/heap/hp_open.c4
-rw-r--r--storage/heap/hp_rfirst.c6
-rw-r--r--storage/heap/hp_rkey.c8
-rw-r--r--storage/heap/hp_rlast.c6
-rw-r--r--storage/heap/hp_rnext.c6
-rw-r--r--storage/heap/hp_rprev.c6
-rw-r--r--storage/heap/hp_rrnd.c4
-rw-r--r--storage/heap/hp_rsame.c2
-rw-r--r--storage/heap/hp_scan.c2
-rw-r--r--storage/heap/hp_test1.c2
-rw-r--r--storage/heap/hp_test2.c4
-rw-r--r--storage/heap/hp_update.c4
-rw-r--r--storage/heap/hp_write.c32
-rw-r--r--storage/innobase/CMakeLists.txt3
-rw-r--r--storage/innobase/handler/ha_innodb.cc51
-rw-r--r--storage/innobase/handler/ha_innodb.h40
-rw-r--r--storage/myisam/CMakeLists.txt4
-rw-r--r--storage/myisam/ft_boolean_search.c84
-rw-r--r--storage/myisam/ft_nlq_search.c18
-rw-r--r--storage/myisam/ft_parser.c29
-rw-r--r--storage/myisam/ft_static.c4
-rw-r--r--storage/myisam/ft_stopwords.c4
-rw-r--r--storage/myisam/ft_update.c28
-rw-r--r--storage/myisam/ftdefs.h32
-rw-r--r--storage/myisam/fulltext.h6
-rw-r--r--storage/myisam/ha_myisam.cc77
-rw-r--r--storage/myisam/ha_myisam.h34
-rw-r--r--storage/myisam/mi_cache.c6
-rw-r--r--storage/myisam/mi_check.c146
-rw-r--r--storage/myisam/mi_checksum.c8
-rw-r--r--storage/myisam/mi_close.c10
-rw-r--r--storage/myisam/mi_create.c4
-rw-r--r--storage/myisam/mi_delete.c68
-rw-r--r--storage/myisam/mi_delete_all.c2
-rw-r--r--storage/myisam/mi_dynrec.c163
-rw-r--r--storage/myisam/mi_extra.c10
-rw-r--r--storage/myisam/mi_key.c56
-rw-r--r--storage/myisam/mi_locking.c2
-rw-r--r--storage/myisam/mi_log.c8
-rw-r--r--storage/myisam/mi_open.c49
-rw-r--r--storage/myisam/mi_packrec.c99
-rw-r--r--storage/myisam/mi_page.c8
-rw-r--r--storage/myisam/mi_preload.c6
-rw-r--r--storage/myisam/mi_range.c4
-rw-r--r--storage/myisam/mi_rfirst.c2
-rw-r--r--storage/myisam/mi_rkey.c2
-rw-r--r--storage/myisam/mi_rlast.c2
-rw-r--r--storage/myisam/mi_rnext.c2
-rw-r--r--storage/myisam/mi_rnext_same.c2
-rw-r--r--storage/myisam/mi_rprev.c2
-rw-r--r--storage/myisam/mi_rrnd.c2
-rw-r--r--storage/myisam/mi_rsame.c2
-rw-r--r--storage/myisam/mi_rsamepos.c2
-rw-r--r--storage/myisam/mi_scan.c2
-rw-r--r--storage/myisam/mi_search.c24
-rw-r--r--storage/myisam/mi_static.c2
-rw-r--r--storage/myisam/mi_statrec.c26
-rw-r--r--storage/myisam/mi_test1.c36
-rw-r--r--storage/myisam/mi_test2.c8
-rw-r--r--storage/myisam/mi_test3.c4
-rw-r--r--storage/myisam/mi_unique.c16
-rw-r--r--storage/myisam/mi_update.c4
-rw-r--r--storage/myisam/mi_write.c56
-rw-r--r--storage/myisam/myisam_ftdump.c2
-rw-r--r--storage/myisam/myisamchk.c92
-rw-r--r--storage/myisam/myisamdef.h117
-rw-r--r--storage/myisam/myisamlog.c60
-rw-r--r--storage/myisam/myisampack.c118
-rw-r--r--storage/myisam/rt_index.c32
-rw-r--r--storage/myisam/rt_split.c4
-rw-r--r--storage/myisam/sort.c62
-rw-r--r--storage/myisam/sp_defs.h2
-rw-r--r--storage/myisam/sp_key.c14
-rw-r--r--storage/myisammrg/CMakeLists.txt3
-rw-r--r--storage/myisammrg/ha_myisammrg.cc74
-rw-r--r--storage/myisammrg/ha_myisammrg.h29
-rw-r--r--storage/myisammrg/myrg_close.c2
-rw-r--r--storage/myisammrg/myrg_def.h7
-rw-r--r--storage/myisammrg/myrg_delete.c2
-rw-r--r--storage/myisammrg/myrg_open.c25
-rw-r--r--storage/myisammrg/myrg_queue.c4
-rw-r--r--storage/myisammrg/myrg_rfirst.c4
-rw-r--r--storage/myisammrg/myrg_rkey.c10
-rw-r--r--storage/myisammrg/myrg_rlast.c4
-rw-r--r--storage/myisammrg/myrg_rnext.c4
-rw-r--r--storage/myisammrg/myrg_rnext_same.c4
-rw-r--r--storage/myisammrg/myrg_rprev.c4
-rw-r--r--storage/myisammrg/myrg_rrnd.c12
-rw-r--r--storage/myisammrg/myrg_rsame.c2
-rw-r--r--storage/myisammrg/myrg_update.c2
-rw-r--r--storage/myisammrg/myrg_write.c2
-rw-r--r--storage/ndb/MAINTAINERS163
-rw-r--r--storage/ndb/include/Makefile.am1
-rw-r--r--storage/ndb/include/debugger/EventLogger.hpp2
-rw-r--r--storage/ndb/include/mgmapi/mgmapi.h100
-rw-r--r--storage/ndb/include/mgmapi/mgmapi_config_parameters.h7
-rw-r--r--storage/ndb/include/mgmapi/mgmapi_error.h121
-rw-r--r--storage/ndb/include/ndb_global.h.in2
-rw-r--r--storage/ndb/include/ndbapi/Ndb.hpp12
-rw-r--r--storage/ndb/include/ndbapi/NdbOperation.hpp7
-rw-r--r--storage/ndb/include/portlib/NdbTick.h4
-rw-r--r--storage/ndb/include/util/ndb_opts.h22
-rw-r--r--storage/ndb/ndbapi-examples/mgmapi_logevent/Makefile6
-rw-r--r--storage/ndb/ndbapi-examples/mgmapi_logevent/main.cpp (renamed from storage/ndb/ndbapi-examples/mgmapi_logevent/mgmapi_logevent.cpp)0
-rw-r--r--storage/ndb/ndbapi-examples/mgmapi_logevent2/Makefile6
-rw-r--r--storage/ndb/ndbapi-examples/mgmapi_logevent2/main.cpp (renamed from storage/ndb/ndbapi-examples/mgmapi_logevent2/mgmapi_logevent2.cpp)0
-rw-r--r--storage/ndb/ndbapi-examples/ndbapi_simple_dual/Makefile6
-rw-r--r--storage/ndb/ndbapi-examples/ndbapi_simple_dual/main.cpp (renamed from storage/ndb/ndbapi-examples/ndbapi_simple_dual/ndbapi_simple_dual.cpp)0
-rw-r--r--storage/ndb/ndbapi-examples/ndbapi_simple_index/Makefile6
-rw-r--r--storage/ndb/ndbapi-examples/ndbapi_simple_index/main.cpp (renamed from storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index.cpp)0
-rw-r--r--storage/ndb/src/common/portlib/NdbTick.c4
-rw-r--r--storage/ndb/src/common/transporter/TransporterRegistry.cpp1
-rw-r--r--storage/ndb/src/cw/cpcd/main.cpp12
-rw-r--r--storage/ndb/src/kernel/blocks/ERROR_codes.txt3
-rw-r--r--storage/ndb/src/kernel/blocks/backup/Backup.cpp84
-rw-r--r--storage/ndb/src/kernel/blocks/backup/Backup.hpp3
-rw-r--r--storage/ndb/src/kernel/blocks/backup/BackupFormat.hpp10
-rw-r--r--storage/ndb/src/kernel/blocks/backup/BackupInit.cpp7
-rw-r--r--storage/ndb/src/kernel/blocks/backup/FsBuffer.hpp24
-rw-r--r--storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp8
-rw-r--r--storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp8
-rw-r--r--storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp23
-rw-r--r--storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp21
-rw-r--r--storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp298
-rw-r--r--storage/ndb/src/kernel/blocks/dblqh/Makefile.am2
-rw-r--r--storage/ndb/src/kernel/blocks/dblqh/redoLogReader/reader.cpp (renamed from storage/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp)0
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp4
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp47
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp18
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp61
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp5
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp64
-rw-r--r--storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp45
-rw-r--r--storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp151
-rw-r--r--storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp4
-rw-r--r--storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp2
-rw-r--r--storage/ndb/src/kernel/blocks/pgman.cpp104
-rw-r--r--storage/ndb/src/kernel/blocks/pgman.hpp6
-rw-r--r--storage/ndb/src/kernel/blocks/restore.cpp3
-rw-r--r--storage/ndb/src/kernel/vm/Configuration.cpp28
-rw-r--r--storage/ndb/src/kernel/vm/Configuration.hpp1
-rw-r--r--storage/ndb/src/kernel/vm/SimulatedBlock.cpp48
-rw-r--r--storage/ndb/src/kernel/vm/SimulatedBlock.hpp8
-rw-r--r--storage/ndb/src/kernel/vm/WatchDog.cpp152
-rw-r--r--storage/ndb/src/mgmapi/mgmapi.cpp2
-rw-r--r--storage/ndb/src/mgmclient/CommandInterpreter.cpp247
-rw-r--r--storage/ndb/src/mgmclient/Makefile.am3
-rw-r--r--storage/ndb/src/mgmclient/main.cpp31
-rw-r--r--storage/ndb/src/mgmsrv/ConfigInfo.cpp48
-rw-r--r--storage/ndb/src/mgmsrv/InitConfigFileParser.cpp16
-rw-r--r--storage/ndb/src/mgmsrv/MgmtSrvr.cpp76
-rw-r--r--storage/ndb/src/mgmsrv/MgmtSrvr.hpp39
-rw-r--r--storage/ndb/src/mgmsrv/main.cpp14
-rw-r--r--storage/ndb/src/mgmsrv/ndb_mgmd_error.h33
-rw-r--r--storage/ndb/src/ndbapi/Ndb.cpp94
-rw-r--r--storage/ndb/src/ndbapi/NdbBlob.cpp10
-rw-r--r--storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp3
-rw-r--r--storage/ndb/src/ndbapi/NdbOperation.cpp8
-rw-r--r--storage/ndb/src/ndbapi/NdbOperationDefine.cpp1
-rw-r--r--storage/ndb/src/ndbapi/NdbOperationInt.cpp2
-rw-r--r--storage/ndb/src/ndbapi/NdbScanOperation.cpp2
-rw-r--r--storage/ndb/src/ndbapi/ndb_internal.hpp26
-rw-r--r--storage/ndb/src/ndbapi/ndberror.c32
-rw-r--r--storage/ndb/test/ndbapi/testMgm.cpp75
-rw-r--r--storage/ndb/test/ndbapi/testNodeRestart.cpp82
-rw-r--r--storage/ndb/test/run-test/conf-dl145a.cnf3
-rw-r--r--storage/ndb/test/run-test/daily-basic-tests.txt10
-rw-r--r--storage/ndb/test/tools/hugoFill.cpp4
-rw-r--r--storage/ndb/tools/delete_all.cpp8
-rw-r--r--storage/ndb/tools/desc.cpp8
-rw-r--r--storage/ndb/tools/drop_index.cpp2
-rw-r--r--storage/ndb/tools/drop_tab.cpp2
-rw-r--r--storage/ndb/tools/listTables.cpp12
-rw-r--r--storage/ndb/tools/ndb_config.cpp22
-rw-r--r--storage/ndb/tools/ndb_error_reporter4
-rw-r--r--storage/ndb/tools/restore/Restore.cpp29
-rw-r--r--storage/ndb/tools/restore/consumer_restore.cpp40
-rw-r--r--storage/ndb/tools/restore/restore_main.cpp56
-rw-r--r--storage/ndb/tools/select_all.cpp26
-rw-r--r--storage/ndb/tools/select_count.cpp6
-rw-r--r--storage/ndb/tools/waiter.cpp8
209 files changed, 3472 insertions, 2137 deletions
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c
index 14018217dea..d3c11f1dce2 100644
--- a/storage/archive/archive_reader.c
+++ b/storage/archive/archive_reader.c
@@ -110,7 +110,7 @@ int main(int argc, char *argv[])
if (opt_check)
{
- byte size_buffer[ARCHIVE_ROW_HEADER_SIZE];
+ uchar size_buffer[ARCHIVE_ROW_HEADER_SIZE];
int error;
unsigned int x;
unsigned int read;
@@ -118,7 +118,7 @@ int main(int argc, char *argv[])
unsigned long long row_count= 0;
char buffer;
- while ((read= azread(&reader_handle, (byte *)size_buffer,
+ while ((read= azread(&reader_handle, (uchar *)size_buffer,
ARCHIVE_ROW_HEADER_SIZE, &error)))
{
if (error == Z_STREAM_ERROR || (read && read < ARCHIVE_ROW_HEADER_SIZE))
@@ -171,7 +171,7 @@ int main(int argc, char *argv[])
if (opt_backup)
{
- byte size_buffer[ARCHIVE_ROW_HEADER_SIZE];
+ uchar size_buffer[ARCHIVE_ROW_HEADER_SIZE];
int error;
unsigned int read;
unsigned int row_len;
@@ -213,7 +213,7 @@ int main(int argc, char *argv[])
my_free(ptr, MYF(0));
}
- while ((read= azread(&reader_handle, (byte *)size_buffer,
+ while ((read= azread(&reader_handle, (uchar *)size_buffer,
ARCHIVE_ROW_HEADER_SIZE, &error)))
{
if (error == Z_STREAM_ERROR || (read && read < ARCHIVE_ROW_HEADER_SIZE))
@@ -355,15 +355,15 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-auto-increment", 'A',
"Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.",
- (gptr*) &new_auto_increment,
- (gptr*) &new_auto_increment,
+ (uchar**) &new_auto_increment,
+ (uchar**) &new_auto_increment,
0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's',
"Only print errors. One can use two -s to make archive_reader very silent.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't',
"Path for temporary files.",
- (gptr*) &opt_tmpdir,
+ (uchar**) &opt_tmpdir,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V',
"Print version and exit.",
diff --git a/storage/archive/azio.c b/storage/archive/azio.c
index 6b01d9c3c88..ee2fee34953 100644
--- a/storage/archive/azio.c
+++ b/storage/archive/azio.c
@@ -19,7 +19,7 @@
static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
static int const az_magic[3] = {0xfe, 0x03, 0x01}; /* az magic header */
-/* gzip flag byte */
+/* gzip flag uchar */
#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
@@ -139,8 +139,8 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
}
else if (s->mode == 'w')
{
- unsigned char buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE];
- my_pread(s->file, (byte*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0,
+ uchar buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE];
+ my_pread(s->file, buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0,
MYF(0));
read_header(s, buffer); /* skip the .az header */
my_seek(s->file, 0, MY_SEEK_END, MYF(0));
@@ -224,7 +224,7 @@ int get_byte(s)
if (s->stream.avail_in == 0)
{
errno = 0;
- s->stream.avail_in = my_read(s->file, (byte *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
+ s->stream.avail_in = my_read(s->file, (uchar *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
@@ -248,8 +248,8 @@ int get_byte(s)
*/
void check_header(azio_stream *s)
{
- int method; /* method byte */
- int flags; /* flags byte */
+ int method; /* method uchar */
+ int flags; /* flags uchar */
uInt len;
int c;
@@ -260,7 +260,7 @@ void check_header(azio_stream *s)
if (len < 2) {
if (len) s->inbuf[0] = s->stream.next_in[0];
errno = 0;
- len = (uInt)my_read(s->file, (byte *)s->inbuf + len, AZ_BUFSIZE_READ >> len, MYF(0));
+ len = (uInt)my_read(s->file, (uchar *)s->inbuf + len, AZ_BUFSIZE_READ >> len, MYF(0));
if (len == 0) s->z_err = Z_ERRNO;
s->stream.avail_in += len;
s->stream.next_in = s->inbuf;
@@ -442,7 +442,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned int len, int *
if (s->stream.avail_out > 0)
{
s->stream.avail_out -=
- (uInt)my_read(s->file, (byte *)next_out, s->stream.avail_out, MYF(0));
+ (uInt)my_read(s->file, (uchar *)next_out, s->stream.avail_out, MYF(0));
}
len -= s->stream.avail_out;
s->in += len;
@@ -455,7 +455,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned int len, int *
if (s->stream.avail_in == 0 && !s->z_eof) {
errno = 0;
- s->stream.avail_in = (uInt)my_read(s->file, (byte *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
+ s->stream.avail_in = (uInt)my_read(s->file, (uchar *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
@@ -522,7 +522,7 @@ unsigned int azwrite (azio_stream *s, voidpc buf, unsigned int len)
{
s->stream.next_out = s->outbuf;
- if (my_write(s->file, (byte *)s->outbuf, AZ_BUFSIZE_WRITE,
+ if (my_write(s->file, (uchar *)s->outbuf, AZ_BUFSIZE_WRITE,
MYF(0)) != AZ_BUFSIZE_WRITE)
{
s->z_err = Z_ERRNO;
@@ -557,6 +557,7 @@ int do_flush (azio_stream *s, int flush)
{
uInt len;
int done = 0;
+ my_off_t afterwrite_pos;
if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
@@ -569,7 +570,7 @@ int do_flush (azio_stream *s, int flush)
if (len != 0)
{
s->check_point= my_tell(s->file, MYF(0));
- if ((uInt)my_write(s->file, (byte *)s->outbuf, len, MYF(0)) != len)
+ if ((uInt)my_write(s->file, (uchar *)s->outbuf, len, MYF(0)) != len)
{
s->z_err = Z_ERRNO;
return Z_ERRNO;
@@ -597,7 +598,10 @@ int do_flush (azio_stream *s, int flush)
s->dirty= AZ_STATE_CLEAN; /* Mark it clean, we should be good now */
else
s->dirty= AZ_STATE_SAVED; /* Mark it clean, we should be good now */
+
+ afterwrite_pos= my_tell(s->file, MYF(0));
write_header(s);
+ my_seek(s->file, afterwrite_pos, SEEK_SET, MYF(0));
return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
}
@@ -611,7 +615,7 @@ int ZEXPORT azflush (s, flush)
if (s->mode == 'r')
{
unsigned char buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE];
- my_pread(s->file, (byte*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0,
+ my_pread(s->file, (uchar*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0,
MYF(0));
read_header(s, buffer); /* skip the .az header */
@@ -748,7 +752,7 @@ my_off_t ZEXPORT aztell (file)
void putLong (File file, uLong x)
{
int n;
- byte buffer[1];
+ uchar buffer[1];
for (n = 0; n < 4; n++)
{
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 6853e879f55..d1482de18ec 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -113,9 +113,9 @@ static handler *archive_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
int archive_discover(handlerton *hton, THD* thd, const char *db,
- const char *name,
- const void** frmblob,
- uint* frmlen);
+ const char *name,
+ uchar **frmblob,
+ size_t *frmlen);
/*
Number of rows that will force a bulk insert.
@@ -137,11 +137,11 @@ static handler *archive_create_handler(handlerton *hton,
/*
Used for hash table that tracks open tables.
*/
-static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
+static uchar* archive_get_key(ARCHIVE_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
- return (byte*) share->table_name;
+ return (uchar*) share->table_name;
}
@@ -216,9 +216,9 @@ ha_archive::ha_archive(handlerton *hton, TABLE_SHARE *table_arg)
}
int archive_discover(handlerton *hton, THD* thd, const char *db,
- const char *name,
- const void** frmblob,
- uint* frmlen)
+ const char *name,
+ uchar **frmblob,
+ size_t *frmlen)
{
DBUG_ENTER("archive_discover");
DBUG_PRINT("archive_discover", ("db: %s, name: %s", db, name));
@@ -247,7 +247,7 @@ int archive_discover(handlerton *hton, THD* thd, const char *db,
azclose(&frm_stream);
*frmlen= frm_stream.frm_length;
- *frmblob= frm_ptr;
+ *frmblob= (uchar*) frm_ptr;
DBUG_RETURN(0);
err:
@@ -316,7 +316,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
length=(uint) strlen(table_name);
if (!(share=(ARCHIVE_SHARE*) hash_search(&archive_open_tables,
- (byte*) table_name,
+ (uchar*) table_name,
length)))
{
char *tmp_name;
@@ -362,7 +362,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
share->crashed= archive_tmp.dirty;
azclose(&archive_tmp);
- VOID(my_hash_insert(&archive_open_tables, (byte*) share));
+ VOID(my_hash_insert(&archive_open_tables, (uchar*) share));
thr_lock_init(&share->lock);
}
share->use_count++;
@@ -393,7 +393,7 @@ int ha_archive::free_share()
pthread_mutex_lock(&archive_mutex);
if (!--share->use_count)
{
- hash_delete(&archive_open_tables, (byte*) share);
+ hash_delete(&archive_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->mutex));
/*
@@ -408,7 +408,7 @@ int ha_archive::free_share()
if (azclose(&(share->archive_write)))
rc= 1;
}
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share, MYF(0));
}
pthread_mutex_unlock(&archive_mutex);
@@ -579,7 +579,7 @@ int ha_archive::create(const char *name, TABLE *table_arg,
azio_stream create_stream; /* Archive file we are working with */
File frm_file; /* File handler for readers */
MY_STAT file_stat; // Stat information for the data file
- byte *frm_ptr;
+ uchar *frm_ptr;
DBUG_ENTER("ha_archive::create");
@@ -651,12 +651,12 @@ int ha_archive::create(const char *name, TABLE *table_arg,
{
if (!my_fstat(frm_file, &file_stat, MYF(MY_WME)))
{
- frm_ptr= (byte *)my_malloc(sizeof(byte) * file_stat.st_size , MYF(0));
+ frm_ptr= (uchar *)my_malloc(sizeof(uchar) * file_stat.st_size, MYF(0));
if (frm_ptr)
{
my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0));
azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size);
- my_free((gptr)frm_ptr, MYF(0));
+ my_free((uchar*)frm_ptr, MYF(0));
}
}
my_close(frm_file, MYF(0));
@@ -696,7 +696,7 @@ error:
/*
This is where the actual row is written out.
*/
-int ha_archive::real_write_row(byte *buf, azio_stream *writer)
+int ha_archive::real_write_row(uchar *buf, azio_stream *writer)
{
my_off_t written;
unsigned int r_pack_length;
@@ -726,7 +726,7 @@ int ha_archive::real_write_row(byte *buf, azio_stream *writer)
the bytes required for the length in the header.
*/
-uint32 ha_archive::max_row_length(const byte *buf)
+uint32 ha_archive::max_row_length(const uchar *buf)
{
uint32 length= (uint32)(table->s->reclength + table->s->fields*2);
length+= ARCHIVE_ROW_HEADER_SIZE;
@@ -743,9 +743,9 @@ uint32 ha_archive::max_row_length(const byte *buf)
}
-unsigned int ha_archive::pack_row(byte *record)
+unsigned int ha_archive::pack_row(uchar *record)
{
- byte *ptr;
+ uchar *ptr;
DBUG_ENTER("ha_archive::pack_row");
@@ -761,8 +761,7 @@ unsigned int ha_archive::pack_row(byte *record)
for (Field **field=table->field ; *field ; field++)
{
if (!((*field)->is_null()))
- ptr=(byte*) (*field)->pack((char*) ptr,
- (char*) record + (*field)->offset(record));
+ ptr= (*field)->pack(ptr, record + (*field)->offset(record));
}
int4store(record_buffer->buffer, (int)(ptr - record_buffer->buffer -
@@ -784,12 +783,12 @@ unsigned int ha_archive::pack_row(byte *record)
for implementing start_bulk_insert() is that we could skip
setting dirty to true each time.
*/
-int ha_archive::write_row(byte *buf)
+int ha_archive::write_row(uchar *buf)
{
int rc;
- byte *read_buf= NULL;
+ uchar *read_buf= NULL;
ulonglong temp_auto;
- byte *record= table->record[0];
+ uchar *record= table->record[0];
DBUG_ENTER("ha_archive::write_row");
if (share->crashed)
@@ -832,7 +831,7 @@ int ha_archive::write_row(byte *buf)
First we create a buffer that we can use for reading rows, and can pass
to get_row().
*/
- if (!(read_buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ if (!(read_buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
{
rc= HA_ERR_OUT_OF_MEM;
goto error;
@@ -882,7 +881,7 @@ int ha_archive::write_row(byte *buf)
error:
pthread_mutex_unlock(&share->mutex);
if (read_buf)
- my_free((gptr) read_buf, MYF(0));
+ my_free((uchar*) read_buf, MYF(0));
DBUG_RETURN(rc);
}
@@ -910,7 +909,7 @@ int ha_archive::index_init(uint keynr, bool sorted)
No indexes, so if we get a request for an index search since we tell
the optimizer that we have unique indexes, we scan
*/
-int ha_archive::index_read(byte *buf, const byte *key,
+int ha_archive::index_read(uchar *buf, const uchar *key,
uint key_len, enum ha_rkey_function find_flag)
{
int rc;
@@ -920,7 +919,7 @@ int ha_archive::index_read(byte *buf, const byte *key,
}
-int ha_archive::index_read_idx(byte *buf, uint index, const byte *key,
+int ha_archive::index_read_idx(uchar *buf, uint index, const uchar *key,
uint key_len, enum ha_rkey_function find_flag)
{
int rc;
@@ -955,7 +954,7 @@ error:
}
-int ha_archive::index_next(byte * buf)
+int ha_archive::index_next(uchar * buf)
{
bool found= 0;
@@ -1024,7 +1023,7 @@ int ha_archive::rnd_init(bool scan)
This is the method that is used to read a row. It assumes that the row is
positioned where you want it.
*/
-int ha_archive::get_row(azio_stream *file_to_read, byte *buf)
+int ha_archive::get_row(azio_stream *file_to_read, uchar *buf)
{
int rc;
DBUG_ENTER("ha_archive::get_row");
@@ -1051,8 +1050,8 @@ bool ha_archive::fix_rec_buff(unsigned int length)
if (length > record_buffer->length)
{
- byte *newptr;
- if (!(newptr=(byte*) my_realloc((gptr) record_buffer->buffer,
+ uchar *newptr;
+ if (!(newptr=(uchar*) my_realloc((uchar*) record_buffer->buffer,
length,
MYF(MY_ALLOW_ZERO_PTR))))
DBUG_RETURN(1);
@@ -1065,17 +1064,17 @@ bool ha_archive::fix_rec_buff(unsigned int length)
DBUG_RETURN(0);
}
-int ha_archive::unpack_row(azio_stream *file_to_read, byte *record)
+int ha_archive::unpack_row(azio_stream *file_to_read, uchar *record)
{
DBUG_ENTER("ha_archive::unpack_row");
unsigned int read;
int error;
- byte size_buffer[ARCHIVE_ROW_HEADER_SIZE];
+ uchar size_buffer[ARCHIVE_ROW_HEADER_SIZE];
unsigned int row_len;
/* First we grab the length stored */
- read= azread(file_to_read, (byte *)size_buffer, ARCHIVE_ROW_HEADER_SIZE, &error);
+ read= azread(file_to_read, size_buffer, ARCHIVE_ROW_HEADER_SIZE, &error);
if (error == Z_STREAM_ERROR || (read && read < ARCHIVE_ROW_HEADER_SIZE))
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
@@ -1100,21 +1099,21 @@ int ha_archive::unpack_row(azio_stream *file_to_read, byte *record)
}
/* Copy null bits */
- const char *ptr= (const char*) record_buffer->buffer;
+ const uchar *ptr= record_buffer->buffer;
memcpy(record, ptr, table->s->null_bytes);
ptr+= table->s->null_bytes;
for (Field **field=table->field ; *field ; field++)
+ {
if (!((*field)->is_null()))
{
- ptr= (*field)->unpack((char *)record +
- (*field)->offset(table->record[0]), ptr);
+ ptr= (*field)->unpack(record + (*field)->offset(table->record[0]), ptr);
}
-
+ }
DBUG_RETURN(0);
}
-int ha_archive::get_row_version3(azio_stream *file_to_read, byte *buf)
+int ha_archive::get_row_version3(azio_stream *file_to_read, uchar *buf)
{
DBUG_ENTER("ha_archive::get_row_version3");
@@ -1124,7 +1123,7 @@ int ha_archive::get_row_version3(azio_stream *file_to_read, byte *buf)
}
-int ha_archive::get_row_version2(azio_stream *file_to_read, byte *buf)
+int ha_archive::get_row_version2(azio_stream *file_to_read, uchar *buf)
{
unsigned int read;
int error;
@@ -1190,7 +1189,7 @@ int ha_archive::get_row_version2(azio_stream *file_to_read, byte *buf)
if ((size_t) read != size)
DBUG_RETURN(HA_ERR_END_OF_FILE);
- ((Field_blob*) table->field[*ptr])->set_ptr(size, last);
+ ((Field_blob*) table->field[*ptr])->set_ptr(size, (uchar*) last);
last += size;
}
else
@@ -1208,7 +1207,7 @@ int ha_archive::get_row_version2(azio_stream *file_to_read, byte *buf)
or by having had ha_archive::rnd_pos() called before it is called.
*/
-int ha_archive::rnd_next(byte *buf)
+int ha_archive::rnd_next(uchar *buf)
{
int rc;
DBUG_ENTER("ha_archive::rnd_next");
@@ -1238,7 +1237,7 @@ int ha_archive::rnd_next(byte *buf)
needed.
*/
-void ha_archive::position(const byte *record)
+void ha_archive::position(const uchar *record)
{
DBUG_ENTER("ha_archive::position");
my_store_ptr(ref, ref_length, current_position);
@@ -1253,7 +1252,7 @@ void ha_archive::position(const byte *record)
correctly ordered row.
*/
-int ha_archive::rnd_pos(byte * buf, byte *pos)
+int ha_archive::rnd_pos(uchar * buf, uchar *pos)
{
DBUG_ENTER("ha_archive::rnd_pos");
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
@@ -1346,8 +1345,8 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
{
Field *field= table->found_next_number_field;
ulonglong auto_value=
- (ulonglong) field->val_int((char*)(table->record[0] +
- field->offset(table->record[0])));
+ (ulonglong) field->val_int(table->record[0] +
+ field->offset(table->record[0]));
if (share->archive_write.auto_increment < auto_value)
stats.auto_increment_value= share->archive_write.auto_increment=
auto_value;
@@ -1549,7 +1548,7 @@ bool ha_archive::is_crashed() const
int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
{
int rc= 0;
- byte *buf;
+ uchar *buf;
const char *old_proc_info;
ha_rows count= share->rows_recorded;
DBUG_ENTER("ha_archive::check");
@@ -1562,7 +1561,7 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
First we create a buffer that we can use for reading rows, and can pass
to get_row().
*/
- if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
rc= HA_ERR_OUT_OF_MEM;
/*
@@ -1618,7 +1617,7 @@ archive_record_buffer *ha_archive::create_record_buffer(unsigned int length)
}
r->length= (int)length;
- if (!(r->buffer= (byte*) my_malloc(r->length,
+ if (!(r->buffer= (uchar*) my_malloc(r->length,
MYF(MY_WME))))
{
my_free((char*) r, MYF(MY_ALLOW_ZERO_PTR));
diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h
index 8fc54f6715f..936bb6e253d 100644
--- a/storage/archive/ha_archive.h
+++ b/storage/archive/ha_archive.h
@@ -27,7 +27,7 @@
*/
typedef struct st_archive_record_buffer {
- byte *buffer;
+ uchar *buffer;
uint32 length;
} archive_record_buffer;
@@ -62,12 +62,12 @@ class ha_archive: public handler
azio_stream archive; /* Archive file we are working with */
my_off_t current_position; /* The position of the row we just read */
- byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */
+ uchar byte_buffer[IO_SIZE]; /* Initial buffer for our string */
String buffer; /* Buffer used for blob storage */
ha_rows scan_rows; /* Number of rows left in scan */
bool delayed_insert; /* If the insert is delayed */
bool bulk_insert; /* If we are performing a bulk insert */
- const byte *current_key;
+ const uchar *current_key;
uint current_key_len;
uint current_k_offset;
archive_record_buffer *record_buffer;
@@ -101,29 +101,29 @@ public:
uint max_supported_key_length() const { return sizeof(ulonglong); }
uint max_supported_key_part_length() const { return sizeof(ulonglong); }
int index_init(uint keynr, bool sorted);
- virtual int index_read(byte * buf, const byte * key,
+ virtual int index_read(uchar * buf, const uchar * key,
uint key_len, enum ha_rkey_function find_flag);
- virtual int index_read_idx(byte * buf, uint index, const byte * key,
+ virtual int index_read_idx(uchar * buf, uint index, const uchar * key,
uint key_len, enum ha_rkey_function find_flag);
- int index_next(byte * buf);
+ int index_next(uchar * buf);
int open(const char *name, int mode, uint test_if_locked);
int close(void);
- int write_row(byte * buf);
- int real_write_row(byte *buf, azio_stream *writer);
+ int write_row(uchar * buf);
+ int real_write_row(uchar *buf, azio_stream *writer);
int delete_all_rows();
int rnd_init(bool scan=1);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
- int get_row(azio_stream *file_to_read, byte *buf);
- int get_row_version2(azio_stream *file_to_read, byte *buf);
- int get_row_version3(azio_stream *file_to_read, byte *buf);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
+ int get_row(azio_stream *file_to_read, uchar *buf);
+ int get_row_version2(azio_stream *file_to_read, uchar *buf);
+ int get_row_version3(azio_stream *file_to_read, uchar *buf);
ARCHIVE_SHARE *get_share(const char *table_name, int *rc);
int free_share();
int init_archive_writer();
int init_archive_reader();
bool auto_repair() const { return 1; } // For the moment we just do this
int read_data_header(azio_stream *file_to_read);
- void position(const byte *record);
+ void position(const uchar *record);
int info(uint);
void update_create_info(HA_CREATE_INFO *create_info);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
@@ -140,9 +140,9 @@ public:
bool is_crashed() const;
int check(THD* thd, HA_CHECK_OPT* check_opt);
bool check_and_repair(THD *thd);
- uint32 max_row_length(const byte *buf);
+ uint32 max_row_length(const uchar *buf);
bool fix_rec_buff(unsigned int length);
- int unpack_row(azio_stream *file_to_read, byte *record);
- unsigned int pack_row(byte *record);
+ int unpack_row(azio_stream *file_to_read, uchar *record);
+ unsigned int pack_row(uchar *record);
};
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 23fdc014114..03da7808948 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -94,7 +94,7 @@ const char *ha_blackhole::index_type(uint key_number)
HA_KEY_ALG_RTREE) ? "RTREE" : "BTREE");
}
-int ha_blackhole::write_row(byte * buf)
+int ha_blackhole::write_row(uchar * buf)
{
DBUG_ENTER("ha_blackhole::write_row");
DBUG_RETURN(0);
@@ -107,14 +107,14 @@ int ha_blackhole::rnd_init(bool scan)
}
-int ha_blackhole::rnd_next(byte *buf)
+int ha_blackhole::rnd_next(uchar *buf)
{
DBUG_ENTER("ha_blackhole::rnd_next");
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-int ha_blackhole::rnd_pos(byte * buf, byte *pos)
+int ha_blackhole::rnd_pos(uchar * buf, uchar *pos)
{
DBUG_ENTER("ha_blackhole::rnd_pos");
DBUG_ASSERT(0);
@@ -122,7 +122,7 @@ int ha_blackhole::rnd_pos(byte * buf, byte *pos)
}
-void ha_blackhole::position(const byte *record)
+void ha_blackhole::position(const uchar *record)
{
DBUG_ENTER("ha_blackhole::position");
DBUG_ASSERT(0);
@@ -184,7 +184,7 @@ THR_LOCK_DATA **ha_blackhole::store_lock(THD *thd,
}
-int ha_blackhole::index_read(byte * buf, const byte * key,
+int ha_blackhole::index_read(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -193,7 +193,7 @@ int ha_blackhole::index_read(byte * buf, const byte * key,
}
-int ha_blackhole::index_read_idx(byte * buf, uint idx, const byte * key,
+int ha_blackhole::index_read_idx(uchar * buf, uint idx, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -202,7 +202,7 @@ int ha_blackhole::index_read_idx(byte * buf, uint idx, const byte * key,
}
-int ha_blackhole::index_read_last(byte * buf, const byte * key,
+int ha_blackhole::index_read_last(uchar * buf, const uchar * key,
key_part_map keypart_map)
{
DBUG_ENTER("ha_blackhole::index_read_last");
@@ -210,28 +210,28 @@ int ha_blackhole::index_read_last(byte * buf, const byte * key,
}
-int ha_blackhole::index_next(byte * buf)
+int ha_blackhole::index_next(uchar * buf)
{
DBUG_ENTER("ha_blackhole::index_next");
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-int ha_blackhole::index_prev(byte * buf)
+int ha_blackhole::index_prev(uchar * buf)
{
DBUG_ENTER("ha_blackhole::index_prev");
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-int ha_blackhole::index_first(byte * buf)
+int ha_blackhole::index_first(uchar * buf)
{
DBUG_ENTER("ha_blackhole::index_first");
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-int ha_blackhole::index_last(byte * buf)
+int ha_blackhole::index_last(uchar * buf)
{
DBUG_ENTER("ha_blackhole::index_last");
DBUG_RETURN(HA_ERR_END_OF_FILE);
@@ -247,7 +247,7 @@ static st_blackhole_share *get_share(const char *table_name)
pthread_mutex_lock(&blackhole_mutex);
if (!(share= (st_blackhole_share*) hash_search(&blackhole_open_tables,
- (byte*) table_name, length)))
+ (uchar*) table_name, length)))
{
if (!(share= (st_blackhole_share*) my_malloc(sizeof(st_blackhole_share) +
length,
@@ -257,9 +257,9 @@ static st_blackhole_share *get_share(const char *table_name)
share->table_name_length= length;
strmov(share->table_name, table_name);
- if (my_hash_insert(&blackhole_open_tables, (byte*) share))
+ if (my_hash_insert(&blackhole_open_tables, (uchar*) share))
{
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share, MYF(0));
share= NULL;
goto error;
}
@@ -277,21 +277,21 @@ static void free_share(st_blackhole_share *share)
{
pthread_mutex_lock(&blackhole_mutex);
if (!--share->use_count)
- hash_delete(&blackhole_open_tables, (byte*) share);
+ hash_delete(&blackhole_open_tables, (uchar*) share);
pthread_mutex_unlock(&blackhole_mutex);
}
static void blackhole_free_key(st_blackhole_share *share)
{
thr_lock_delete(&share->lock);
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share, MYF(0));
}
-static byte* blackhole_get_key(st_blackhole_share *share, uint *length,
- my_bool not_used __attribute__((unused)))
+static uchar* blackhole_get_key(st_blackhole_share *share, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length= share->table_name_length;
- return (byte*) share->table_name;
+ return (uchar*) share->table_name;
}
static int blackhole_init(void *p)
diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h
index 1fd4df7ea78..9b511fc2e0c 100644
--- a/storage/blackhole/ha_blackhole.h
+++ b/storage/blackhole/ha_blackhole.h
@@ -71,20 +71,20 @@ public:
uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
int open(const char *name, int mode, uint test_if_locked);
int close(void);
- int write_row(byte * buf);
+ int write_row(uchar * buf);
int rnd_init(bool scan);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
- int index_read(byte * buf, const byte * key, key_part_map keypart_map,
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
+ int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
enum ha_rkey_function find_flag);
- int index_read_idx(byte * buf, uint idx, const byte * key,
+ int index_read_idx(uchar * buf, uint idx, const uchar * key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_read_last(byte * buf, const byte * key, key_part_map keypart_map);
- int index_next(byte * buf);
- int index_prev(byte * buf);
- int index_first(byte * buf);
- int index_last(byte * buf);
- void position(const byte *record);
+ int index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map);
+ int index_next(uchar * buf);
+ int index_prev(uchar * buf);
+ int index_first(uchar * buf);
+ int index_last(uchar * buf);
+ void position(const uchar *record);
int info(uint flag);
int external_lock(THD *thd, int lock_type);
int create(const char *name, TABLE *table_arg,
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 07a4ffc65c5..6de153c82d7 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -93,11 +93,11 @@ int sort_set (tina_set *a, tina_set *b)
return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 ) );
}
-static byte* tina_get_key(TINA_SHARE *share,uint *length,
+static uchar* tina_get_key(TINA_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
- return (byte*) share->table_name;
+ return (uchar*) share->table_name;
}
static int tina_init_func(void *p)
@@ -144,7 +144,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
initialize its members.
*/
if (!(share=(TINA_SHARE*) hash_search(&tina_open_tables,
- (byte*) table_name,
+ (uchar*) table_name,
length)))
{
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
@@ -174,7 +174,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
goto error;
share->saved_data_file_length= file_stat.st_size;
- if (my_hash_insert(&tina_open_tables, (byte*) share))
+ if (my_hash_insert(&tina_open_tables, (uchar*) share))
goto error;
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
@@ -203,7 +203,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
error:
pthread_mutex_unlock(&tina_mutex);
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share, MYF(0));
return NULL;
}
@@ -236,7 +236,7 @@ static int read_meta_file(File meta_file, ha_rows *rows)
DBUG_ENTER("ha_tina::read_meta_file");
VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0)));
- if (my_read(meta_file, (byte*)meta_buffer, META_BUFFER_SIZE, 0)
+ if (my_read(meta_file, (uchar*)meta_buffer, META_BUFFER_SIZE, 0)
!= META_BUFFER_SIZE)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
@@ -305,7 +305,7 @@ static int write_meta_file(File meta_file, ha_rows rows, bool dirty)
*ptr= (uchar)dirty;
VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0)));
- if (my_write(meta_file, (byte *)meta_buffer, META_BUFFER_SIZE, 0)
+ if (my_write(meta_file, (uchar *)meta_buffer, META_BUFFER_SIZE, 0)
!= META_BUFFER_SIZE)
DBUG_RETURN(-1);
@@ -376,10 +376,10 @@ static int free_share(TINA_SHARE *share)
share->tina_write_opened= FALSE;
}
- hash_delete(&tina_open_tables, (byte*) share);
+ hash_delete(&tina_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share, MYF(0));
}
pthread_mutex_unlock(&tina_mutex);
@@ -444,7 +444,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg)
records_is_known(0)
{
/* Set our original buffers from pre-allocated memory */
- buffer.set((char*)byte_buffer, IO_SIZE, system_charset_info);
+ buffer.set((char*)byte_buffer, IO_SIZE, &my_charset_bin);
chain= chain_buffer;
file_buff= new Transparent_file();
}
@@ -454,7 +454,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg)
Encode a buffer into the quoted format.
*/
-int ha_tina::encode_quote(byte *buf)
+int ha_tina::encode_quote(uchar *buf)
{
char attribute_buffer[1024];
String attribute(attribute_buffer, sizeof(attribute_buffer),
@@ -558,7 +558,7 @@ int ha_tina::chain_append()
if (chain_alloced)
{
/* Must cast since my_malloc unlike malloc doesn't have a void ptr */
- if ((chain= (tina_set *) my_realloc((gptr)chain,
+ if ((chain= (tina_set *) my_realloc((uchar*)chain,
chain_size, MYF(MY_WME))) == NULL)
return -1;
}
@@ -584,7 +584,7 @@ int ha_tina::chain_append()
/*
Scans for a row.
*/
-int ha_tina::find_current_row(byte *buf)
+int ha_tina::find_current_row(uchar *buf)
{
off_t end_offset, curr_offset= current_position;
int eoln_len;
@@ -679,7 +679,7 @@ int ha_tina::find_current_row(byte *buf)
}
if (bitmap_is_set(table->read_set, (*field)->field_index))
- (*field)->store(buffer.ptr(), buffer.length(), system_charset_info);
+ (*field)->store(buffer.ptr(), buffer.length(), buffer.charset());
}
next_position= end_offset + eoln_len;
error= 0;
@@ -851,7 +851,7 @@ int ha_tina::close(void)
of the file and appends the data. In an error case it really should
just truncate to the original position (this is not done yet).
*/
-int ha_tina::write_row(byte * buf)
+int ha_tina::write_row(uchar * buf)
{
int size;
DBUG_ENTER("ha_tina::write_row");
@@ -871,7 +871,7 @@ int ha_tina::write_row(byte * buf)
DBUG_RETURN(-1);
/* use pwrite, as concurrent reader could have changed the position */
- if (my_write(share->tina_write_filedes, (byte*)buffer.ptr(), size,
+ if (my_write(share->tina_write_filedes, (uchar*)buffer.ptr(), size,
MYF(MY_WME | MY_NABP)))
DBUG_RETURN(-1);
@@ -916,7 +916,7 @@ int ha_tina::open_update_temp_file_if_needed()
This will be called in a table scan right before the previous ::rnd_next()
call.
*/
-int ha_tina::update_row(const byte * old_data, byte * new_data)
+int ha_tina::update_row(const uchar * old_data, uchar * new_data)
{
int size;
DBUG_ENTER("ha_tina::update_row");
@@ -934,7 +934,7 @@ int ha_tina::update_row(const byte * old_data, byte * new_data)
if (open_update_temp_file_if_needed())
DBUG_RETURN(-1);
- if (my_write(update_temp_file, (byte*)buffer.ptr(), size,
+ if (my_write(update_temp_file, (uchar*)buffer.ptr(), size,
MYF(MY_WME | MY_NABP)))
DBUG_RETURN(-1);
@@ -954,7 +954,7 @@ int ha_tina::update_row(const byte * old_data, byte * new_data)
The table will then be deleted/positioned based on the ORDER (so RANDOM,
DESC, ASC).
*/
-int ha_tina::delete_row(const byte * buf)
+int ha_tina::delete_row(const uchar * buf)
{
DBUG_ENTER("ha_tina::delete_row");
ha_statistic_increment(&SSV::ha_delete_count);
@@ -1033,7 +1033,7 @@ int ha_tina::rnd_init(bool scan)
NULL and "". This is ok since this table handler is for spreadsheets and
they don't know about them either :)
*/
-int ha_tina::rnd_next(byte *buf)
+int ha_tina::rnd_next(uchar *buf)
{
int rc;
DBUG_ENTER("ha_tina::rnd_next");
@@ -1065,7 +1065,7 @@ int ha_tina::rnd_next(byte *buf)
its just a position. Look at the bdb code if you want to see a case
where something other then a number is stored.
*/
-void ha_tina::position(const byte *record)
+void ha_tina::position(const uchar *record)
{
DBUG_ENTER("ha_tina::position");
my_store_ptr(ref, ref_length, current_position);
@@ -1078,7 +1078,7 @@ void ha_tina::position(const byte *record)
my_get_ptr() retrieves the data for you.
*/
-int ha_tina::rnd_pos(byte * buf, byte *pos)
+int ha_tina::rnd_pos(uchar * buf, uchar *pos)
{
DBUG_ENTER("ha_tina::rnd_pos");
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
@@ -1178,7 +1178,7 @@ int ha_tina::rnd_end()
/* if there is something to write, write it */
if ((write_end - write_begin) &&
(my_write(update_temp_file,
- (byte*)(file_buff->ptr() +
+ (uchar*)(file_buff->ptr() +
(write_begin - file_buff->start())),
write_end - write_begin, MYF_RW)))
goto error;
@@ -1266,7 +1266,7 @@ error:
int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
{
char repaired_fname[FN_REFLEN];
- byte *buf;
+ uchar *buf;
File repair_file;
int rc;
ha_rows rows_repaired= 0;
@@ -1282,7 +1282,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
/* Don't assert in field::val() functions */
table->use_all_columns();
- if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
/* position buffer to the start of the file */
@@ -1338,7 +1338,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
{
write_end= min(file_buff->end(), current_position);
if ((write_end - write_begin) &&
- (my_write(repair_file, (byte*)file_buff->ptr(),
+ (my_write(repair_file, (uchar*)file_buff->ptr(),
write_end - write_begin, MYF_RW)))
DBUG_RETURN(-1);
@@ -1442,13 +1442,13 @@ int ha_tina::create(const char *name, TABLE *table_arg,
int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
{
int rc= 0;
- byte *buf;
+ uchar *buf;
const char *old_proc_info;
ha_rows count= share->rows_recorded;
DBUG_ENTER("ha_tina::check");
old_proc_info= thd_proc_info(thd, "Checking table");
- if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
/* position buffer to the start of the file */
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index c096f21fca2..ecb7f006cc4 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -63,7 +63,7 @@ class ha_tina: public handler
off_t current_position; /* Current position in the file during a file scan */
off_t next_position; /* Next position in the file scan */
off_t local_saved_data_file_length; /* save position for reads */
- byte byte_buffer[IO_SIZE];
+ uchar byte_buffer[IO_SIZE];
Transparent_file *file_buff;
File data_file; /* File handler for readers */
File update_temp_file;
@@ -76,7 +76,7 @@ class ha_tina: public handler
tina_set chain_buffer[DEFAULT_CHAIN_LENGTH];
tina_set *chain;
tina_set *chain_ptr;
- byte chain_alloced;
+ uchar chain_alloced;
uint32 chain_size;
bool records_is_known;
@@ -90,7 +90,7 @@ public:
~ha_tina()
{
if (chain_alloced)
- my_free((gptr)chain, 0);
+ my_free(chain, 0);
if (file_buff)
delete file_buff;
}
@@ -133,12 +133,12 @@ public:
bool called_by_logger_thread);
int open(const char *name, int mode, uint open_options);
int close(void);
- int write_row(byte * buf);
- int update_row(const byte * old_data, byte * new_data);
- int delete_row(const byte * buf);
+ int write_row(uchar * buf);
+ int update_row(const uchar * old_data, uchar * new_data);
+ int delete_row(const uchar * buf);
int rnd_init(bool scan=1);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
bool check_and_repair(THD *thd);
int check(THD* thd, HA_CHECK_OPT* check_opt);
bool is_crashed() const;
@@ -146,7 +146,7 @@ public:
int repair(THD* thd, HA_CHECK_OPT* check_opt);
/* This is required for SQL layer to know that we support autorepair */
bool auto_repair() const { return 1; }
- void position(const byte *record);
+ void position(const uchar *record);
int info(uint);
int extra(enum ha_extra_function operation);
int delete_all_rows(void);
@@ -165,8 +165,8 @@ public:
void update_status();
/* The following methods were added just for TINA */
- int encode_quote(byte *buf);
- int find_current_row(byte *buf);
+ int encode_quote(uchar *buf);
+ int find_current_row(uchar *buf);
int chain_append();
};
diff --git a/storage/csv/transparent_file.cc b/storage/csv/transparent_file.cc
index 27cc8c024b4..a200fa6ac36 100644
--- a/storage/csv/transparent_file.cc
+++ b/storage/csv/transparent_file.cc
@@ -22,12 +22,12 @@
Transparent_file::Transparent_file() : lower_bound(0), buff_size(IO_SIZE)
{
- buff= (byte *) my_malloc(buff_size*sizeof(byte), MYF(MY_WME));
+ buff= (uchar *) my_malloc(buff_size*sizeof(uchar), MYF(MY_WME));
}
Transparent_file::~Transparent_file()
{
- my_free((gptr)buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*)buff, MYF(MY_ALLOW_ZERO_PTR));
}
void Transparent_file::init_buff(File filedes_arg)
@@ -40,7 +40,7 @@ void Transparent_file::init_buff(File filedes_arg)
upper_bound= my_read(filedes, buff, buff_size, MYF(0));
}
-byte *Transparent_file::ptr()
+uchar *Transparent_file::ptr()
{
return buff;
}
@@ -57,18 +57,18 @@ off_t Transparent_file::end()
off_t Transparent_file::read_next()
{
- off_t bytes_read;
+ size_t bytes_read;
/*
No need to seek here, as the file managed by Transparent_file class
always points to upper_bound byte
*/
if ((bytes_read= my_read(filedes, buff, buff_size, MYF(0))) == MY_FILE_ERROR)
- return -1;
+ return (off_t) -1;
/* end of file */
if (!bytes_read)
- return -1;
+ return (off_t) -1;
lower_bound= upper_bound;
upper_bound+= bytes_read;
@@ -79,26 +79,24 @@ off_t Transparent_file::read_next()
char Transparent_file::get_value(off_t offset)
{
- off_t bytes_read;
+ size_t bytes_read;
/* check boundaries */
if ((lower_bound <= offset) && (offset < upper_bound))
return buff[offset - lower_bound];
- else
- {
- VOID(my_seek(filedes, offset, MY_SEEK_SET, MYF(0)));
- /* read appropriate portion of the file */
- if ((bytes_read= my_read(filedes, buff, buff_size,
- MYF(0))) == MY_FILE_ERROR)
- return 0;
-
- lower_bound= offset;
- upper_bound= lower_bound + bytes_read;
-
- /* end of file */
- if (upper_bound == offset)
- return 0;
-
- return buff[0];
- }
+
+ VOID(my_seek(filedes, offset, MY_SEEK_SET, MYF(0)));
+ /* read appropriate portion of the file */
+ if ((bytes_read= my_read(filedes, buff, buff_size,
+ MYF(0))) == MY_FILE_ERROR)
+ return 0;
+
+ lower_bound= offset;
+ upper_bound= lower_bound + bytes_read;
+
+ /* end of file */
+ if (upper_bound == offset)
+ return 0;
+
+ return buff[0];
}
diff --git a/storage/csv/transparent_file.h b/storage/csv/transparent_file.h
index ceb59ec7caf..4c0f4cce7e7 100644
--- a/storage/csv/transparent_file.h
+++ b/storage/csv/transparent_file.h
@@ -21,7 +21,7 @@
class Transparent_file
{
File filedes;
- byte *buff; /* in-memory window to the file or mmaped area */
+ uchar *buff; /* in-memory window to the file or mmaped area */
/* current window sizes */
off_t lower_bound;
off_t upper_bound;
@@ -33,7 +33,7 @@ public:
~Transparent_file();
void init_buff(File filedes_arg);
- byte *ptr();
+ uchar *ptr();
off_t start();
off_t end();
char get_value (off_t offset);
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 53af99dee97..06efc727837 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -114,11 +114,11 @@ pthread_mutex_t example_mutex;
Function we use in the creation of our hash to get key.
*/
-static byte* example_get_key(EXAMPLE_SHARE *share,uint *length,
+static uchar* example_get_key(EXAMPLE_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
- return (byte*) share->table_name;
+ return (uchar*) share->table_name;
}
@@ -172,7 +172,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
length=(uint) strlen(table_name);
if (!(share=(EXAMPLE_SHARE*) hash_search(&example_open_tables,
- (byte*) table_name,
+ (uchar*) table_name,
length)))
{
if (!(share=(EXAMPLE_SHARE *)
@@ -189,7 +189,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
share->table_name_length=length;
share->table_name=tmp_name;
strmov(share->table_name,table_name);
- if (my_hash_insert(&example_open_tables, (byte*) share))
+ if (my_hash_insert(&example_open_tables, (uchar*) share))
goto error;
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
@@ -201,7 +201,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
error:
pthread_mutex_destroy(&share->mutex);
- my_free((gptr) share, MYF(0));
+ my_free(share, MYF(0));
return NULL;
}
@@ -218,10 +218,10 @@ static int free_share(EXAMPLE_SHARE *share)
pthread_mutex_lock(&example_mutex);
if (!--share->use_count)
{
- hash_delete(&example_open_tables, (byte*) share);
+ hash_delete(&example_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
- my_free((gptr) share, MYF(0));
+ my_free(share, MYF(0));
}
pthread_mutex_unlock(&example_mutex);
@@ -349,7 +349,7 @@ int ha_example::close(void)
sql_insert.cc, sql_select.cc, sql_table.cc, sql_udf.cc and sql_update.cc
*/
-int ha_example::write_row(byte * buf)
+int ha_example::write_row(uchar *buf)
{
DBUG_ENTER("ha_example::write_row");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -378,7 +378,7 @@ int ha_example::write_row(byte * buf)
@see
sql_select.cc, sql_acl.cc, sql_update.cc and sql_insert.cc
*/
-int ha_example::update_row(const byte * old_data, byte * new_data)
+int ha_example::update_row(const uchar *old_data, uchar *new_data)
{
DBUG_ENTER("ha_example::update_row");
@@ -406,7 +406,7 @@ int ha_example::update_row(const byte * old_data, byte * new_data)
sql_acl.cc, sql_udf.cc, sql_delete.cc, sql_insert.cc and sql_select.cc
*/
-int ha_example::delete_row(const byte * buf)
+int ha_example::delete_row(const uchar *buf)
{
DBUG_ENTER("ha_example::delete_row");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -420,7 +420,7 @@ int ha_example::delete_row(const byte * buf)
index.
*/
-int ha_example::index_read(byte * buf, const byte * key,
+int ha_example::index_read(uchar *buf, const uchar *key,
key_part_map keypart_map __attribute__((unused)),
enum ha_rkey_function find_flag
__attribute__((unused)))
@@ -435,7 +435,7 @@ int ha_example::index_read(byte * buf, const byte * key,
Used to read forward through the index.
*/
-int ha_example::index_next(byte * buf)
+int ha_example::index_next(uchar *buf)
{
DBUG_ENTER("ha_example::index_next");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -447,7 +447,7 @@ int ha_example::index_next(byte * buf)
Used to read backwards through the index.
*/
-int ha_example::index_prev(byte * buf)
+int ha_example::index_prev(uchar *buf)
{
DBUG_ENTER("ha_example::index_prev");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -464,7 +464,7 @@ int ha_example::index_prev(byte * buf)
@see
opt_range.cc, opt_sum.cc, sql_handler.cc and sql_select.cc
*/
-int ha_example::index_first(byte * buf)
+int ha_example::index_first(uchar *buf)
{
DBUG_ENTER("ha_example::index_first");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -481,7 +481,7 @@ int ha_example::index_first(byte * buf)
@see
opt_range.cc, opt_sum.cc, sql_handler.cc and sql_select.cc
*/
-int ha_example::index_last(byte * buf)
+int ha_example::index_last(uchar *buf)
{
DBUG_ENTER("ha_example::index_last");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -528,7 +528,7 @@ int ha_example::rnd_end()
@see
filesort.cc, records.cc, sql_handler.cc, sql_select.cc, sql_table.cc and sql_update.cc
*/
-int ha_example::rnd_next(byte *buf)
+int ha_example::rnd_next(uchar *buf)
{
DBUG_ENTER("ha_example::rnd_next");
DBUG_RETURN(HA_ERR_END_OF_FILE);
@@ -556,7 +556,7 @@ int ha_example::rnd_next(byte *buf)
@see
filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc
*/
-void ha_example::position(const byte *record)
+void ha_example::position(const uchar *record)
{
DBUG_ENTER("ha_example::position");
DBUG_VOID_RETURN;
@@ -576,7 +576,7 @@ void ha_example::position(const byte *record)
@see
filesort.cc, records.cc, sql_insert.cc, sql_select.cc and sql_update.cc
*/
-int ha_example::rnd_pos(byte * buf, byte *pos)
+int ha_example::rnd_pos(uchar *buf, uchar *pos)
{
DBUG_ENTER("ha_example::rnd_pos");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h
index 9777a478209..69b7cf4d336 100644
--- a/storage/example/ha_example.h
+++ b/storage/example/ha_example.h
@@ -172,50 +172,50 @@ public:
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int write_row(byte * buf);
+ int write_row(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int update_row(const byte * old_data, byte * new_data);
+ int update_row(const uchar *old_data, uchar *new_data);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int delete_row(const byte * buf);
+ int delete_row(const uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_read(byte * buf, const byte * key,
+ int index_read(uchar *buf, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_next(byte * buf);
+ int index_next(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_prev(byte * buf);
+ int index_prev(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_first(byte * buf);
+ int index_first(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_last(byte * buf);
+ int index_last(uchar *buf);
/** @brief
Unlike index_init(), rnd_init() can be called two consecutive times
@@ -227,9 +227,9 @@ public:
*/
int rnd_init(bool scan); //required
int rnd_end();
- int rnd_next(byte *buf); ///< required
- int rnd_pos(byte * buf, byte *pos); ///< required
- void position(const byte *record); ///< required
+ int rnd_next(uchar *buf); ///< required
+ int rnd_pos(uchar *buf, uchar *pos); ///< required
+ void position(const uchar *record); ///< required
int info(uint); ///< required
int extra(enum ha_extra_function operation);
int external_lock(THD *thd, int lock_type); ///< required
diff --git a/storage/federated/CMakeLists.txt b/storage/federated/CMakeLists.txt
index 1f1f4dcd517..359a8784877 100644
--- a/storage/federated/CMakeLists.txt
+++ b/storage/federated/CMakeLists.txt
@@ -15,6 +15,9 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+IF(EMBEDDED_ONLY)
+ ADD_DEFINITIONS(-DUSE_TLS)
+ENDIF(EMBEDDED_ONLY)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index da8ad46f96d..96ce0013587 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -414,11 +414,11 @@ static handler *federated_create_handler(handlerton *hton,
/* Function we use in the creation of our hash to get key */
-static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
+static uchar *federated_get_key(FEDERATED_SHARE *share, size_t *length,
my_bool not_used __attribute__ ((unused)))
{
*length= share->share_key_length;
- return (byte*) share->share_key;
+ return (uchar*) share->share_key;
}
/*
@@ -725,8 +725,8 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATED_SHARE *share, TABLE *table,
share->port= 0;
share->socket= 0;
DBUG_PRINT("info", ("share at %lx", (long unsigned int) share));
- DBUG_PRINT("info", ("Length: %d", table->s->connect_string.length));
- DBUG_PRINT("info", ("String: '%.*s'", table->s->connect_string.length,
+ DBUG_PRINT("info", ("Length: %u", (uint) table->s->connect_string.length));
+ DBUG_PRINT("info", ("String: '%.*s'", (int) table->s->connect_string.length,
table->s->connect_string.str));
share->connection_string= strmake_root(mem_root, table->s->connect_string.str,
table->s->connect_string.length);
@@ -930,7 +930,7 @@ ha_federated::ha_federated(handlerton *hton,
0 After fields have had field values stored from record
*/
-uint ha_federated::convert_row_to_internal_format(byte *record,
+uint ha_federated::convert_row_to_internal_format(uchar *record,
MYSQL_ROW row,
MYSQL_RES *result)
{
@@ -978,7 +978,7 @@ static bool emit_key_part_name(String *to, KEY_PART_INFO *part)
static bool emit_key_part_element(String *to, KEY_PART_INFO *part,
bool needs_quotes, bool is_like,
- const byte *ptr, uint len)
+ const uchar *ptr, uint len)
{
Field *field= part->field;
DBUG_ENTER("emit_key_part_element");
@@ -1019,7 +1019,7 @@ static bool emit_key_part_element(String *to, KEY_PART_INFO *part,
char strbuff[MAX_FIELD_WIDTH];
String str(strbuff, sizeof(strbuff), part->field->charset()), *res;
- res= field->val_str(&str, (char *)ptr);
+ res= field->val_str(&str, ptr);
if (field->result_type() == STRING_RESULT)
{
@@ -1286,7 +1286,7 @@ bool ha_federated::create_where_from_key(String *to,
{
bool both_not_null=
(start_key != NULL && end_key != NULL) ? TRUE : FALSE;
- const byte *ptr;
+ const uchar *ptr;
uint remainder, length;
char tmpbuff[FEDERATED_QUERY_BUFFER_SIZE];
String tmp(tmpbuff, sizeof(tmpbuff), system_charset_info);
@@ -1325,7 +1325,7 @@ bool ha_federated::create_where_from_key(String *to,
uint store_length= key_part->store_length;
uint part_length= min(store_length, length);
needs_quotes= field->str_needs_quotes();
- DBUG_DUMP("key, start of loop", (char *) ptr, length);
+ DBUG_DUMP("key, start of loop", ptr, length);
if (key_part->null_bit)
{
@@ -1507,7 +1507,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table)
/* TODO: change tmp_share.scheme to LEX_STRING object */
if (!(share= (FEDERATED_SHARE *) hash_search(&federated_open_tables,
- (byte*) tmp_share.share_key,
+ (uchar*) tmp_share.share_key,
tmp_share.
share_key_length)))
{
@@ -1537,7 +1537,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table)
DBUG_PRINT("info",
("share->select_query %s", share->select_query));
- if (my_hash_insert(&federated_open_tables, (byte*) share))
+ if (my_hash_insert(&federated_open_tables, (uchar*) share))
goto error;
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST);
@@ -1571,7 +1571,7 @@ static int free_share(FEDERATED_SHARE *share)
pthread_mutex_lock(&federated_mutex);
if (!--share->use_count)
{
- hash_delete(&federated_open_tables, (byte*) share);
+ hash_delete(&federated_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->mutex));
free_root(&mem_root, MYF(0));
@@ -1755,7 +1755,7 @@ static inline uint field_in_record_is_null(TABLE *table,
sql_insert.cc, sql_select.cc, sql_table.cc, sql_udf.cc, and sql_update.cc.
*/
-int ha_federated::write_row(byte *buf)
+int ha_federated::write_row(uchar *buf)
{
/*
I need a bool again, in 5.0, I used table->s->fields to accomplish this.
@@ -2010,7 +2010,7 @@ int ha_federated::repair(THD* thd, HA_CHECK_OPT* check_opt)
Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc.
*/
-int ha_federated::update_row(const byte *old_data, byte *new_data)
+int ha_federated::update_row(const uchar *old_data, uchar *new_data)
{
/*
This used to control how the query was built. If there was a
@@ -2044,7 +2044,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
String where_string(where_buffer,
sizeof(where_buffer),
&my_charset_bin);
- byte *record= table->record[0];
+ uchar *record= table->record[0];
DBUG_ENTER("ha_federated::update_row");
/*
set string lengths to 0 to avoid misc chars in string
@@ -2103,7 +2103,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
bool needs_quote= (*field)->str_needs_quotes();
where_string.append(STRING_WITH_LEN(" = "));
(*field)->val_str(&field_value,
- (char*) (old_data + (*field)->offset(record)));
+ (old_data + (*field)->offset(record)));
if (needs_quote)
where_string.append('\'');
field_value.print(&where_string);
@@ -2155,7 +2155,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
calls.
*/
-int ha_federated::delete_row(const byte *buf)
+int ha_federated::delete_row(const uchar *buf)
{
char delete_buffer[FEDERATED_QUERY_BUFFER_SIZE];
char data_buffer[FEDERATED_QUERY_BUFFER_SIZE];
@@ -2225,7 +2225,7 @@ int ha_federated::delete_row(const byte *buf)
a WHERE clause on a non-primary key index, simply calls index_read_idx.
*/
-int ha_federated::index_read(byte *buf, const byte *key,
+int ha_federated::index_read(uchar *buf, const uchar *key,
uint key_len, ha_rkey_function find_flag)
{
DBUG_ENTER("ha_federated::index_read");
@@ -2251,7 +2251,7 @@ int ha_federated::index_read(byte *buf, const byte *key,
returns. We need to be able to be calable from ha_rnd_pos()
*/
-int ha_federated::index_read_idx(byte *buf, uint index, const byte *key,
+int ha_federated::index_read_idx(uchar *buf, uint index, const uchar *key,
uint key_len, enum ha_rkey_function find_flag)
{
int retval;
@@ -2277,8 +2277,8 @@ int ha_federated::index_read_idx(byte *buf, uint index, const byte *key,
table->status == STATUS_NOT_FOUND
*/
-int ha_federated::index_read_idx_with_result_set(byte *buf, uint index,
- const byte *key,
+int ha_federated::index_read_idx_with_result_set(uchar *buf, uint index,
+ const uchar *key,
uint key_len,
ha_rkey_function find_flag,
MYSQL_RES **result)
@@ -2410,7 +2410,7 @@ int ha_federated::read_range_next()
/* Used to read forward through the index. */
-int ha_federated::index_next(byte *buf)
+int ha_federated::index_next(uchar *buf)
{
DBUG_ENTER("ha_federated::index_next");
ha_statistic_increment(&SSV::ha_read_next_count);
@@ -2523,7 +2523,7 @@ int ha_federated::index_end(void)
sql_table.cc, and sql_update.cc.
*/
-int ha_federated::rnd_next(byte *buf)
+int ha_federated::rnd_next(uchar *buf)
{
DBUG_ENTER("ha_federated::rnd_next");
@@ -2560,7 +2560,7 @@ int ha_federated::rnd_next(byte *buf)
0 no error
*/
-int ha_federated::read_next(byte *buf, MYSQL_RES *result)
+int ha_federated::read_next(uchar *buf, MYSQL_RES *result)
{
int retval;
MYSQL_ROW row;
@@ -2589,11 +2589,11 @@ int ha_federated::read_next(byte *buf, MYSQL_RES *result)
Called from filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc.
*/
-void ha_federated::position(const byte *record)
+void ha_federated::position(const uchar *record)
{
DBUG_ENTER("ha_federated::position");
if (table->s->primary_key != MAX_KEY)
- key_copy(ref, (byte *)record, table->key_info + table->s->primary_key,
+ key_copy(ref, (uchar *)record, table->key_info + table->s->primary_key,
ref_length);
else
memcpy(ref, record, ref_length);
@@ -2610,7 +2610,7 @@ void ha_federated::position(const byte *record)
Called from filesort.cc records.cc sql_insert.cc sql_select.cc sql_update.cc.
*/
-int ha_federated::rnd_pos(byte *buf, byte *pos)
+int ha_federated::rnd_pos(uchar *buf, uchar *pos)
{
int result;
DBUG_ENTER("ha_federated::rnd_pos");
diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h
index 4d2eefdd986..94f61af96c3 100644
--- a/storage/federated/ha_federated.h
+++ b/storage/federated/ha_federated.h
@@ -94,7 +94,7 @@ private:
return 0 on success
return errorcode otherwise
*/
- uint convert_row_to_internal_format(byte *buf, MYSQL_ROW row,
+ uint convert_row_to_internal_format(uchar *buf, MYSQL_ROW row,
MYSQL_RES *result);
bool create_where_from_key(String *to, KEY *key_info,
const key_range *start_key,
@@ -188,15 +188,15 @@ public:
int open(const char *name, int mode, uint test_if_locked); // required
int close(void); // required
- int write_row(byte *buf);
- int update_row(const byte *old_data, byte *new_data);
- int delete_row(const byte *buf);
+ int write_row(uchar *buf);
+ int update_row(const uchar *old_data, uchar *new_data);
+ int delete_row(const uchar *buf);
int index_init(uint keynr, bool sorted);
- int index_read(byte *buf, const byte *key,
+ int index_read(uchar *buf, const uchar *key,
uint key_len, enum ha_rkey_function find_flag);
- int index_read_idx(byte *buf, uint idx, const byte *key,
+ int index_read_idx(uchar *buf, uint idx, const uchar *key,
uint key_len, enum ha_rkey_function find_flag);
- int index_next(byte *buf);
+ int index_next(uchar *buf);
int index_end();
int read_range_first(const key_range *start_key,
const key_range *end_key,
@@ -212,9 +212,9 @@ public:
*/
int rnd_init(bool scan); //required
int rnd_end();
- int rnd_next(byte *buf); //required
- int rnd_pos(byte *buf, byte *pos); //required
- void position(const byte *record); //required
+ int rnd_next(uchar *buf); //required
+ int rnd_pos(uchar *buf, uchar *pos); //required
+ void position(const uchar *record); //required
int info(uint); //required
void update_auto_increment(void);
@@ -237,9 +237,9 @@ public:
int connection_autocommit(bool state);
int execute_simple_query(const char *query, int len);
- int read_next(byte *buf, MYSQL_RES *result);
- int index_read_idx_with_result_set(byte *buf, uint index,
- const byte *key,
+ int read_next(uchar *buf, MYSQL_RES *result);
+ int index_read_idx_with_result_set(uchar *buf, uint index,
+ const uchar *key,
uint key_len,
ha_rkey_function find_flag,
MYSQL_RES **result);
diff --git a/storage/heap/CMakeLists.txt b/storage/heap/CMakeLists.txt
index 39953684b8f..f4732397cc4 100644
--- a/storage/heap/CMakeLists.txt
+++ b/storage/heap/CMakeLists.txt
@@ -15,6 +15,9 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+IF(EMBEDDED_ONLY)
+ ADD_DEFINITIONS(-DUSE_TLS)
+ENDIF(EMBEDDED_ONLY)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/sql
diff --git a/storage/heap/_check.c b/storage/heap/_check.c
index 05f12dade0d..08b6da62ae1 100644
--- a/storage/heap/_check.c
+++ b/storage/heap/_check.c
@@ -167,7 +167,7 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
HP_KEYDEF *keydef= info->s->keydef + keynr;
int error= 0;
ulong found= 0;
- byte *key, *recpos;
+ uchar *key, *recpos;
uint key_length;
uint not_used[2];
@@ -176,7 +176,7 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
{
do
{
- memcpy(&recpos, key + (*keydef->get_key_length)(keydef,key), sizeof(byte*));
+ memcpy(&recpos, key + (*keydef->get_key_length)(keydef,key), sizeof(uchar*));
key_length= hp_rb_make_key(keydef, info->recbuf, recpos, 0);
if (ha_key_cmp(keydef->seg, (uchar*) info->recbuf, (uchar*) key,
key_length, SEARCH_FIND | SEARCH_SAME, not_used))
diff --git a/storage/heap/_rectest.c b/storage/heap/_rectest.c
index 2fd2d39bed7..068fedf719c 100644
--- a/storage/heap/_rectest.c
+++ b/storage/heap/_rectest.c
@@ -18,7 +18,7 @@
#include "heapdef.h"
-int hp_rectest(register HP_INFO *info, register const byte *old)
+int hp_rectest(register HP_INFO *info, register const uchar *old)
{
DBUG_ENTER("hp_rectest");
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index 096b0f63b5e..86bc2cc516e 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -178,7 +178,7 @@ void ha_heap::update_key_stats()
}
-int ha_heap::write_row(byte * buf)
+int ha_heap::write_row(uchar * buf)
{
int res;
ha_statistic_increment(&SSV::ha_write_count);
@@ -202,7 +202,7 @@ int ha_heap::write_row(byte * buf)
return res;
}
-int ha_heap::update_row(const byte * old_data, byte * new_data)
+int ha_heap::update_row(const uchar * old_data, uchar * new_data)
{
int res;
ha_statistic_increment(&SSV::ha_update_count);
@@ -221,7 +221,7 @@ int ha_heap::update_row(const byte * old_data, byte * new_data)
return res;
}
-int ha_heap::delete_row(const byte * buf)
+int ha_heap::delete_row(const uchar * buf)
{
int res;
ha_statistic_increment(&SSV::ha_delete_count);
@@ -238,7 +238,7 @@ int ha_heap::delete_row(const byte * buf)
return res;
}
-int ha_heap::index_read(byte * buf, const byte * key, key_part_map keypart_map,
+int ha_heap::index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
@@ -248,7 +248,7 @@ int ha_heap::index_read(byte * buf, const byte * key, key_part_map keypart_map,
return error;
}
-int ha_heap::index_read_last(byte *buf, const byte *key, key_part_map keypart_map)
+int ha_heap::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_key_count);
@@ -258,7 +258,7 @@ int ha_heap::index_read_last(byte *buf, const byte *key, key_part_map keypart_ma
return error;
}
-int ha_heap::index_read_idx(byte * buf, uint index, const byte * key,
+int ha_heap::index_read_idx(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -268,7 +268,7 @@ int ha_heap::index_read_idx(byte * buf, uint index, const byte * key,
return error;
}
-int ha_heap::index_next(byte * buf)
+int ha_heap::index_next(uchar * buf)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_next_count);
@@ -277,7 +277,7 @@ int ha_heap::index_next(byte * buf)
return error;
}
-int ha_heap::index_prev(byte * buf)
+int ha_heap::index_prev(uchar * buf)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_prev_count);
@@ -286,7 +286,7 @@ int ha_heap::index_prev(byte * buf)
return error;
}
-int ha_heap::index_first(byte * buf)
+int ha_heap::index_first(uchar * buf)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_first_count);
@@ -295,7 +295,7 @@ int ha_heap::index_first(byte * buf)
return error;
}
-int ha_heap::index_last(byte * buf)
+int ha_heap::index_last(uchar * buf)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_last_count);
@@ -309,7 +309,7 @@ int ha_heap::rnd_init(bool scan)
return scan ? heap_scan_init(file) : 0;
}
-int ha_heap::rnd_next(byte *buf)
+int ha_heap::rnd_next(uchar *buf)
{
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=heap_scan(file, buf);
@@ -317,7 +317,7 @@ int ha_heap::rnd_next(byte *buf)
return error;
}
-int ha_heap::rnd_pos(byte * buf, byte *pos)
+int ha_heap::rnd_pos(uchar * buf, uchar *pos)
{
int error;
HEAP_PTR heap_position;
@@ -328,7 +328,7 @@ int ha_heap::rnd_pos(byte * buf, byte *pos)
return error;
}
-void ha_heap::position(const byte *record)
+void ha_heap::position(const uchar *record)
{
*(HEAP_PTR*) ref= heap_position(file); // Ref is aligned
}
@@ -668,7 +668,7 @@ int ha_heap::create(const char *name, TABLE *table_arg,
share->max_rows) ?
share->max_rows : max_rows),
(ulong) share->min_rows, &hp_create_info);
- my_free((gptr) keydef, MYF(0));
+ my_free((uchar*) keydef, MYF(0));
if (file)
info(HA_STATUS_NO_LOCK | HA_STATUS_CONST | HA_STATUS_VARIABLE);
return (error);
diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h
index a2d531fc515..c93a33b524b 100644
--- a/storage/heap/ha_heap.h
+++ b/storage/heap/ha_heap.h
@@ -68,26 +68,26 @@ public:
int open(const char *name, int mode, uint test_if_locked);
int close(void);
void set_keys_for_scanning(void);
- int write_row(byte * buf);
- int update_row(const byte * old_data, byte * new_data);
- int delete_row(const byte * buf);
+ int write_row(uchar * buf);
+ int update_row(const uchar * old_data, uchar * new_data);
+ int delete_row(const uchar * buf);
virtual void get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values,
ulonglong *first_value,
ulonglong *nb_reserved_values);
- int index_read(byte * buf, const byte * key, key_part_map keypart_map,
+ int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
enum ha_rkey_function find_flag);
- int index_read_last(byte *buf, const byte *key, key_part_map keypart_map);
- int index_read_idx(byte * buf, uint index, const byte * key,
+ int index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map);
+ int index_read_idx(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_next(byte * buf);
- int index_prev(byte * buf);
- int index_first(byte * buf);
- int index_last(byte * buf);
+ int index_next(uchar * buf);
+ int index_prev(uchar * buf);
+ int index_first(uchar * buf);
+ int index_last(uchar * buf);
int rnd_init(bool scan);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
- void position(const byte *record);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
+ void position(const uchar *record);
int info(uint);
int extra(enum ha_extra_function operation);
int reset();
@@ -105,7 +105,7 @@ public:
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type);
- int cmp_ref(const byte *ref1, const byte *ref2)
+ int cmp_ref(const uchar *ref1, const uchar *ref2)
{
HEAP_PTR ptr1=*(HEAP_PTR*)ref1;
HEAP_PTR ptr2=*(HEAP_PTR*)ref2;
diff --git a/storage/heap/heapdef.h b/storage/heap/heapdef.h
index b52a6c60ac6..c43d73eb96d 100644
--- a/storage/heap/heapdef.h
+++ b/storage/heap/heapdef.h
@@ -48,7 +48,7 @@ if (!(info->update & HA_STATE_AKTIV))\
typedef struct st_hp_hash_info
{
struct st_hp_hash_info *next_key;
- byte *ptr_to_rec;
+ uchar *ptr_to_rec;
} HASH_INFO;
typedef struct {
@@ -60,42 +60,42 @@ typedef struct {
/* Prototypes for intern functions */
extern HP_SHARE *hp_find_named_heap(const char *name);
-extern int hp_rectest(HP_INFO *info,const byte *old);
-extern byte *hp_find_block(HP_BLOCK *info,ulong pos);
-extern int hp_get_new_block(HP_BLOCK *info, ulong* alloc_length);
+extern int hp_rectest(HP_INFO *info,const uchar *old);
+extern uchar *hp_find_block(HP_BLOCK *info,ulong pos);
+extern int hp_get_new_block(HP_BLOCK *info, size_t* alloc_length);
extern void hp_free(HP_SHARE *info);
-extern byte *hp_free_level(HP_BLOCK *block,uint level,HP_PTRS *pos,
- byte *last_pos);
+extern uchar *hp_free_level(HP_BLOCK *block,uint level,HP_PTRS *pos,
+ uchar *last_pos);
extern int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
- const byte *record, byte *recpos);
+ const uchar *record, uchar *recpos);
extern int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
- const byte *record, byte *recpos);
+ const uchar *record, uchar *recpos);
extern int hp_rb_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo,
- const byte *record,byte *recpos,int flag);
+ const uchar *record,uchar *recpos,int flag);
extern int hp_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo,
- const byte *record,byte *recpos,int flag);
+ const uchar *record,uchar *recpos,int flag);
extern HASH_INFO *_heap_find_hash(HP_BLOCK *block,ulong pos);
-extern byte *hp_search(HP_INFO *info,HP_KEYDEF *keyinfo,const byte *key,
+extern uchar *hp_search(HP_INFO *info,HP_KEYDEF *keyinfo,const uchar *key,
uint nextflag);
-extern byte *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo,
- const byte *key, HASH_INFO *pos);
-extern ulong hp_hashnr(HP_KEYDEF *keyinfo,const byte *key);
-extern ulong hp_rec_hashnr(HP_KEYDEF *keyinfo,const byte *rec);
+extern uchar *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo,
+ const uchar *key, HASH_INFO *pos);
+extern ulong hp_hashnr(HP_KEYDEF *keyinfo,const uchar *key);
+extern ulong hp_rec_hashnr(HP_KEYDEF *keyinfo,const uchar *rec);
extern ulong hp_mask(ulong hashnr,ulong buffmax,ulong maxlength);
extern void hp_movelink(HASH_INFO *pos,HASH_INFO *next_link,
HASH_INFO *newlink);
-extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const byte *rec1,
- const byte *rec2,
+extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const uchar *rec1,
+ const uchar *rec2,
my_bool diff_if_only_endspace_difference);
-extern int hp_key_cmp(HP_KEYDEF *keydef,const byte *rec,
- const byte *key);
-extern void hp_make_key(HP_KEYDEF *keydef,byte *key,const byte *rec);
-extern uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
- const byte *rec, byte *recpos);
-extern uint hp_rb_key_length(HP_KEYDEF *keydef, const byte *key);
-extern uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key);
-extern uint hp_rb_var_key_length(HP_KEYDEF *keydef, const byte *key);
-extern my_bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const byte *record);
+extern int hp_key_cmp(HP_KEYDEF *keydef,const uchar *rec,
+ const uchar *key);
+extern void hp_make_key(HP_KEYDEF *keydef,uchar *key,const uchar *rec);
+extern uint hp_rb_make_key(HP_KEYDEF *keydef, uchar *key,
+ const uchar *rec, uchar *recpos);
+extern uint hp_rb_key_length(HP_KEYDEF *keydef, const uchar *key);
+extern uint hp_rb_null_key_length(HP_KEYDEF *keydef, const uchar *key);
+extern uint hp_rb_var_key_length(HP_KEYDEF *keydef, const uchar *key);
+extern my_bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const uchar *record);
extern int hp_close(register HP_INFO *info);
extern void hp_clear(HP_SHARE *info);
extern void hp_clear_keys(HP_SHARE *info);
diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c
index 85219380287..c622a9e52f8 100644
--- a/storage/heap/hp_block.c
+++ b/storage/heap/hp_block.c
@@ -26,7 +26,7 @@
{p_0, p_1, ...} serve as indexes to descend the blocks tree.
*/
-byte *hp_find_block(HP_BLOCK *block, ulong pos)
+uchar *hp_find_block(HP_BLOCK *block, ulong pos)
{
reg1 int i;
reg3 HP_PTRS *ptr; /* block base ptr */
@@ -36,12 +36,13 @@ byte *hp_find_block(HP_BLOCK *block, ulong pos)
ptr=(HP_PTRS*)ptr->blocks[pos/block->level_info[i].records_under_level];
pos%=block->level_info[i].records_under_level;
}
- return (byte*) ptr+ pos*block->recbuffer;
+ return (uchar*) ptr+ pos*block->recbuffer;
}
/*
Get one new block-of-records. Alloc ptr to block if needed
+
SYNOPSIS
hp_get_new_block()
block HP_BLOCK tree-like block
@@ -53,7 +54,7 @@ byte *hp_find_block(HP_BLOCK *block, ulong pos)
1 Out of memory
*/
-int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
+int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length)
{
reg1 uint i,j;
HP_PTRS *root;
@@ -101,13 +102,13 @@ int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
/* Occupy the free slot we've found at level i */
block->level_info[i].last_blocks->
blocks[HP_PTRS_IN_NOD - block->level_info[i].free_ptrs_in_block--]=
- (byte*) root;
+ (uchar*) root;
/* Add a block subtree with each node having one left-most child */
for (j=i-1 ; j >0 ; j--)
{
block->level_info[j].last_blocks= root++;
- block->level_info[j].last_blocks->blocks[0]=(byte*) root;
+ block->level_info[j].last_blocks->blocks[0]=(uchar*) root;
block->level_info[j].free_ptrs_in_block=HP_PTRS_IN_NOD-1;
}
@@ -124,27 +125,27 @@ int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
/* free all blocks under level */
-byte *hp_free_level(HP_BLOCK *block, uint level, HP_PTRS *pos, byte *last_pos)
+uchar *hp_free_level(HP_BLOCK *block, uint level, HP_PTRS *pos, uchar *last_pos)
{
int i,max_pos;
- byte *next_ptr;
+ uchar *next_ptr;
if (level == 1)
- next_ptr=(byte*) pos+block->recbuffer;
+ next_ptr=(uchar*) pos+block->recbuffer;
else
{
max_pos= (block->level_info[level-1].last_blocks == pos) ?
HP_PTRS_IN_NOD - block->level_info[level-1].free_ptrs_in_block :
HP_PTRS_IN_NOD;
- next_ptr=(byte*) (pos+1);
+ next_ptr=(uchar*) (pos+1);
for (i=0 ; i < max_pos ; i++)
next_ptr=hp_free_level(block,level-1,
(HP_PTRS*) pos->blocks[i],next_ptr);
}
- if ((byte*) pos != last_pos)
+ if ((uchar*) pos != last_pos)
{
- my_free((gptr) pos,MYF(0));
+ my_free((uchar*) pos,MYF(0));
return last_pos;
}
return next_ptr; /* next memory position */
diff --git a/storage/heap/hp_clear.c b/storage/heap/hp_clear.c
index 2d8b8b394d5..babfcbd6f41 100644
--- a/storage/heap/hp_clear.c
+++ b/storage/heap/hp_clear.c
@@ -32,7 +32,7 @@ void hp_clear(HP_SHARE *info)
if (info->block.levels)
VOID(hp_free_level(&info->block,info->block.levels,info->block.root,
- (byte*) 0));
+ (uchar*) 0));
info->block.levels=0;
hp_clear_keys(info);
info->records= info->deleted= 0;
@@ -94,7 +94,7 @@ void hp_clear_keys(HP_SHARE *info)
{
HP_BLOCK *block= &keyinfo->block;
if (block->levels)
- VOID(hp_free_level(block,block->levels,block->root,(byte*) 0));
+ VOID(hp_free_level(block,block->levels,block->root,(uchar*) 0));
block->levels=0;
block->last_allocated=0;
keyinfo->hash_buckets= 0;
diff --git a/storage/heap/hp_close.c b/storage/heap/hp_close.c
index 5f6fc3249b5..79fed859487 100644
--- a/storage/heap/hp_close.c
+++ b/storage/heap/hp_close.c
@@ -45,6 +45,6 @@ int hp_close(register HP_INFO *info)
heap_open_list=list_delete(heap_open_list,&info->open_list);
if (!--info->s->open_count && info->s->delete_on_close)
hp_free(info->s); /* Table was deleted */
- my_free((gptr) info,MYF(0));
+ my_free((uchar*) info,MYF(0));
DBUG_RETURN(error);
}
diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c
index 4e1347966b9..b910b89ffcd 100644
--- a/storage/heap/hp_create.c
+++ b/storage/heap/hp_create.c
@@ -42,10 +42,10 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
DBUG_PRINT("info",("Initializing new table"));
/*
- We have to store sometimes byte* del_link in records,
- so the record length should be at least sizeof(byte*)
+ We have to store sometimes uchar* del_link in records,
+ so the record length should be at least sizeof(uchar*)
*/
- set_if_bigger(reclength, sizeof (byte*));
+ set_if_bigger(reclength, sizeof (uchar*));
for (i= key_segs= max_length= 0, keyinfo= keydef; i < keys; i++, keyinfo++)
{
@@ -112,7 +112,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
}
keyinfo->length= length;
length+= keyinfo->rb_tree.size_of_element +
- ((keyinfo->algorithm == HA_KEY_ALG_BTREE) ? sizeof(byte*) : 0);
+ ((keyinfo->algorithm == HA_KEY_ALG_BTREE) ? sizeof(uchar*) : 0);
if (length > max_length)
max_length= length;
key_segs+= keyinfo->keysegs;
@@ -152,12 +152,12 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
{
/* additional HA_KEYTYPE_END keyseg */
keyseg->type= HA_KEYTYPE_END;
- keyseg->length= sizeof(byte*);
+ keyseg->length= sizeof(uchar*);
keyseg->flag= 0;
keyseg->null_bit= 0;
keyseg++;
- init_tree(&keyinfo->rb_tree, 0, 0, sizeof(byte*),
+ init_tree(&keyinfo->rb_tree, 0, 0, sizeof(uchar*),
(qsort_cmp2)keys_compare, 1, NULL, NULL);
keyinfo->delete_key= hp_rb_delete_key;
keyinfo->write_key= hp_rb_write_key;
@@ -188,7 +188,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
/* Must be allocated separately for rename to work */
if (!(share->name= my_strdup(name,MYF(0))))
{
- my_free((gptr) share,MYF(0));
+ my_free((uchar*) share,MYF(0));
pthread_mutex_unlock(&THR_LOCK_heap);
DBUG_RETURN(1);
}
@@ -218,7 +218,7 @@ static void init_block(HP_BLOCK *block, uint reclength, ulong min_records,
max_records= max(min_records,max_records);
if (!max_records)
max_records= 1000; /* As good as quess as anything */
- recbuffer= (uint) (reclength + sizeof(byte**) - 1) & ~(sizeof(byte**) - 1);
+ recbuffer= (uint) (reclength + sizeof(uchar**) - 1) & ~(sizeof(uchar**) - 1);
records_in_block= max_records / 10;
if (records_in_block < 10 && max_records)
records_in_block= 10;
@@ -285,7 +285,7 @@ void hp_free(HP_SHARE *share)
thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->intern_lock));
#endif
- my_free((gptr) share->name, MYF(0));
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share->name, MYF(0));
+ my_free((uchar*) share, MYF(0));
return;
}
diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c
index 637e5f1a497..1dd79a42e0b 100644
--- a/storage/heap/hp_delete.c
+++ b/storage/heap/hp_delete.c
@@ -17,9 +17,9 @@
#include "heapdef.h"
-int heap_delete(HP_INFO *info, const byte *record)
+int heap_delete(HP_INFO *info, const uchar *record)
{
- byte *pos;
+ uchar *pos;
HP_SHARE *share=info->s;
HP_KEYDEF *keydef, *end, *p_lastinx;
DBUG_ENTER("heap_delete");
@@ -43,7 +43,7 @@ int heap_delete(HP_INFO *info, const byte *record)
}
info->update=HA_STATE_DELETED;
- *((byte**) pos)=share->del_link;
+ *((uchar**) pos)=share->del_link;
share->del_link=pos;
pos[share->reclength]=0; /* Record deleted */
share->deleted++;
@@ -65,7 +65,7 @@ err:
*/
int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
- const byte *record, byte *recpos, int flag)
+ const uchar *record, uchar *recpos, int flag)
{
heap_rb_param custom_arg;
uint old_allocated;
@@ -105,7 +105,7 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
*/
int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
- const byte *record, byte *recpos, int flag)
+ const uchar *record, uchar *recpos, int flag)
{
ulong blength,pos2,pos_hashnr,lastpos_hashnr;
HASH_INFO *lastpos,*gpos,*pos,*pos3,*empty,*last_ptr;
diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c
index fbf3e541372..aaaa0fe833f 100644
--- a/storage/heap/hp_hash.c
+++ b/storage/heap/hp_hash.c
@@ -97,7 +97,7 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key,
/* Sets info->current_ptr to found record */
/* next_flag: Search=0, next=1, prev =2, same =3 */
-byte *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key,
+uchar *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *key,
uint nextflag)
{
reg1 HASH_INFO *pos,*prev_ptr;
@@ -175,7 +175,7 @@ byte *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key,
since last read !
*/
-byte *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key,
+uchar *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *key,
HASH_INFO *pos)
{
DBUG_ENTER("hp_search_next");
@@ -238,7 +238,7 @@ void hp_movelink(HASH_INFO *pos, HASH_INFO *next_link, HASH_INFO *newlink)
/* Calc hashvalue for a key */
-ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
+ulong hp_hashnr(register HP_KEYDEF *keydef, register const uchar *key)
{
/*register*/
ulong nr=1, nr2=4;
@@ -304,7 +304,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
/* Calc hashvalue for a key in a record */
-ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
+ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
{
ulong nr=1, nr2=4;
HA_KEYSEG *seg,*endseg;
@@ -377,9 +377,15 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
* far, and works well on both numbers and strings.
*/
-ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
+ulong hp_hashnr(register HP_KEYDEF *keydef, register const uchar *key)
{
- register ulong nr=0;
+ /*
+ Note, if a key consists of a combination of numeric and
+ a text columns, it most likely won't work well.
+ Making text columns work with NEW_HASH_FUNCTION
+ needs also changes in strings/ctype-xxx.c.
+ */
+ ulong nr= 1, nr2= 4;
HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
@@ -401,14 +407,15 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
}
if (seg->type == HA_KEYTYPE_TEXT)
{
- seg->charset->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,NULL);
+ seg->charset->coll->hash_sort(seg->charset, pos, ((uchar*)key)-pos,
+ &nr, &nr2);
}
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
{
uint pack_length= 2; /* Key packing is constant */
uint length= uint2korr(pos);
- seg->charset->hash_sort(seg->charset, pos+pack_length, length, &nr,
- NULL);
+ seg->charset->coll->hash_sort(seg->charset, pos+pack_length, length,
+ &nr, &nr2);
key+= pack_length;
}
else
@@ -426,9 +433,9 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
/* Calc hashvalue for a key in a record */
-ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
+ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
{
- register ulong nr=0;
+ ulong nr= 1, nr2= 4;
HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
@@ -444,14 +451,16 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
}
if (seg->type == HA_KEYTYPE_TEXT)
{
- seg->charset->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,NULL);
+ uint char_length= seg->length; /* TODO: fix to use my_charpos() */
+ seg->charset->coll->hash_sort(seg->charset, pos, char_length,
+ &nr, &nr2);
}
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
{
uint pack_length= seg->bit_start;
uint length= (pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos));
- seg->charset->hash_sort(seg->charset, pos+pack_length,
- length, &nr, NULL);
+ seg->charset->coll->hash_sort(seg->charset, pos+pack_length,
+ length, &nr, &nr2);
}
else
{
@@ -490,7 +499,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
<> 0 Key differes
*/
-int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2,
+int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2,
my_bool diff_if_only_endspace_difference)
{
HA_KEYSEG *seg,*endseg;
@@ -577,7 +586,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2,
/* Compare a key in a record to a whole key */
-int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
+int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
{
HA_KEYSEG *seg,*endseg;
@@ -661,7 +670,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
/* Copy a key from a record to a keybuffer */
-void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec)
+void hp_make_key(HP_KEYDEF *keydef, uchar *key, const uchar *rec)
{
HA_KEYSEG *seg,*endseg;
@@ -693,10 +702,10 @@ void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec)
} while(0)
-uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
- const byte *rec, byte *recpos)
+uint hp_rb_make_key(HP_KEYDEF *keydef, uchar *key,
+ const uchar *rec, uchar *recpos)
{
- byte *start_key= key;
+ uchar *start_key= key;
HA_KEYSEG *seg, *endseg;
for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++)
@@ -710,7 +719,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
if (seg->flag & HA_SWAP_KEY)
{
uint length= seg->length;
- byte *pos= (byte*) rec + seg->start;
+ uchar *pos= (uchar*) rec + seg->start;
#ifdef HAVE_ISNAN
if (seg->type == HA_KEYTYPE_FLOAT)
@@ -759,7 +768,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
set_if_smaller(length,tmp_length);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key,(byte*) pos,(size_t) char_length);
+ memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
key+= char_length;
continue;
}
@@ -778,7 +787,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
memcpy(key, rec + seg->start, (size_t) char_length);
key+= seg->length;
}
- memcpy(key, &recpos, sizeof(byte*));
+ memcpy(key, &recpos, sizeof(uchar*));
return (uint) (key - start_key);
}
@@ -802,7 +811,7 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
if (seg->flag & HA_SWAP_KEY)
{
uint length= seg->length;
- byte *pos= (byte*) old + length;
+ uchar *pos= (uchar*) old + length;
while (length--)
{
@@ -822,7 +831,7 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
set_if_smaller(length,tmp_length); /* Safety */
FIX_LENGTH(cs, old, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key, old,(size_t) char_length);
+ memcpy((uchar*) key, old,(size_t) char_length);
key+= char_length;
continue;
}
@@ -844,15 +853,15 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
uint hp_rb_key_length(HP_KEYDEF *keydef,
- const byte *key __attribute__((unused)))
+ const uchar *key __attribute__((unused)))
{
return keydef->length;
}
-uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key)
+uint hp_rb_null_key_length(HP_KEYDEF *keydef, const uchar *key)
{
- const byte *start_key= key;
+ const uchar *start_key= key;
HA_KEYSEG *seg, *endseg;
for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++)
@@ -865,9 +874,9 @@ uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key)
}
-uint hp_rb_var_key_length(HP_KEYDEF *keydef, const byte *key)
+uint hp_rb_var_key_length(HP_KEYDEF *keydef, const uchar *key)
{
- const byte *start_key= key;
+ const uchar *start_key= key;
HA_KEYSEG *seg, *endseg;
for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++)
@@ -892,7 +901,7 @@ uint hp_rb_var_key_length(HP_KEYDEF *keydef, const byte *key)
0 otherwise
*/
-my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const byte *record)
+my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const uchar *record)
{
HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
@@ -918,7 +927,7 @@ my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const byte *record)
less than zero.
*/
-void heap_update_auto_increment(HP_INFO *info, const byte *record)
+void heap_update_auto_increment(HP_INFO *info, const uchar *record)
{
ulonglong value= 0; /* Store unsigned values here */
longlong s_value= 0; /* Store signed values here */
diff --git a/storage/heap/hp_info.c b/storage/heap/hp_info.c
index 2c58604eed1..ea78c53fd40 100644
--- a/storage/heap/hp_info.c
+++ b/storage/heap/hp_info.c
@@ -18,7 +18,7 @@
#include "heapdef.h"
-byte *heap_position(HP_INFO *info)
+uchar *heap_position(HP_INFO *info)
{
return ((info->update & HA_STATE_AKTIV) ? info->current_ptr :
(HEAP_PTR) 0);
diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c
index 02a8d4f95ca..d252704a11b 100644
--- a/storage/heap/hp_open.c
+++ b/storage/heap/hp_open.c
@@ -51,8 +51,8 @@ HP_INFO *heap_open(const char *name, int mode)
pthread_mutex_unlock(&THR_LOCK_heap);
info->s= share;
- info->lastkey= (byte*) (info + 1);
- info->recbuf= (byte*) (info->lastkey + share->max_key_length);
+ info->lastkey= (uchar*) (info + 1);
+ info->recbuf= (uchar*) (info->lastkey + share->max_key_length);
info->mode= mode;
info->current_record= (ulong) ~0L; /* No current record */
info->current_ptr= 0;
diff --git a/storage/heap/hp_rfirst.c b/storage/heap/hp_rfirst.c
index d1842949421..48c1e625bd8 100644
--- a/storage/heap/hp_rfirst.c
+++ b/storage/heap/hp_rfirst.c
@@ -17,7 +17,7 @@
/* Read first record with the current key */
-int heap_rfirst(HP_INFO *info, byte *record, int inx)
+int heap_rfirst(HP_INFO *info, uchar *record, int inx)
{
HP_SHARE *share = info->s;
HP_KEYDEF *keyinfo = share->keydef + inx;
@@ -26,13 +26,13 @@ int heap_rfirst(HP_INFO *info, byte *record, int inx)
info->lastinx= inx;
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
{
- byte *pos;
+ uchar *pos;
if ((pos = tree_search_edge(&keyinfo->rb_tree, info->parents,
&info->last_pos, offsetof(TREE_ELEMENT, left))))
{
memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
- sizeof(byte*));
+ sizeof(uchar*));
info->current_ptr = pos;
memcpy(record, pos, (size_t)share->reclength);
info->update = HA_STATE_AKTIV;
diff --git a/storage/heap/hp_rkey.c b/storage/heap/hp_rkey.c
index ced81985f99..6eeac6acd7b 100644
--- a/storage/heap/hp_rkey.c
+++ b/storage/heap/hp_rkey.c
@@ -15,10 +15,10 @@
#include "heapdef.h"
-int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
+int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function find_flag)
{
- byte *pos;
+ uchar *pos;
HP_SHARE *share= info->s;
HP_KEYDEF *keyinfo= share->keydef + inx;
DBUG_ENTER("heap_rkey");
@@ -53,7 +53,7 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
info->update= 0;
DBUG_RETURN(my_errno= HA_ERR_KEY_NOT_FOUND);
}
- memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(byte*));
+ memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(uchar*));
info->current_ptr= pos;
}
else
@@ -74,7 +74,7 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
/* Quick find of record */
-gptr heap_find(HP_INFO *info, int inx, const byte *key)
+uchar* heap_find(HP_INFO *info, int inx, const uchar *key)
{
return hp_search(info, info->s->keydef + inx, key, 0);
}
diff --git a/storage/heap/hp_rlast.c b/storage/heap/hp_rlast.c
index b72e815147f..45ad7c21f49 100644
--- a/storage/heap/hp_rlast.c
+++ b/storage/heap/hp_rlast.c
@@ -18,7 +18,7 @@
/* Read first record with the current key */
-int heap_rlast(HP_INFO *info, byte *record, int inx)
+int heap_rlast(HP_INFO *info, uchar *record, int inx)
{
HP_SHARE *share= info->s;
HP_KEYDEF *keyinfo= share->keydef + inx;
@@ -27,13 +27,13 @@ int heap_rlast(HP_INFO *info, byte *record, int inx)
info->lastinx= inx;
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
{
- byte *pos;
+ uchar *pos;
if ((pos = tree_search_edge(&keyinfo->rb_tree, info->parents,
&info->last_pos, offsetof(TREE_ELEMENT, right))))
{
memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
- sizeof(byte*));
+ sizeof(uchar*));
info->current_ptr = pos;
memcpy(record, pos, (size_t)share->reclength);
info->update = HA_STATE_AKTIV;
diff --git a/storage/heap/hp_rnext.c b/storage/heap/hp_rnext.c
index 3b436fe87aa..262754e9e64 100644
--- a/storage/heap/hp_rnext.c
+++ b/storage/heap/hp_rnext.c
@@ -17,9 +17,9 @@
/* Read next record with the same key */
-int heap_rnext(HP_INFO *info, byte *record)
+int heap_rnext(HP_INFO *info, uchar *record)
{
- byte *pos;
+ uchar *pos;
HP_SHARE *share=info->s;
HP_KEYDEF *keyinfo;
DBUG_ENTER("heap_rnext");
@@ -47,7 +47,7 @@ int heap_rnext(HP_INFO *info, byte *record)
if (pos)
{
memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
- sizeof(byte*));
+ sizeof(uchar*));
info->current_ptr = pos;
}
else
diff --git a/storage/heap/hp_rprev.c b/storage/heap/hp_rprev.c
index bfdd2f9d47a..63bfffffba9 100644
--- a/storage/heap/hp_rprev.c
+++ b/storage/heap/hp_rprev.c
@@ -18,9 +18,9 @@
/* Read prev record for key */
-int heap_rprev(HP_INFO *info, byte *record)
+int heap_rprev(HP_INFO *info, uchar *record)
{
- byte *pos;
+ uchar *pos;
HP_SHARE *share=info->s;
HP_KEYDEF *keyinfo;
DBUG_ENTER("heap_rprev");
@@ -47,7 +47,7 @@ int heap_rprev(HP_INFO *info, byte *record)
if (pos)
{
memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
- sizeof(byte*));
+ sizeof(uchar*));
info->current_ptr = pos;
}
else
diff --git a/storage/heap/hp_rrnd.c b/storage/heap/hp_rrnd.c
index ad0190cc00c..3ac23d293f2 100644
--- a/storage/heap/hp_rrnd.c
+++ b/storage/heap/hp_rrnd.c
@@ -24,7 +24,7 @@
HA_ERR_END_OF_FILE = EOF.
*/
-int heap_rrnd(register HP_INFO *info, byte *record, byte *pos)
+int heap_rrnd(register HP_INFO *info, uchar *record, uchar *pos)
{
HP_SHARE *share=info->s;
DBUG_ENTER("heap_rrnd");
@@ -59,7 +59,7 @@ int heap_rrnd(register HP_INFO *info, byte *record, byte *pos)
HA_ERR_END_OF_FILE = EOF.
*/
-int heap_rrnd_old(register HP_INFO *info, byte *record, ulong pos)
+int heap_rrnd_old(register HP_INFO *info, uchar *record, ulong pos)
{
HP_SHARE *share=info->s;
DBUG_ENTER("heap_rrnd");
diff --git a/storage/heap/hp_rsame.c b/storage/heap/hp_rsame.c
index 10513f91726..1a3724672b6 100644
--- a/storage/heap/hp_rsame.c
+++ b/storage/heap/hp_rsame.c
@@ -25,7 +25,7 @@
HA_ERR_KEY_NOT_FOUND = Record not found with key
*/
-int heap_rsame(register HP_INFO *info, byte *record, int inx)
+int heap_rsame(register HP_INFO *info, uchar *record, int inx)
{
HP_SHARE *share=info->s;
DBUG_ENTER("heap_rsame");
diff --git a/storage/heap/hp_scan.c b/storage/heap/hp_scan.c
index 4249ac4148a..e8913e92c86 100644
--- a/storage/heap/hp_scan.c
+++ b/storage/heap/hp_scan.c
@@ -34,7 +34,7 @@ int heap_scan_init(register HP_INFO *info)
DBUG_RETURN(0);
}
-int heap_scan(register HP_INFO *info, byte *record)
+int heap_scan(register HP_INFO *info, uchar *record)
{
HP_SHARE *share=info->s;
ulong pos;
diff --git a/storage/heap/hp_test1.c b/storage/heap/hp_test1.c
index 31c9b8f2f30..aad5677db69 100644
--- a/storage/heap/hp_test1.c
+++ b/storage/heap/hp_test1.c
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
keyinfo[0].flag = HA_NOSAME;
deleted=0;
- bzero((gptr) flags,sizeof(flags));
+ bzero((uchar*) flags,sizeof(flags));
printf("- Creating heap-file\n");
if (heap_create(filename,1,keyinfo,30,(ulong) flag*100000L,10L,
diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c
index dcca5fb44b9..46b1fd61d46 100644
--- a/storage/heap/hp_test2.c
+++ b/storage/heap/hp_test2.c
@@ -42,7 +42,7 @@ static my_bool key3[MAX_RECORDS];
static int reclength=39;
-static int calc_check(byte *buf,uint length);
+static int calc_check(uchar *buf,uint length);
static void make_record(char *record, uint n1, uint n2, uint n3,
const char *mark, uint count);
@@ -674,7 +674,7 @@ static sig_handler endprog(int sig_number __attribute__((unused)))
}
}
-static int calc_check(byte *buf, uint length)
+static int calc_check(uchar *buf, uint length)
{
int check=0;
while (length--)
diff --git a/storage/heap/hp_update.c b/storage/heap/hp_update.c
index e7314e3d38c..11dca974ad4 100644
--- a/storage/heap/hp_update.c
+++ b/storage/heap/hp_update.c
@@ -17,10 +17,10 @@
#include "heapdef.h"
-int heap_update(HP_INFO *info, const byte *old, const byte *heap_new)
+int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
{
HP_KEYDEF *keydef, *end, *p_lastinx;
- byte *pos;
+ uchar *pos;
bool auto_key_changed= 0;
HP_SHARE *share= info->s;
DBUG_ENTER("heap_update");
diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c
index 19215fcf017..2abef2d9b43 100644
--- a/storage/heap/hp_write.c
+++ b/storage/heap/hp_write.c
@@ -25,14 +25,14 @@
#define HIGHFIND 4
#define HIGHUSED 8
-static byte *next_free_record_pos(HP_SHARE *info);
+static uchar *next_free_record_pos(HP_SHARE *info);
static HASH_INFO *hp_find_free_hash(HP_SHARE *info, HP_BLOCK *block,
ulong records);
-int heap_write(HP_INFO *info, const byte *record)
+int heap_write(HP_INFO *info, const uchar *record)
{
HP_KEYDEF *keydef, *end;
- byte *pos;
+ uchar *pos;
HP_SHARE *share=info->s;
DBUG_ENTER("heap_write");
#ifndef DBUG_OFF
@@ -88,7 +88,7 @@ err:
}
share->deleted++;
- *((byte**) pos)=share->del_link;
+ *((uchar**) pos)=share->del_link;
share->del_link=pos;
pos[share->reclength]=0; /* Record deleted */
@@ -99,8 +99,8 @@ err:
Write a key to rb_tree-index
*/
-int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record,
- byte *recpos)
+int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *record,
+ uchar *recpos)
{
heap_rb_param custom_arg;
uint old_allocated;
@@ -130,17 +130,17 @@ int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record,
/* Find where to place new record */
-static byte *next_free_record_pos(HP_SHARE *info)
+static uchar *next_free_record_pos(HP_SHARE *info)
{
int block_pos;
- byte *pos;
- ulong length;
+ uchar *pos;
+ size_t length;
DBUG_ENTER("next_free_record_pos");
if (info->del_link)
{
pos=info->del_link;
- info->del_link= *((byte**) pos);
+ info->del_link= *((uchar**) pos);
info->deleted--;
DBUG_PRINT("exit",("Used old position: 0x%lx",(long) pos));
DBUG_RETURN(pos);
@@ -158,9 +158,9 @@ static byte *next_free_record_pos(HP_SHARE *info)
info->data_length+=length;
}
DBUG_PRINT("exit",("Used new position: 0x%lx",
- (long) ((byte*) info->block.level_info[0].last_blocks+
+ (long) ((uchar*) info->block.level_info[0].last_blocks+
block_pos * info->block.recbuffer)));
- DBUG_RETURN((byte*) info->block.level_info[0].last_blocks+
+ DBUG_RETURN((uchar*) info->block.level_info[0].last_blocks+
block_pos*info->block.recbuffer);
}
@@ -191,12 +191,12 @@ static byte *next_free_record_pos(HP_SHARE *info)
*/
int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
- const byte *record, byte *recpos)
+ const uchar *record, uchar *recpos)
{
HP_SHARE *share = info->s;
int flag;
ulong halfbuff,hashnr,first_index;
- byte *ptr_to_rec,*ptr_to_rec2;
+ uchar *ptr_to_rec,*ptr_to_rec2;
HASH_INFO *empty,*gpos,*gpos2,*pos;
DBUG_ENTER("hp_write_key");
@@ -390,7 +390,7 @@ static HASH_INFO *hp_find_free_hash(HP_SHARE *info,
HP_BLOCK *block, ulong records)
{
uint block_pos;
- ulong length;
+ size_t length;
if (records < block->last_allocated)
return hp_find_hash(block,records);
@@ -401,6 +401,6 @@ static HASH_INFO *hp_find_free_hash(HP_SHARE *info,
info->index_length+=length;
}
block->last_allocated=records+1;
- return((HASH_INFO*) ((byte*) block->level_info[0].last_blocks+
+ return((HASH_INFO*) ((uchar*) block->level_info[0].last_blocks+
block_pos*block->recbuffer));
}
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index 873a73be0ec..d2b6162ba26 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -16,6 +16,9 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS(-DMYSQL_SERVER -D_WIN32 -DWIN32 -D_LIB)
+IF(EMBEDDED_ONLY)
+ ADD_DEFINITIONS(-DUSE_TLS)
+ENDIF(EMBEDDED_ONLY)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
include
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 30226fc6eb9..86cd7a758a9 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -60,7 +60,7 @@ static handlerton *innodb_hton_ptr;
uses unsigned char; the header univ.i which we include next defines
'byte' as a macro which expands to 'unsigned char' */
-typedef byte mysql_byte;
+typedef uchar mysql_byte;
#define INSIDE_HA_INNOBASE_CC
@@ -156,7 +156,7 @@ static HASH innobase_open_tables;
bool nw_panic = FALSE;
#endif
-static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length,
+static mysql_byte* innobase_get_key(INNOBASE_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused)));
static INNOBASE_SHARE *get_share(const char *table_name);
static void free_share(INNOBASE_SHARE *share);
@@ -693,12 +693,12 @@ innobase_mysql_print_thd(
use the default max length */
{
THD* thd;
- char buffer[1024];
+ char buffer[1024];
- thd = (THD*) input_thd;
- fputs(thd_security_context(thd, buffer, sizeof(buffer),
+ thd = (THD*) input_thd;
+ fputs(thd_security_context(thd, buffer, sizeof(buffer),
max_query_len), f);
- putc('\n', f);
+ putc('\n', f);
}
/**********************************************************************
@@ -1252,12 +1252,12 @@ innobase_print_identifier(
output strings buffers must not be shared. The function
only produces more output when the name contains other
characters than [0-9A-Z_a-z]. */
- char* temp_name = my_malloc((uint) namelen + 1, MYF(MY_WME));
+ char* temp_name = (char*) my_malloc((uint) namelen + 1, MYF(MY_WME));
uint qnamelen = (uint) (namelen
+ (1 + sizeof srv_mysql50_table_name_prefix));
if (temp_name) {
- qname = my_malloc(qnamelen, MYF(MY_WME));
+ qname = (char*) my_malloc(qnamelen, MYF(MY_WME));
if (qname) {
memcpy(temp_name, name, namelen);
temp_name[namelen] = 0;
@@ -2395,7 +2395,7 @@ ha_innobase::open(
"how you can resolve the problem.\n",
norm_name);
free_share(share);
- my_free((gptr) upd_buff, MYF(0));
+ my_free(upd_buff, MYF(0));
my_errno = ENOENT;
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
@@ -2412,7 +2412,7 @@ ha_innobase::open(
"how you can resolve the problem.\n",
norm_name);
free_share(share);
- my_free((gptr) upd_buff, MYF(0));
+ my_free(upd_buff, MYF(0));
my_errno = ENOENT;
dict_table_decrement_handle_count(ib_table);
@@ -2511,7 +2511,7 @@ ha_innobase::close(void)
row_prebuilt_free(prebuilt);
- my_free((gptr) upd_buff, MYF(0));
+ my_free(upd_buff, MYF(0));
free_share(share);
/* Tell InnoDB server that there might be work for
@@ -2534,7 +2534,7 @@ get_field_offset(
TABLE* table, /* in: MySQL table object */
Field* field) /* in: MySQL field object */
{
- return((uint) (field->ptr - (char*) table->record[0]));
+ return((uint) (field->ptr - table->record[0]));
}
/******************************************************************
@@ -4388,7 +4388,7 @@ ha_innobase::rnd_pos(
int error;
uint keynr = active_index;
DBUG_ENTER("rnd_pos");
- DBUG_DUMP("key", (char*) pos, ref_length);
+ DBUG_DUMP("key", pos, ref_length);
ha_statistic_increment(&SSV::ha_read_rnd_count);
@@ -4697,7 +4697,7 @@ create_index(
error = convert_error_code_to_mysql(error, NULL);
- my_free((gptr) field_lengths, MYF(0));
+ my_free(field_lengths, MYF(0));
DBUG_RETURN(error);
}
@@ -5130,7 +5130,7 @@ innobase_drop_database(
}
ptr++;
- namebuf = my_malloc((uint) len + 2, MYF(0));
+ namebuf = (char*) my_malloc((uint) len + 2, MYF(0));
memcpy(namebuf, ptr, len);
namebuf[len] = '/';
@@ -5327,7 +5327,7 @@ ha_innobase::records_in_range(
dtuple_free_for_mysql(heap1);
dtuple_free_for_mysql(heap2);
- my_free((gptr) key_val_buff2, MYF(0));
+ my_free(key_val_buff2, MYF(0));
prebuilt->trx->op_info = (char*)"";
@@ -5784,7 +5784,7 @@ ha_innobase::update_table_comment(
/* allocate buffer for the full string, and
read the contents of the temporary file */
- str = my_malloc(length + flen + 3, MYF(0));
+ str = (char*) my_malloc(length + flen + 3, MYF(0));
if (str) {
char* pos = str + length;
@@ -5852,7 +5852,7 @@ ha_innobase::get_foreign_key_create_info(void)
/* allocate buffer for the string, and
read the contents of the temporary file */
- str = my_malloc(flen + 1, MYF(0));
+ str = (char*) my_malloc(flen + 1, MYF(0));
if (str) {
rewind(srv_dict_tmpfile);
@@ -5984,7 +5984,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
}
FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *)
- thd->memdup((gptr) &f_key_info,
+ thd->memdup(&f_key_info,
sizeof(FOREIGN_KEY_INFO)));
f_key_list->push_back(pf_key_info);
foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
@@ -6521,7 +6521,7 @@ innodb_show_status(
/* allocate buffer for the string, and
read the contents of the temporary file */
- if (!(str = my_malloc(usable_len + 1, MYF(0)))) {
+ if (!(str = (char*) my_malloc(usable_len + 1, MYF(0)))) {
mutex_exit_noninline(&srv_monitor_file_mutex);
DBUG_RETURN(TRUE);
}
@@ -6682,7 +6682,7 @@ bool innobase_show_status(handlerton *hton, THD* thd,
locking.
****************************************************************************/
-static mysql_byte* innobase_get_key(INNOBASE_SHARE* share, uint* length,
+static mysql_byte* innobase_get_key(INNOBASE_SHARE* share, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
@@ -6710,7 +6710,7 @@ static INNOBASE_SHARE* get_share(const char* table_name)
if (my_hash_insert(&innobase_open_tables,
(mysql_byte*) share)) {
pthread_mutex_unlock(&innobase_share_mutex);
- my_free((gptr) share,0);
+ my_free(share,0);
return 0;
}
@@ -6733,7 +6733,7 @@ static void free_share(INNOBASE_SHARE* share)
hash_delete(&innobase_open_tables, (mysql_byte*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
- my_free((gptr) share, MYF(0));
+ my_free(share, MYF(0));
}
pthread_mutex_unlock(&innobase_share_mutex);
@@ -7228,9 +7228,8 @@ ha_innobase::cmp_ref(
ref1 += 2;
ref2 += 2;
- result = ((Field_blob*)field)->cmp(
- (const char*)ref1, len1,
- (const char*)ref2, len2);
+ result = ((Field_blob*)field)->cmp( ref1, len1,
+ ref2, len2);
} else {
result = field->key_cmp(ref1, ref2);
}
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 90fc7727044..1c864445ac0 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -47,8 +47,8 @@ class ha_innobase: public handler
THR_LOCK_DATA lock;
INNOBASE_SHARE *share;
- byte* upd_buff; /* buffer used in updates */
- byte* key_val_buff; /* buffer used in converting
+ uchar* upd_buff; /* buffer used in updates */
+ uchar* key_val_buff; /* buffer used in converting
search key values from MySQL format
to Innodb format */
ulong upd_and_key_val_buff_len;
@@ -65,10 +65,10 @@ class ha_innobase: public handler
uint num_write_row; /* number of write_row() calls */
uint store_key_val_for_row(uint keynr, char* buff, uint buff_len,
- const byte* record);
+ const uchar* record);
int update_thd(THD* thd);
int change_active_index(uint keynr);
- int general_fetch(byte* buf, uint direction, uint match_mode);
+ int general_fetch(uchar* buf, uint direction, uint match_mode);
int innobase_read_and_init_auto_inc(longlong* ret);
/* Init values for the class: */
@@ -110,32 +110,32 @@ class ha_innobase: public handler
double scan_time();
double read_time(uint index, uint ranges, ha_rows rows);
- int write_row(byte * buf);
- int update_row(const byte * old_data, byte * new_data);
- int delete_row(const byte * buf);
+ int write_row(uchar * buf);
+ int update_row(const uchar * old_data, uchar * new_data);
+ int delete_row(const uchar * buf);
bool was_semi_consistent_read();
void try_semi_consistent_read(bool yes);
void unlock_row();
int index_init(uint index, bool sorted);
int index_end();
- int index_read(byte * buf, const byte * key,
+ int index_read(uchar * buf, const uchar * key,
uint key_len, enum ha_rkey_function find_flag);
- int index_read_idx(byte * buf, uint index, const byte * key,
+ int index_read_idx(uchar * buf, uint index, const uchar * key,
uint key_len, enum ha_rkey_function find_flag);
- int index_read_last(byte * buf, const byte * key, uint key_len);
- int index_next(byte * buf);
- int index_next_same(byte * buf, const byte *key, uint keylen);
- int index_prev(byte * buf);
- int index_first(byte * buf);
- int index_last(byte * buf);
+ int index_read_last(uchar * buf, const uchar * key, uint key_len);
+ int index_next(uchar * buf);
+ int index_next_same(uchar * buf, const uchar *key, uint keylen);
+ int index_prev(uchar * buf);
+ int index_first(uchar * buf);
+ int index_last(uchar * buf);
int rnd_init(bool scan);
int rnd_end();
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
- void position(const byte *record);
+ void position(const uchar *record);
int info(uint);
int analyze(THD* thd,HA_CHECK_OPT* check_opt);
int optimize(THD* thd,HA_CHECK_OPT* check_opt);
@@ -145,7 +145,7 @@ class ha_innobase: public handler
int external_lock(THD *thd, int lock_type);
int transactional_table_lock(THD *thd, int lock_type);
int start_stmt(THD *thd, thr_lock_type lock_type);
- void position(byte *record);
+ void position(uchar *record);
ha_rows records_in_range(uint inx, key_range *min_key, key_range
*max_key);
ha_rows estimate_rows_upper_bound();
@@ -185,7 +185,7 @@ class ha_innobase: public handler
static char *get_mysql_bin_log_name();
static ulonglong get_mysql_bin_log_pos();
bool primary_key_is_clustered() { return true; }
- int cmp_ref(const byte *ref1, const byte *ref2);
+ int cmp_ref(const uchar *ref1, const uchar *ref2);
bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes);
};
diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt
index ad0efe4a4e4..ec7cde9a789 100644
--- a/storage/myisam/CMakeLists.txt
+++ b/storage/myisam/CMakeLists.txt
@@ -16,6 +16,10 @@ INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+IF(EMBEDDED_ONLY)
+ ADD_DEFINITIONS(-DUSE_TLS)
+ ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
+ENDIF(EMBEDDED_ONLY)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/sql
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index 68076d7e401..f38561a76dd 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -111,7 +111,7 @@ typedef struct st_ftb_word
uint ndepth;
uint len;
uchar off;
- byte word[1];
+ uchar word[1];
} FTB_WORD;
typedef struct st_ft_info
@@ -161,7 +161,7 @@ typedef struct st_my_ftb_param
{
FTB *ftb;
FTB_EXPR *ftbe;
- byte *up_quot;
+ uchar *up_quot;
uint depth;
} MY_FTB_PARAM;
@@ -274,7 +274,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset;
- char **start= &query;
+ uchar **start= (uchar**) &query;
char *end= query + len;
FT_WORD w;
@@ -286,8 +286,8 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
}
-static void _ftb_parse_query(FTB *ftb, byte *query, uint len,
- struct st_mysql_ftparser *parser)
+static int _ftb_parse_query(FTB *ftb, uchar *query, uint len,
+ struct st_mysql_ftparser *parser)
{
MYSQL_FTPARSER_PARAM *param;
MY_FTB_PARAM ftb_param;
@@ -295,9 +295,9 @@ static void _ftb_parse_query(FTB *ftb, byte *query, uint len,
DBUG_ASSERT(parser);
if (ftb->state != UNINITIALIZED)
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
if (! (param= ftparser_call_initializer(ftb->info, ftb->keynr, 0)))
- DBUG_VOID_RETURN;
+ DBUG_RETURN(1);
ftb_param.ftb= ftb;
ftb_param.depth= 0;
@@ -312,8 +312,7 @@ static void _ftb_parse_query(FTB *ftb, byte *query, uint len,
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO;
- parser->parse(param);
- DBUG_VOID_RETURN;
+ DBUG_RETURN(parser->parse(param));
}
@@ -331,7 +330,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
my_bool can_go_down;
MI_INFO *info=ftb->info;
uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength;
- byte *lastkey_buf=ftbw->word+ftbw->off;
+ uchar *lastkey_buf=ftbw->word+ftbw->off;
LINT_INIT(off);
if (ftbw->flags & FTB_FLAG_TRUNC)
@@ -505,7 +504,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
}
-FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
+FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, uchar *query,
uint query_len, CHARSET_INFO *cs)
{
FTB *ftb;
@@ -538,21 +537,22 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
ftbe->phrase= NULL;
ftbe->document= 0;
ftb->root=ftbe;
- _ftb_parse_query(ftb, query, query_len, keynr == NO_SUCH_KEY ?
- &ft_default_parser :
- info->s->keyinfo[keynr].parser);
+ if (unlikely(_ftb_parse_query(ftb, query, query_len,
+ keynr == NO_SUCH_KEY ? &ft_default_parser :
+ info->s->keyinfo[keynr].parser)))
+ goto err;
/*
Hack: instead of init_queue, we'll use reinit queue to be able
to alloc queue with alloc_root()
*/
- if (! (ftb->queue.root= (byte **)alloc_root(&ftb->mem_root,
+ if (! (ftb->queue.root= (uchar **)alloc_root(&ftb->mem_root,
(ftb->queue.max_elements + 1) *
sizeof(void *))))
goto err;
reinit_queue(&ftb->queue, ftb->queue.max_elements, 0, 0,
- (int (*)(void*, byte*, byte*))FTB_WORD_cmp, 0);
+ (int (*)(void*, uchar*, uchar*))FTB_WORD_cmp, 0);
for (ftbw= ftb->last_word; ftbw; ftbw= ftbw->prev)
- queue_insert(&ftb->queue, (byte *)ftbw);
+ queue_insert(&ftb->queue, (uchar *)ftbw);
ftb->list=(FTB_WORD **)alloc_root(&ftb->mem_root,
sizeof(FTB_WORD *)*ftb->queue.elements);
memcpy(ftb->list, ftb->queue.root+1, sizeof(FTB_WORD *)*ftb->queue.elements);
@@ -563,7 +563,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
return ftb;
err:
free_root(& ftb->mem_root, MYF(0));
- my_free((gptr)ftb,MYF(0));
+ my_free((uchar*)ftb,MYF(0));
return 0;
}
@@ -617,11 +617,12 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
const char *docend= document + len;
- while (ft_simple_get_word(phrase_param->cs, &document, docend, &word, FALSE))
+ while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend,
+ &word, FALSE))
{
param->mysql_add_word(param, word.pos, word.len, 0);
if (phrase_param->match)
- return 1;
+ break;
}
return 0;
}
@@ -639,9 +640,10 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
RETURN VALUE
1 is returned if phrase found, 0 else.
+ -1 is returned if error occurs.
*/
-static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len,
+static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
{
MY_FTB_PHRASE_PARAM ftb_param;
@@ -663,16 +665,17 @@ static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len,
param->mysql_add_word= ftb_phrase_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= (byte *)document;
+ param->doc= (uchar *)document;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
- parser->parse(param);
+ if (unlikely(parser->parse(param)))
+ return -1;
DBUG_RETURN(ftb_param.match ? 1 : 0);
}
-static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_orig)
+static int _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_orig)
{
FT_SEG_ITERATOR ftsi;
FTB_EXPR *ftbe;
@@ -704,17 +707,19 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
weight=ftbe->cur_weight*ftbe->weight;
if (mode && ftbe->phrase)
{
- int not_found=1;
+ int found= 0;
memcpy(&ftsi, ftsi_orig, sizeof(ftsi));
- while (_mi_ft_segiterator(&ftsi) && not_found)
+ while (_mi_ft_segiterator(&ftsi) && !found)
{
if (!ftsi.pos)
continue;
- not_found = ! _ftb_check_phrase(ftb, ftsi.pos, ftsi.len,
- ftbe, parser);
+ found= _ftb_check_phrase(ftb, ftsi.pos, ftsi.len, ftbe, parser);
+ if (unlikely(found < 0))
+ return 1;
}
- if (not_found) break;
+ if (!found)
+ break;
} /* ftbe->quot */
}
else
@@ -746,6 +751,7 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
weight*= ftbe->weight;
}
}
+ return 0;
}
@@ -778,7 +784,11 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
{
while (curdoc == (ftbw=(FTB_WORD *)queue_top(& ftb->queue))->docid[0])
{
- _ftb_climb_the_tree(ftb, ftbw, 0);
+ if (unlikely(_ftb_climb_the_tree(ftb, ftbw, 0)))
+ {
+ my_errno= HA_ERR_OUT_OF_MEM;
+ goto err;
+ }
/* update queue */
_ft2_search(ftb, ftbw, 0);
@@ -854,7 +864,8 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
if (ftbw->docid[1] == ftb->info->lastpos)
continue;
ftbw->docid[1]= ftb->info->lastpos;
- _ftb_climb_the_tree(ftb, ftbw, ftb_param->ftsi);
+ if (unlikely(_ftb_climb_the_tree(ftb, ftbw, ftb_param->ftsi)))
+ return 1;
}
return(0);
}
@@ -867,13 +878,13 @@ static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
FT_INFO *ftb= ftb_param->ftb;
char *end= doc + len;
FT_WORD w;
- while (ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+ while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE))
param->mysql_add_word(param, w.pos, w.len, 0);
return(0);
}
-float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
+float ft_boolean_find_relevance(FT_INFO *ftb, uchar *record, uint length)
{
FTB_EXPR *ftbe;
FT_SEG_ITERATOR ftsi, ftsi2;
@@ -924,9 +935,10 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
{
if (!ftsi.pos)
continue;
- param->doc= (byte *)ftsi.pos;
+ param->doc= (uchar *)ftsi.pos;
param->length= ftsi.len;
- parser->parse(param);
+ if (unlikely(parser->parse(param)))
+ return 0;
}
ftbe=ftb->root;
if (ftbe->docid[1]==docid && ftbe->cur_weight>0 &&
@@ -948,7 +960,7 @@ void ft_boolean_close_search(FT_INFO *ftb)
delete_tree(& ftb->no_dupes);
}
free_root(& ftb->mem_root, MYF(0));
- my_free((gptr)ftb,MYF(0));
+ my_free((uchar*)ftb,MYF(0));
}
diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c
index 5c6f66897ee..4774b819aa2 100644
--- a/storage/myisam/ft_nlq_search.c
+++ b/storage/myisam/ft_nlq_search.c
@@ -189,7 +189,7 @@ static int walk_and_push(FT_SUPERDOC *from,
DBUG_ENTER("walk_and_copy");
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
set_if_smaller(best->elements, ft_query_expansion_limit-1);
- queue_insert(best, (byte *)& from->doc);
+ queue_insert(best, (uchar *)& from->doc);
DBUG_RETURN(0);
}
@@ -201,8 +201,8 @@ static int FT_DOC_cmp(void *unused __attribute__((unused)),
}
-FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
- uint query_len, uint flags, byte *record)
+FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, uchar *query,
+ uint query_len, uint flags, uchar *record)
{
TREE wtree;
ALL_IN_ONE aio;
@@ -257,8 +257,12 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
{
info->update|= HA_STATE_AKTIV;
ftparser_param->flags= MYSQL_FTFLAGS_NEED_COPY;
- _mi_ft_parse(&wtree, info, keynr, record, ftparser_param,
- &wtree.mem_root);
+ if (unlikely(_mi_ft_parse(&wtree, info, keynr, record, ftparser_param,
+ &wtree.mem_root)))
+ {
+ delete_queue(&best);
+ goto err;
+ }
}
}
delete_queue(&best);
@@ -323,7 +327,7 @@ int ft_nlq_read_next(FT_INFO *handler, char *record)
float ft_nlq_find_relevance(FT_INFO *handler,
- byte *record __attribute__((unused)),
+ uchar *record __attribute__((unused)),
uint length __attribute__((unused)))
{
int a,b,c;
@@ -352,7 +356,7 @@ float ft_nlq_find_relevance(FT_INFO *handler,
void ft_nlq_close_search(FT_INFO *handler)
{
- my_free((gptr)handler,MYF(0));
+ my_free((uchar*)handler,MYF(0));
}
diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c
index 5992d9c118e..ba858c37aee 100644
--- a/storage/myisam/ft_parser.c
+++ b/storage/myisam/ft_parser.c
@@ -78,7 +78,7 @@ FT_WORD * ft_linearize(TREE *wtree, MEM_ROOT *mem_root)
DBUG_RETURN(wlist);
}
-my_bool ft_boolean_check_syntax_string(const byte *str)
+my_bool ft_boolean_check_syntax_string(const uchar *str)
{
uint i, j;
@@ -106,10 +106,10 @@ my_bool ft_boolean_check_syntax_string(const byte *str)
3 - right bracket
4 - stopword found
*/
-byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
- FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
+uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+ FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
{
- byte *doc=*start;
+ uchar *doc=*start;
int ctype;
uint mwc, length, mbl;
@@ -196,10 +196,10 @@ ret:
return param->type;
}
-byte ft_simple_get_word(CHARSET_INFO *cs, byte **start, const byte *end,
- FT_WORD *word, my_bool skip_stopwords)
+uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
+ FT_WORD *word, my_bool skip_stopwords)
{
- byte *doc= *start;
+ uchar *doc= *start;
uint mwc, length, mbl;
int ctype;
DBUG_ENTER("ft_simple_get_word");
@@ -260,9 +260,9 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
wtree= ft_param->wtree;
if (param->flags & MYSQL_FTFLAGS_NEED_COPY)
{
- byte *ptr;
+ uchar *ptr;
DBUG_ASSERT(wtree->with_delete == 0);
- ptr= (byte *)alloc_root(ft_param->mem_root, word_len);
+ ptr= (uchar *)alloc_root(ft_param->mem_root, word_len);
memcpy(ptr, word, word_len);
w.pos= ptr;
}
@@ -279,9 +279,10 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- char *doc, int doc_len)
+ char *doc_arg, int doc_len)
{
- byte *end=doc+doc_len;
+ uchar *doc= (uchar*) doc_arg;
+ uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree;
FT_WORD w;
@@ -294,9 +295,9 @@ static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
}
-int ft_parse(TREE *wtree, byte *doc, int doclen,
- struct st_mysql_ftparser *parser,
- MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
+int ft_parse(TREE *wtree, uchar *doc, int doclen,
+ struct st_mysql_ftparser *parser,
+ MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
MY_FT_PARSER_PARAM my_param;
DBUG_ENTER("ft_parse");
diff --git a/storage/myisam/ft_static.c b/storage/myisam/ft_static.c
index 34608be1721..610c20eede6 100644
--- a/storage/myisam/ft_static.c
+++ b/storage/myisam/ft_static.c
@@ -56,8 +56,8 @@ const struct _ft_vft _ft_vft_boolean = {
FT_INFO *ft_init_search(uint flags, void *info, uint keynr,
- byte *query, uint query_len, CHARSET_INFO *cs,
- byte *record)
+ uchar *query, uint query_len, CHARSET_INFO *cs,
+ uchar *record)
{
FT_INFO *res;
if (flags & FT_BOOL)
diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c
index 63732ebadc9..e6a90bc927a 100644
--- a/storage/myisam/ft_stopwords.c
+++ b/storage/myisam/ft_stopwords.c
@@ -38,7 +38,7 @@ static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action,
void *arg __attribute__((unused)))
{
if (action == free_free)
- my_free((gptr) w->pos, MYF(0));
+ my_free((uchar*) w->pos, MYF(0));
}
static int ft_add_stopword(const char *w)
@@ -65,7 +65,7 @@ int ft_init_stopwords()
{
File fd;
uint len;
- byte *buffer, *start, *end;
+ uchar *buffer, *start, *end;
FT_WORD w;
int error=-1;
diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c
index e176d550b1d..e3e4c62158f 100644
--- a/storage/myisam/ft_update.c
+++ b/storage/myisam/ft_update.c
@@ -20,7 +20,7 @@
#include "ftdefs.h"
#include <math.h>
-void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const byte *record,
+void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const uchar *record,
FT_SEG_ITERATOR *ftsi)
{
DBUG_ENTER("_mi_ft_segiterator_init");
@@ -31,7 +31,7 @@ void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const byte *record,
DBUG_VOID_RETURN;
}
-void _mi_ft_segiterator_dummy_init(const byte *record, uint len,
+void _mi_ft_segiterator_dummy_init(const uchar *record, uint len,
FT_SEG_ITERATOR *ftsi)
{
DBUG_ENTER("_mi_ft_segiterator_dummy_init");
@@ -94,7 +94,7 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
/* parses a document i.e. calls ft_parse for every keyseg */
-uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record,
+uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const uchar *record,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
FT_SEG_ITERATOR ftsi;
@@ -108,13 +108,13 @@ uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record,
while (_mi_ft_segiterator(&ftsi))
{
if (ftsi.pos)
- if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, parser, param, mem_root))
+ if (ft_parse(parsed, (uchar *)ftsi.pos, ftsi.len, parser, param, mem_root))
DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
-FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record,
+FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const uchar *record,
MEM_ROOT *mem_root)
{
TREE ptree;
@@ -130,7 +130,7 @@ FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record,
DBUG_RETURN(ft_linearize(&ptree, mem_root));
}
-static int _mi_ft_store(MI_INFO *info, uint keynr, byte *keybuf,
+static int _mi_ft_store(MI_INFO *info, uint keynr, uchar *keybuf,
FT_WORD *wlist, my_off_t filepos)
{
uint key_length;
@@ -145,7 +145,7 @@ static int _mi_ft_store(MI_INFO *info, uint keynr, byte *keybuf,
DBUG_RETURN(0);
}
-static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf,
+static int _mi_ft_erase(MI_INFO *info, uint keynr, uchar *keybuf,
FT_WORD *wlist, my_off_t filepos)
{
uint key_length, err=0;
@@ -168,7 +168,7 @@ static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf,
#define THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT 1
#define GEE_THEY_ARE_ABSOLUTELY_IDENTICAL 0
-int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
+int _mi_ft_cmp(MI_INFO *info, uint keynr, const uchar *rec1, const uchar *rec2)
{
FT_SEG_ITERATOR ftsi1, ftsi2;
CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset;
@@ -190,8 +190,8 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
/* update a document entry */
-int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
- const byte *oldrec, const byte *newrec, my_off_t pos)
+int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf,
+ const uchar *oldrec, const uchar *newrec, my_off_t pos)
{
int error= -1;
FT_WORD *oldlist,*newlist, *old_word, *new_word;
@@ -241,7 +241,7 @@ err:
/* adds a document to the collection */
-int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
+int _mi_ft_add(MI_INFO *info, uint keynr, uchar *keybuf, const uchar *record,
my_off_t pos)
{
int error= -1;
@@ -260,7 +260,7 @@ int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
/* removes a document from the collection */
-int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
+int _mi_ft_del(MI_INFO *info, uint keynr, uchar *keybuf, const uchar *record,
my_off_t pos)
{
int error= -1;
@@ -276,10 +276,10 @@ int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
DBUG_RETURN(error);
}
-uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr,
+uint _ft_make_key(MI_INFO *info, uint keynr, uchar *keybuf, FT_WORD *wptr,
my_off_t filepos)
{
- byte buf[HA_FT_MAXBYTELEN+16];
+ uchar buf[HA_FT_MAXBYTELEN+16];
DBUG_ENTER("_ft_make_key");
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
diff --git a/storage/myisam/ftdefs.h b/storage/myisam/ftdefs.h
index 26f5e4f266e..22443807b87 100644
--- a/storage/myisam/ftdefs.h
+++ b/storage/myisam/ftdefs.h
@@ -96,44 +96,44 @@
#define FTB_RQUOT (ft_boolean_syntax[11])
typedef struct st_ft_word {
- byte * pos;
+ uchar * pos;
uint len;
double weight;
} FT_WORD;
int is_stopword(char *word, uint len);
-uint _ft_make_key(MI_INFO *, uint , byte *, FT_WORD *, my_off_t);
+uint _ft_make_key(MI_INFO *, uint , uchar *, FT_WORD *, my_off_t);
-byte ft_get_word(CHARSET_INFO *, byte **, byte *, FT_WORD *,
- MYSQL_FTPARSER_BOOLEAN_INFO *);
-byte ft_simple_get_word(CHARSET_INFO *, byte **, const byte *,
- FT_WORD *, my_bool);
+uchar ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
+ MYSQL_FTPARSER_BOOLEAN_INFO *);
+uchar ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+ FT_WORD *, my_bool);
typedef struct _st_ft_seg_iterator {
uint num, len;
HA_KEYSEG *seg;
- const byte *rec, *pos;
+ const uchar *rec, *pos;
} FT_SEG_ITERATOR;
-void _mi_ft_segiterator_init(MI_INFO *, uint, const byte *, FT_SEG_ITERATOR *);
-void _mi_ft_segiterator_dummy_init(const byte *, uint, FT_SEG_ITERATOR *);
+void _mi_ft_segiterator_init(MI_INFO *, uint, const uchar *, FT_SEG_ITERATOR *);
+void _mi_ft_segiterator_dummy_init(const uchar *, uint, FT_SEG_ITERATOR *);
uint _mi_ft_segiterator(FT_SEG_ITERATOR *);
void ft_parse_init(TREE *, CHARSET_INFO *);
-int ft_parse(TREE *, byte *, int, struct st_mysql_ftparser *parser,
+int ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_WORD * ft_linearize(TREE *, MEM_ROOT *);
-FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const byte *, MEM_ROOT *);
-uint _mi_ft_parse(TREE *, MI_INFO *, uint, const byte *,
+FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const uchar *, MEM_ROOT *);
+uint _mi_ft_parse(TREE *, MI_INFO *, uint, const uchar *,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
-FT_INFO *ft_init_nlq_search(MI_INFO *, uint, byte *, uint, uint, byte *);
-FT_INFO *ft_init_boolean_search(MI_INFO *, uint, byte *, uint, CHARSET_INFO *);
+FT_INFO *ft_init_nlq_search(MI_INFO *, uint, uchar *, uint, uint, uchar *);
+FT_INFO *ft_init_boolean_search(MI_INFO *, uint, uchar *, uint, CHARSET_INFO *);
extern const struct _ft_vft _ft_vft_nlq;
int ft_nlq_read_next(FT_INFO *, char *);
-float ft_nlq_find_relevance(FT_INFO *, byte *, uint);
+float ft_nlq_find_relevance(FT_INFO *, uchar *, uint);
void ft_nlq_close_search(FT_INFO *);
float ft_nlq_get_relevance(FT_INFO *);
my_off_t ft_nlq_get_docid(FT_INFO *);
@@ -141,7 +141,7 @@ void ft_nlq_reinit_search(FT_INFO *);
extern const struct _ft_vft _ft_vft_boolean;
int ft_boolean_read_next(FT_INFO *, char *);
-float ft_boolean_find_relevance(FT_INFO *, byte *, uint);
+float ft_boolean_find_relevance(FT_INFO *, uchar *, uint);
void ft_boolean_close_search(FT_INFO *);
float ft_boolean_get_relevance(FT_INFO *);
my_off_t ft_boolean_get_docid(FT_INFO *);
diff --git a/storage/myisam/fulltext.h b/storage/myisam/fulltext.h
index bea2fa96969..856e93e034d 100644
--- a/storage/myisam/fulltext.h
+++ b/storage/myisam/fulltext.h
@@ -29,9 +29,9 @@
extern const HA_KEYSEG ft_keysegs[FT_SEGS];
-int _mi_ft_cmp(MI_INFO *, uint, const byte *, const byte *);
-int _mi_ft_add(MI_INFO *, uint, byte *, const byte *, my_off_t);
-int _mi_ft_del(MI_INFO *, uint, byte *, const byte *, my_off_t);
+int _mi_ft_cmp(MI_INFO *, uint, const uchar *, const uchar *);
+int _mi_ft_add(MI_INFO *, uint, uchar *, const uchar *, my_off_t);
+int _mi_ft_del(MI_INFO *, uint, uchar *, const uchar *, my_off_t);
uint _mi_ft_convert_to_ft2(MI_INFO *, uint, uchar *);
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 56e428b1bc1..4d7346a382d 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -84,6 +84,14 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
}
length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) -
name);
+ /*
+ TODO: switch from protocol to push_warning here. The main reason we didn't
+ it yet is parallel repair. Due to following trace:
+ mi_check_print_msg/push_warning/sql_alloc/my_pthread_getspecific_ptr.
+
+ Also we likely need to lock mutex here (in both cases with protocol and
+ push_warning).
+ */
protocol->prepare_for_resend();
protocol->store(name, length, system_charset_info);
protocol->store(param->op_name, system_charset_info);
@@ -121,7 +129,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
{
uint i, j, recpos, minpos, fieldpos, temp_length, length;
enum ha_base_keytype type= HA_KEYTYPE_BINARY;
- byte *record;
+ uchar *record;
KEY *pos;
MI_KEYDEF *keydef;
MI_COLUMNDEF *recinfo, *recinfo_pos;
@@ -531,7 +539,7 @@ int ha_myisam::net_read_dump(NET* net)
error= -1;
goto err;
}
- if (my_write(data_fd, (byte*)net->read_pos, (uint) packet_len,
+ if (my_write(data_fd, (uchar*)net->read_pos, (uint) packet_len,
MYF(MY_WME|MY_FNABP)))
{
error = errno;
@@ -550,7 +558,7 @@ int ha_myisam::dump(THD* thd, int fd)
uint blocksize = share->blocksize;
my_off_t bytes_to_read = share->state.state.data_file_length;
int data_fd = file->dfile;
- byte * buf = (byte*) my_malloc(blocksize, MYF(MY_WME));
+ uchar *buf = (uchar*) my_malloc(blocksize, MYF(MY_WME));
if (!buf)
return ENOMEM;
@@ -558,7 +566,7 @@ int ha_myisam::dump(THD* thd, int fd)
my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME));
for (; bytes_to_read > 0;)
{
- uint bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME));
+ size_t bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME));
if (bytes == MY_FILE_ERROR)
{
error = errno;
@@ -575,7 +583,7 @@ int ha_myisam::dump(THD* thd, int fd)
}
else
{
- if (my_net_write(net, (char*) buf, bytes))
+ if (my_net_write(net, buf, bytes))
{
error = errno ? errno : EPIPE;
goto err;
@@ -586,13 +594,13 @@ int ha_myisam::dump(THD* thd, int fd)
if (fd < 0)
{
- if (my_net_write(net, "", 0))
+ if (my_net_write(net, (uchar*) "", 0))
error = errno ? errno : EPIPE;
net_flush(net);
}
err:
- my_free((gptr) buf, MYF(0));
+ my_free((uchar*) buf, MYF(0));
return error;
}
#endif /* HAVE_REPLICATION */
@@ -710,7 +718,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
recinfo must be freed.
*/
if (recinfo)
- my_free((gptr) recinfo, MYF(0));
+ my_free((uchar*) recinfo, MYF(0));
return my_errno;
}
@@ -721,7 +729,7 @@ int ha_myisam::close(void)
return mi_close(tmp);
}
-int ha_myisam::write_row(byte * buf)
+int ha_myisam::write_row(uchar *buf)
{
ha_statistic_increment(&SSV::ha_write_count);
@@ -1216,11 +1224,7 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
table->keys_in_use_for_query.clear_all();
if (table_list->process_index_hints(table))
- {
- errmsg= thd->net.last_error;
- error= HA_ADMIN_FAILED;
- goto err;
- }
+ DBUG_RETURN(HA_ADMIN_FAILED);
map= ~(ulonglong) 0;
if (!table->keys_in_use_for_query.is_clear_all())
/* use all keys if there's no list specified by the user through hints */
@@ -1235,7 +1239,6 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
error= HA_ADMIN_CORRUPT;
}
- err:
if (error != HA_ADMIN_OK)
{
/* Send error to user */
@@ -1270,11 +1273,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt)
table->keys_in_use_for_query.clear_all();
if (table_list->process_index_hints(table))
- {
- errmsg= thd->net.last_error;
- error= HA_ADMIN_FAILED;
- goto err;
- }
+ DBUG_RETURN(HA_ADMIN_FAILED);
map= ~(ulonglong) 0;
/* Check validity of the index references */
@@ -1437,8 +1436,10 @@ int ha_myisam::enable_indexes(uint mode)
might have been set by the first repair. They can still be seen
with SHOW WARNINGS then.
*/
+#ifndef EMBEDDED_LIBRARY
if (! error)
thd->clear_error();
+#endif /* EMBEDDED_LIBRARY */
}
info(HA_STATUS_CONST);
thd->proc_info=save_proc_info;
@@ -1594,7 +1595,7 @@ bool ha_myisam::is_crashed() const
(my_disable_locking && file->s->state.open_count));
}
-int ha_myisam::update_row(const byte * old_data, byte * new_data)
+int ha_myisam::update_row(const uchar *old_data, uchar *new_data)
{
ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
@@ -1602,13 +1603,13 @@ int ha_myisam::update_row(const byte * old_data, byte * new_data)
return mi_update(file,old_data,new_data);
}
-int ha_myisam::delete_row(const byte * buf)
+int ha_myisam::delete_row(const uchar *buf)
{
ha_statistic_increment(&SSV::ha_delete_count);
return mi_delete(file,buf);
}
-int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map,
+int ha_myisam::index_read(uchar *buf, const uchar *key, key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
@@ -1618,7 +1619,7 @@ int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map,
return error;
}
-int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key,
+int ha_myisam::index_read_idx(uchar *buf, uint index, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -1628,7 +1629,7 @@ int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key,
return error;
}
-int ha_myisam::index_read_last(byte *buf, const byte *key,
+int ha_myisam::index_read_last(uchar *buf, const uchar *key,
key_part_map keypart_map)
{
DBUG_ENTER("ha_myisam::index_read_last");
@@ -1640,7 +1641,7 @@ int ha_myisam::index_read_last(byte *buf, const byte *key,
DBUG_RETURN(error);
}
-int ha_myisam::index_next(byte * buf)
+int ha_myisam::index_next(uchar *buf)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_next_count);
@@ -1649,7 +1650,7 @@ int ha_myisam::index_next(byte * buf)
return error;
}
-int ha_myisam::index_prev(byte * buf)
+int ha_myisam::index_prev(uchar *buf)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_prev_count);
@@ -1658,7 +1659,7 @@ int ha_myisam::index_prev(byte * buf)
return error;
}
-int ha_myisam::index_first(byte * buf)
+int ha_myisam::index_first(uchar *buf)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_first_count);
@@ -1667,7 +1668,7 @@ int ha_myisam::index_first(byte * buf)
return error;
}
-int ha_myisam::index_last(byte * buf)
+int ha_myisam::index_last(uchar *buf)
{
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_last_count);
@@ -1676,8 +1677,8 @@ int ha_myisam::index_last(byte * buf)
return error;
}
-int ha_myisam::index_next_same(byte * buf,
- const byte *key __attribute__((unused)),
+int ha_myisam::index_next_same(uchar *buf,
+ const uchar *key __attribute__((unused)),
uint length __attribute__((unused)))
{
DBUG_ASSERT(inited==INDEX);
@@ -1695,7 +1696,7 @@ int ha_myisam::rnd_init(bool scan)
return mi_reset(file); // Free buffers
}
-int ha_myisam::rnd_next(byte *buf)
+int ha_myisam::rnd_next(uchar *buf)
{
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=mi_scan(file, buf);
@@ -1703,12 +1704,12 @@ int ha_myisam::rnd_next(byte *buf)
return error;
}
-int ha_myisam::restart_rnd_next(byte *buf, byte *pos)
+int ha_myisam::restart_rnd_next(uchar *buf, uchar *pos)
{
return rnd_pos(buf,pos);
}
-int ha_myisam::rnd_pos(byte * buf, byte *pos)
+int ha_myisam::rnd_pos(uchar *buf, uchar *pos)
{
ha_statistic_increment(&SSV::ha_read_rnd_count);
int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
@@ -1716,7 +1717,7 @@ int ha_myisam::rnd_pos(byte * buf, byte *pos)
return error;
}
-void ha_myisam::position(const byte* record)
+void ha_myisam::position(const uchar *record)
{
my_off_t row_position= mi_position(file);
my_store_ptr(ref, ref_length, row_position);
@@ -1901,7 +1902,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
records, recinfo,
0, (MI_UNIQUEDEF*) 0,
&create_info, create_flags);
- my_free((gptr) recinfo, MYF(0));
+ my_free((uchar*) recinfo, MYF(0));
DBUG_RETURN(error);
}
@@ -1919,7 +1920,7 @@ void ha_myisam::get_auto_increment(ulonglong offset, ulonglong increment,
{
ulonglong nr;
int error;
- byte key[MI_MAX_KEY_LENGTH];
+ uchar key[MI_MAX_KEY_LENGTH];
if (!table->s->next_number_key_offset)
{ // Autoincrement at key-start
@@ -1992,7 +1993,7 @@ ha_rows ha_myisam::records_in_range(uint inx, key_range *min_key,
}
-int ha_myisam::ft_read(byte * buf)
+int ha_myisam::ft_read(uchar *buf)
{
int error;
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index bb439e9914d..6cc9f4811b0 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -67,19 +67,19 @@ class ha_myisam: public handler
bool called_by_logger_thread);
int open(const char *name, int mode, uint test_if_locked);
int close(void);
- int write_row(byte * buf);
- int update_row(const byte * old_data, byte * new_data);
- int delete_row(const byte * buf);
- int index_read(byte *buf, const byte *key, key_part_map keypart_map,
+ int write_row(uchar * buf);
+ int update_row(const uchar * old_data, uchar * new_data);
+ int delete_row(const uchar * buf);
+ int index_read(uchar *buf, const uchar *key, key_part_map keypart_map,
enum ha_rkey_function find_flag);
- int index_read_idx(byte *buf, uint index, const byte *key,
+ int index_read_idx(uchar *buf, uint index, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_read_last(byte *buf, const byte *key, key_part_map keypart_map);
- int index_next(byte * buf);
- int index_prev(byte * buf);
- int index_first(byte * buf);
- int index_last(byte * buf);
- int index_next_same(byte *buf, const byte *key, uint keylen);
+ int index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map);
+ int index_next(uchar * buf);
+ int index_prev(uchar * buf);
+ int index_first(uchar * buf);
+ int index_last(uchar * buf);
+ int index_next_same(uchar *buf, const uchar *key, uint keylen);
int ft_init()
{
if (!ft_handler)
@@ -90,15 +90,15 @@ class ha_myisam: public handler
FT_INFO *ft_init_ext(uint flags, uint inx,String *key)
{
return ft_init_search(flags,file,inx,
- (byte *)key->ptr(), key->length(), key->charset(),
+ (uchar *)key->ptr(), key->length(), key->charset(),
table->record[0]);
}
- int ft_read(byte *buf);
+ int ft_read(uchar *buf);
int rnd_init(bool scan);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
- int restart_rnd_next(byte *buf, byte *pos);
- void position(const byte *record);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
+ int restart_rnd_next(uchar *buf, uchar *pos);
+ void position(const uchar *record);
int info(uint);
int extra(enum ha_extra_function operation);
int extra_opt(enum ha_extra_function operation, ulong cache_size);
diff --git a/storage/myisam/mi_cache.c b/storage/myisam/mi_cache.c
index 59c9b2c8812..d6dcc431a8d 100644
--- a/storage/myisam/mi_cache.c
+++ b/storage/myisam/mi_cache.c
@@ -35,12 +35,12 @@
#include "myisamdef.h"
-int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
+int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, uint length,
int flag)
{
uint read_length,in_buff_length;
my_off_t offset;
- char *in_buff_pos;
+ uchar *in_buff_pos;
DBUG_ENTER("_mi_read_cache");
if (pos < info->pos_in_file)
@@ -61,7 +61,7 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
(my_off_t) (info->read_end - info->request_pos))
{
in_buff_pos=info->request_pos+(uint) offset;
- in_buff_length= min(length,(uint) (info->read_end-in_buff_pos));
+ in_buff_length= min(length, (size_t) (info->read_end-in_buff_pos));
memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length);
if (!(length-=in_buff_length))
DBUG_RETURN(0);
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index cd6ab65c223..255f17eada7 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -83,12 +83,12 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param);
/*static int flush_pending_blocks(MI_CHECK *param);*/
static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint blocks,
uint buffer_length);
-static ha_checksum mi_byte_checksum(const byte *buf, uint length);
+static ha_checksum mi_byte_checksum(const uchar *buf, uint length);
static void set_data_file_type(SORT_INFO *sort_info, MYISAM_SHARE *share);
void myisamchk_init(MI_CHECK *param)
{
- bzero((gptr) param,sizeof(*param));
+ bzero((uchar*) param,sizeof(*param));
param->opt_follow_links=1;
param->keys_in_use= ~(ulonglong) 0;
param->search_after_block=HA_OFFSET_ERROR;
@@ -296,7 +296,7 @@ static int check_k_link(MI_CHECK *param, register MI_INFO *info, uint nr)
*/
if (!(buff=key_cache_read(info->s->key_cache,
info->s->kfile, next_link, DFLT_INIT_HITS,
- (byte*) info->buff, MI_MIN_KEY_BLOCK_LENGTH,
+ (uchar*) info->buff, MI_MIN_KEY_BLOCK_LENGTH,
MI_MIN_KEY_BLOCK_LENGTH, 1)))
{
/* purecov: begin tested */
@@ -531,7 +531,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
/* Check that there isn't a row with auto_increment = 0 in the table */
mi_extra(info,HA_EXTRA_KEYREAD,0);
bzero(info->lastkey,keyinfo->seg->length);
- if (!mi_rkey(info, info->rec_buff, key, (const byte*) info->lastkey,
+ if (!mi_rkey(info, info->rec_buff, key, (const uchar*) info->lastkey,
(key_part_map)1, HA_READ_KEY_EXACT))
{
/* Don't count this as a real warning, as myisamchk can't correct it */
@@ -741,7 +741,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
char llbuff[22];
uint diff_pos[2];
DBUG_ENTER("chk_index");
- DBUG_DUMP("buff",(byte*) buff,mi_getint(buff));
+ DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff));
/* TODO: implement appropriate check for RTree keys */
if (keyinfo->flag & HA_SPATIAL)
@@ -799,8 +799,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
(flag=ha_key_cmp(keyinfo->seg,info->lastkey,key,key_length,
comp_flag, diff_pos)) >=0)
{
- DBUG_DUMP("old",(byte*) info->lastkey, info->lastkey_length);
- DBUG_DUMP("new",(byte*) key, key_length);
+ DBUG_DUMP("old",(uchar*) info->lastkey, info->lastkey_length);
+ DBUG_DUMP("new",(uchar*) key, key_length);
DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos));
if (comp_flag & SEARCH_FIND && flag == 0)
@@ -832,7 +832,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
key);
}
}
- (*key_checksum)+= mi_byte_checksum((byte*) key,
+ (*key_checksum)+= mi_byte_checksum((uchar*) key,
key_length- info->s->rec_reflength);
record= _mi_dpos(info,0,key+key_length);
if (keyinfo->flag & HA_FULLTEXT) /* special handling for ft2 */
@@ -870,7 +870,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
DBUG_PRINT("test",("page: %s record: %s filelength: %s",
llstr(page,llbuff),llstr(record,llbuff2),
llstr(info->state->data_file_length,llbuff3)));
- DBUG_DUMP("key",(byte*) key,key_length);
+ DBUG_DUMP("key",(uchar*) key,key_length);
DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos));
goto err;
}
@@ -882,10 +882,10 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
llstr(page,llbuff), used_length, (keypos - buff));
goto err;
}
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(0);
err:
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(1);
} /* chk_index */
@@ -940,7 +940,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
ha_rows records,del_blocks;
my_off_t used,empty,pos,splits,start_recpos,
del_length,link_used,start_block;
- byte *record,*to;
+ uchar *record,*to;
char llbuff[22],llbuff2[22],llbuff3[22];
ha_checksum intern_record_checksum;
ha_checksum key_checksum[MI_MAX_POSSIBLE_KEY];
@@ -957,7 +957,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
puts("- check record links");
}
- if (!(record= (byte*) my_malloc(info->s->base.pack_reclength,MYF(0))))
+ if (!(record= (uchar*) my_malloc(info->s->base.pack_reclength,MYF(0))))
{
mi_check_print_error(param,"Not enough memory for record");
DBUG_RETURN(-1);
@@ -992,7 +992,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
goto err2;
switch (info->s->data_file_type) {
case STATIC_RECORD:
- if (my_b_read(&param->read_cache,(byte*) record,
+ if (my_b_read(&param->read_cache,(uchar*) record,
info->s->base.pack_reclength))
goto err;
start_recpos=pos;
@@ -1012,7 +1012,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
block_info.next_filepos=pos;
do
{
- if (_mi_read_cache(&param->read_cache,(byte*) block_info.header,
+ if (_mi_read_cache(&param->read_cache,(uchar*) block_info.header,
(start_block=block_info.next_filepos),
sizeof(block_info.header),
(flag ? 0 : READING_NEXT) | READING_HEADER))
@@ -1116,7 +1116,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
got_error=1;
break;
}
- if (_mi_read_cache(&param->read_cache,(byte*) to,block_info.filepos,
+ if (_mi_read_cache(&param->read_cache,(uchar*) to,block_info.filepos,
(uint) block_info.data_len,
flag == 1 ? READING_NEXT : 0))
goto err;
@@ -1177,7 +1177,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
pos=block_info.filepos+block_info.block_len;
break;
case COMPRESSED_RECORD:
- if (_mi_read_cache(&param->read_cache,(byte*) block_info.header, pos,
+ if (_mi_read_cache(&param->read_cache,(uchar*) block_info.header, pos,
info->s->pack.ref_length, READING_NEXT))
goto err;
start_recpos=pos;
@@ -1194,7 +1194,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
got_error=1;
break;
}
- if (_mi_read_cache(&param->read_cache,(byte*) info->rec_buff,
+ if (_mi_read_cache(&param->read_cache,(uchar*) info->rec_buff,
block_info.filepos, block_info.rec_len, READING_NEXT))
goto err;
if (_mi_pack_rec_unpack(info, &info->bit_buff, record,
@@ -1254,7 +1254,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
}
}
else
- key_checksum[key]+=mi_byte_checksum((byte*) info->lastkey,
+ key_checksum[key]+=mi_byte_checksum((uchar*) info->lastkey,
key_length);
}
}
@@ -1364,12 +1364,12 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
printf("Lost space: %12s Linkdata: %10s\n",
llstr(empty,llbuff),llstr(link_used,llbuff2));
}
- my_free((gptr) record,MYF(0));
+ my_free((uchar*) record,MYF(0));
DBUG_RETURN (error);
err:
mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff));
err2:
- my_free((gptr) record,MYF(0));
+ my_free((uchar*) record,MYF(0));
param->testflag|=T_RETRY_WITHOUT_QUICK;
DBUG_RETURN(1);
} /* chk_data_link */
@@ -1379,7 +1379,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
/* Save new datafile-name in temp_filename */
int mi_repair(MI_CHECK *param, register MI_INFO *info,
- my_string name, int rep_quick)
+ char * name, int rep_quick)
{
int error,got_error;
uint i;
@@ -1428,7 +1428,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
MYF(MY_WME | MY_WAIT_IF_FULL)))
goto err;
info->opt_flag|=WRITE_CACHE_USED;
- if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength,
+ if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength,
MYF(0))) ||
!mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
{
@@ -1515,7 +1515,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
{
if (my_errno != HA_ERR_FOUND_DUPP_KEY)
goto err;
- DBUG_DUMP("record",(byte*) sort_param.record,share->base.pack_reclength);
+ DBUG_DUMP("record",(uchar*) sort_param.record,share->base.pack_reclength);
mi_check_print_info(param,"Duplicate key %2d for record at %10s against new record at %10s",
info->errkey+1,
llstr(sort_param.start_recpos,llbuff),
@@ -1661,7 +1661,7 @@ static int writekeys(MI_SORT_PARAM *sort_param)
register uint i;
uchar *key;
MI_INFO *info= sort_param->sort_info->info;
- byte *buff= sort_param->record;
+ uchar *buff= sort_param->record;
my_off_t filepos= sort_param->filepos;
DBUG_ENTER("writekeys");
@@ -1725,7 +1725,7 @@ static int writekeys(MI_SORT_PARAM *sort_param)
/* Change all key-pointers that points to a records */
-int movepoint(register MI_INFO *info, byte *record, my_off_t oldpos,
+int movepoint(register MI_INFO *info, uchar *record, my_off_t oldpos,
my_off_t newpos, uint prot_key)
{
register uint i;
@@ -1802,7 +1802,7 @@ int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file)
/* Sort index for more efficent reads */
-int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
+int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name)
{
reg2 uint key;
reg1 MI_KEYDEF *keyinfo;
@@ -1945,7 +1945,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
("From page: %ld, keyoffset: %lu used_length: %d",
(ulong) pagepos, (ulong) (keypos - buff),
(int) used_length));
- DBUG_DUMP("buff",(byte*) buff,used_length);
+ DBUG_DUMP("buff",(uchar*) buff,used_length);
goto err;
}
}
@@ -1974,17 +1974,17 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
/* Fill block with zero and write it to the new index file */
length=mi_getint(buff);
- bzero((byte*) buff+length,keyinfo->block_length-length);
- if (my_pwrite(new_file,(byte*) buff,(uint) keyinfo->block_length,
+ bzero((uchar*) buff+length,keyinfo->block_length-length);
+ if (my_pwrite(new_file,(uchar*) buff,(uint) keyinfo->block_length,
new_page_pos,MYF(MY_NABP | MY_WAIT_IF_FULL)))
{
mi_check_print_error(param,"Can't write indexblock, error: %d",my_errno);
goto err;
}
- my_afree((gptr) buff);
+ my_afree((uchar*) buff);
DBUG_RETURN(0);
err:
- my_afree((gptr) buff);
+ my_afree((uchar*) buff);
DBUG_RETURN(1);
} /* sort_one_index */
@@ -2055,13 +2055,13 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
VOID(my_seek(from,start,MY_SEEK_SET,MYF(0)));
while (length > buff_length)
{
- if (my_read(from,(byte*) buff,buff_length,MYF(MY_NABP)) ||
- my_write(to,(byte*) buff,buff_length,param->myf_rw))
+ if (my_read(from,(uchar*) buff,buff_length,MYF(MY_NABP)) ||
+ my_write(to,(uchar*) buff,buff_length,param->myf_rw))
goto err;
length-= buff_length;
}
- if (my_read(from,(byte*) buff,(uint) length,MYF(MY_NABP)) ||
- my_write(to,(byte*) buff,(uint) length,param->myf_rw))
+ if (my_read(from,(uchar*) buff,(uint) length,MYF(MY_NABP)) ||
+ my_write(to,(uchar*) buff,(uint) length,param->myf_rw))
goto err;
if (buff != tmp_buff)
my_free(buff,MYF(0));
@@ -2142,7 +2142,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
info->opt_flag|=WRITE_CACHE_USED;
info->rec_cache.file=info->dfile; /* for sort_delete_record */
- if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength,
+ if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength,
MYF(0))) ||
!mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
{
@@ -2455,8 +2455,8 @@ err:
my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff),
MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
VOID(end_io_cache(&param->read_cache));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@@ -2988,9 +2988,9 @@ err:
pthread_cond_destroy (&sort_info.cond);
pthread_mutex_destroy(&sort_info.mutex);
- my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) sort_param,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sort_param,MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
VOID(end_io_cache(&param->read_cache));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@@ -3120,7 +3120,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
int parallel_flag;
uint found_record,b_type,left_length;
my_off_t pos;
- byte *to;
+ uchar *to;
MI_BLOCK_INFO block_info;
SORT_INFO *sort_info=sort_param->sort_info;
MI_CHECK *param=sort_info->param;
@@ -3198,7 +3198,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
llstr(param->search_after_block,llbuff),
llstr(sort_param->start_recpos,llbuff2));
if (_mi_read_cache(&sort_param->read_cache,
- (byte*) block_info.header,pos,
+ (uchar*) block_info.header,pos,
MI_BLOCK_INFO_HEADER_LENGTH,
(! found_record ? READING_NEXT : 0) |
parallel_flag | READING_HEADER))
@@ -3462,7 +3462,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
case COMPRESSED_RECORD:
for (searching=0 ;; searching=1, sort_param->pos++)
{
- if (_mi_read_cache(&sort_param->read_cache,(byte*) block_info.header,
+ if (_mi_read_cache(&sort_param->read_cache,(uchar*) block_info.header,
sort_param->pos,
share->pack.ref_length,READING_NEXT))
DBUG_RETURN(-1);
@@ -3490,7 +3490,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
llstr(sort_param->pos,llbuff));
continue;
}
- if (_mi_read_cache(&sort_param->read_cache,(byte*) sort_param->rec_buff,
+ if (_mi_read_cache(&sort_param->read_cache,(uchar*) sort_param->rec_buff,
block_info.filepos, block_info.rec_len,
READING_NEXT))
{
@@ -3546,8 +3546,8 @@ int sort_write_record(MI_SORT_PARAM *sort_param)
int flag;
uint length;
ulong block_length,reclength;
- byte *from;
- byte block_buff[8];
+ uchar *from;
+ uchar block_buff[8];
SORT_INFO *sort_info=sort_param->sort_info;
MI_CHECK *param=sort_info->param;
MI_INFO *info=sort_info->info;
@@ -3623,7 +3623,7 @@ int sort_write_record(MI_SORT_PARAM *sort_param)
length+= save_pack_length((uint) share->pack.version,
block_buff + length, info->blob_length);
if (my_b_write(&info->rec_cache,block_buff,length) ||
- my_b_write(&info->rec_cache,(byte*) sort_param->rec_buff,reclength))
+ my_b_write(&info->rec_cache,(uchar*) sort_param->rec_buff,reclength))
{
mi_check_print_error(param,"%d when writing to datafile",my_errno);
DBUG_RETURN(1);
@@ -3923,7 +3923,7 @@ static int sort_insert_key(MI_SORT_PARAM *sort_param,
/* Fill block with end-zero and write filled block */
mi_putint(anc_buff,key_block->last_length,nod_flag);
- bzero((byte*) anc_buff+key_block->last_length,
+ bzero((uchar*) anc_buff+key_block->last_length,
keyinfo->block_length- key_block->last_length);
key_file_length=info->state->key_file_length;
if ((filepos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
@@ -3935,10 +3935,10 @@ static int sort_insert_key(MI_SORT_PARAM *sort_param,
if (_mi_write_keypage(info, keyinfo, filepos, DFLT_INIT_HITS, anc_buff))
DBUG_RETURN(1);
}
- else if (my_pwrite(info->s->kfile,(byte*) anc_buff,
+ else if (my_pwrite(info->s->kfile,(uchar*) anc_buff,
(uint) keyinfo->block_length,filepos, param->myf_rw))
DBUG_RETURN(1);
- DBUG_DUMP("buff",(byte*) anc_buff,mi_getint(anc_buff));
+ DBUG_DUMP("buff",(uchar*) anc_buff,mi_getint(anc_buff));
/* Write separator-key to block in next level */
if (sort_insert_key(sort_param,key_block+1,key_block->lastkey,filepos))
@@ -4029,7 +4029,7 @@ int flush_pending_blocks(MI_SORT_PARAM *sort_param)
if (nod_flag)
_mi_kpointer(info,key_block->end_pos,filepos);
key_file_length=info->state->key_file_length;
- bzero((byte*) key_block->buff+length, keyinfo->block_length-length);
+ bzero((uchar*) key_block->buff+length, keyinfo->block_length-length);
if ((filepos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
DBUG_RETURN(1);
@@ -4040,10 +4040,10 @@ int flush_pending_blocks(MI_SORT_PARAM *sort_param)
DFLT_INIT_HITS, key_block->buff))
DBUG_RETURN(1);
}
- else if (my_pwrite(info->s->kfile,(byte*) key_block->buff,
+ else if (my_pwrite(info->s->kfile,(uchar*) key_block->buff,
(uint) keyinfo->block_length,filepos, myf_rw))
DBUG_RETURN(1);
- DBUG_DUMP("buff",(byte*) key_block->buff,length);
+ DBUG_DUMP("buff",(uchar*) key_block->buff,length);
nod_flag=1;
}
info->s->state.key_root[sort_param->key]=filepos; /* Last is root for tree */
@@ -4114,34 +4114,34 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
(param->testflag & T_UNPACK);
if (!(keyinfo=(MI_KEYDEF*) my_alloca(sizeof(MI_KEYDEF)*share.base.keys)))
DBUG_RETURN(0);
- memcpy((byte*) keyinfo,(byte*) share.keyinfo,
+ memcpy((uchar*) keyinfo,(uchar*) share.keyinfo,
(size_t) (sizeof(MI_KEYDEF)*share.base.keys));
key_parts= share.base.all_key_parts;
if (!(keysegs=(HA_KEYSEG*) my_alloca(sizeof(HA_KEYSEG)*
(key_parts+share.base.keys))))
{
- my_afree((gptr) keyinfo);
+ my_afree((uchar*) keyinfo);
DBUG_RETURN(1);
}
if (!(recdef=(MI_COLUMNDEF*)
my_alloca(sizeof(MI_COLUMNDEF)*(share.base.fields+1))))
{
- my_afree((gptr) keyinfo);
- my_afree((gptr) keysegs);
+ my_afree((uchar*) keyinfo);
+ my_afree((uchar*) keysegs);
DBUG_RETURN(1);
}
if (!(uniquedef=(MI_UNIQUEDEF*)
my_alloca(sizeof(MI_UNIQUEDEF)*(share.state.header.uniques+1))))
{
- my_afree((gptr) recdef);
- my_afree((gptr) keyinfo);
- my_afree((gptr) keysegs);
+ my_afree((uchar*) recdef);
+ my_afree((uchar*) keyinfo);
+ my_afree((uchar*) keysegs);
DBUG_RETURN(1);
}
/* Copy the column definitions */
- memcpy((byte*) recdef,(byte*) share.rec,
+ memcpy((uchar*) recdef,(uchar*) share.rec,
(size_t) (sizeof(MI_COLUMNDEF)*(share.base.fields+1)));
for (rec=recdef,end=recdef+share.base.fields; rec != end ; rec++)
{
@@ -4153,7 +4153,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
}
/* Change the new key to point at the saved key segments */
- memcpy((byte*) keysegs,(byte*) share.keyparts,
+ memcpy((uchar*) keysegs,(uchar*) share.keyparts,
(size_t) (sizeof(HA_KEYSEG)*(key_parts+share.base.keys+
share.state.header.uniques)));
keyseg=keysegs;
@@ -4170,7 +4170,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
/* Copy the unique definitions and change them to point at the new key
segments*/
- memcpy((byte*) uniquedef,(byte*) share.uniqueinfo,
+ memcpy((uchar*) uniquedef,(uchar*) share.uniqueinfo,
(size_t) (sizeof(MI_UNIQUEDEF)*(share.state.header.uniques)));
for (u_ptr=uniquedef,u_end=uniquedef+share.state.header.uniques;
u_ptr != u_end ; u_ptr++)
@@ -4252,10 +4252,10 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
goto end;
error=0;
end:
- my_afree((gptr) uniquedef);
- my_afree((gptr) keyinfo);
- my_afree((gptr) recdef);
- my_afree((gptr) keysegs);
+ my_afree((uchar*) uniquedef);
+ my_afree((uchar*) keyinfo);
+ my_afree((uchar*) recdef);
+ my_afree((uchar*) keysegs);
DBUG_RETURN(error);
}
@@ -4358,7 +4358,7 @@ err:
void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
my_bool repair_only)
{
- byte *record;
+ uchar *record;
DBUG_ENTER("update_auto_increment_key");
if (!info->s->base.auto_key ||
@@ -4377,7 +4377,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
We have to use an allocated buffer instead of info->rec_buff as
_mi_put_key_in_record() may use info->rec_buff
*/
- if (!(record= (byte*) my_malloc((uint) info->s->base.pack_reclength,
+ if (!(record= (uchar*) my_malloc((uint) info->s->base.pack_reclength,
MYF(0))))
{
mi_check_print_error(param,"Not enough memory for extra record");
@@ -4505,10 +4505,10 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
}
-static ha_checksum mi_byte_checksum(const byte *buf, uint length)
+static ha_checksum mi_byte_checksum(const uchar *buf, uint length)
{
ha_checksum crc;
- const byte *end=buf+length;
+ const uchar *end=buf+length;
for (crc=0; buf != end; buf++)
crc=((crc << 1) + *((uchar*) buf)) +
test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1)));
diff --git a/storage/myisam/mi_checksum.c b/storage/myisam/mi_checksum.c
index 711e87c1547..4e87de373bd 100644
--- a/storage/myisam/mi_checksum.c
+++ b/storage/myisam/mi_checksum.c
@@ -17,7 +17,7 @@
#include "myisamdef.h"
-ha_checksum mi_checksum(MI_INFO *info, const byte *buf)
+ha_checksum mi_checksum(MI_INFO *info, const uchar *buf)
{
uint i;
ha_checksum crc=0;
@@ -25,7 +25,7 @@ ha_checksum mi_checksum(MI_INFO *info, const byte *buf)
for (i=info->s->base.fields ; i-- ; buf+=(rec++)->length)
{
- const byte *pos;
+ const uchar *pos;
ulong length;
switch (rec->type) {
case FIELD_BLOB:
@@ -52,13 +52,13 @@ ha_checksum mi_checksum(MI_INFO *info, const byte *buf)
pos=buf;
break;
}
- crc=my_checksum(crc, pos ? pos : "", length);
+ crc=my_checksum(crc, pos ? pos : (uchar*) "", length);
}
return crc;
}
-ha_checksum mi_static_checksum(MI_INFO *info, const byte *pos)
+ha_checksum mi_static_checksum(MI_INFO *info, const uchar *pos)
{
return my_checksum(0, pos, info->s->base.reclength);
}
diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c
index 47b7ba855c0..07105aea88d 100644
--- a/storage/myisam/mi_close.c
+++ b/storage/myisam/mi_close.c
@@ -87,8 +87,8 @@ int mi_close(register MI_INFO *info)
#endif
if (share->decode_trees)
{
- my_free((gptr) share->decode_trees,MYF(0));
- my_free((gptr) share->decode_tables,MYF(0));
+ my_free((uchar*) share->decode_trees,MYF(0));
+ my_free((uchar*) share->decode_tables,MYF(0));
}
#ifdef THREAD
thr_lock_delete(&share->lock);
@@ -102,19 +102,19 @@ int mi_close(register MI_INFO *info)
}
}
#endif
- my_free((gptr) info->s,MYF(0));
+ my_free((uchar*) info->s,MYF(0));
}
pthread_mutex_unlock(&THR_LOCK_myisam);
if (info->ftparser_param)
{
- my_free((gptr)info->ftparser_param, MYF(0));
+ my_free((uchar*)info->ftparser_param, MYF(0));
info->ftparser_param= 0;
}
if (info->dfile >= 0 && my_close(info->dfile,MYF(0)))
error = my_errno;
myisam_log_command(MI_LOG_CLOSE,info,NULL,0,error);
- my_free((gptr) info,MYF(0));
+ my_free((uchar*) info,MYF(0));
if (error)
{
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index 71d377c8b6b..c177aa8d987 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -76,7 +76,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
LINT_INIT(file);
errpos=0;
options=0;
- bzero((byte*) &share,sizeof(share));
+ bzero((uchar*) &share,sizeof(share));
if (flags & HA_DONT_TOUCH_DATA)
{
@@ -498,7 +498,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
goto err;
}
- bmove(share.state.header.file_version,(byte*) myisam_file_magic,4);
+ bmove(share.state.header.file_version,(uchar*) myisam_file_magic,4);
ci->old_options=options| (ci->old_options & HA_OPTION_TEMP_COMPRESS_RECORD ?
HA_OPTION_COMPRESS_RECORD |
HA_OPTION_TEMP_COMPRESS_RECORD: 0);
diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c
index 409930ff7fb..29a84570f1e 100644
--- a/storage/myisam/mi_delete.c
+++ b/storage/myisam/mi_delete.c
@@ -32,7 +32,7 @@ static int _mi_ck_real_delete(register MI_INFO *info,MI_KEYDEF *keyinfo,
uchar *key, uint key_length, my_off_t *root);
-int mi_delete(MI_INFO *info,const byte *record)
+int mi_delete(MI_INFO *info,const uchar *record)
{
uint i;
uchar *old_key;
@@ -100,7 +100,7 @@ int mi_delete(MI_INFO *info,const byte *record)
info->state->records--;
mi_sizestore(lastpos,info->lastpos);
- myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos,sizeof(lastpos),0);
+ myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos,sizeof(lastpos),0);
VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
allow_break(); /* Allow SIGHUP & SIGINT */
if (info->invalidator != 0)
@@ -114,7 +114,7 @@ int mi_delete(MI_INFO *info,const byte *record)
err:
save_errno=my_errno;
mi_sizestore(lastpos,info->lastpos);
- myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos, sizeof(lastpos),0);
+ myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos, sizeof(lastpos),0);
if (save_errno != HA_ERR_RECORD_CHANGED)
{
mi_print_error(info->s, HA_ERR_CRASHED);
@@ -198,7 +198,7 @@ static int _mi_ck_real_delete(register MI_INFO *info, MI_KEYDEF *keyinfo,
}
}
err:
- my_afree((gptr) root_buff);
+ my_afree((uchar*) root_buff);
DBUG_PRINT("exit",("Return: %d",error));
DBUG_RETURN(error);
} /* _mi_ck_real_delete */
@@ -223,7 +223,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_off_t leaf_page,next_block;
uchar lastkey[MI_MAX_KEY_BUFF];
DBUG_ENTER("d_search");
- DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff));
+ DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff));
search_key_length= (comp_flag & SEARCH_FIND) ? key_length : USE_WHOLE_KEY;
flag=(*keyinfo->bin_search)(info,keyinfo,anc_buff,key, search_key_length,
@@ -381,14 +381,14 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
ret_value|=_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,anc_buff);
else
{
- DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff));
+ DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff));
}
- my_afree((byte*) leaf_buff);
+ my_afree((uchar*) leaf_buff);
DBUG_PRINT("exit",("Return: %d",ret_value));
DBUG_RETURN(ret_value);
err:
- my_afree((byte*) leaf_buff);
+ my_afree((uchar*) leaf_buff);
DBUG_PRINT("exit",("Error: %d",my_errno));
DBUG_RETURN (-1);
} /* d_search */
@@ -411,7 +411,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
DBUG_ENTER("del");
DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx", (long) leaf_page,
(ulong) keypos));
- DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff));
+ DBUG_DUMP("leaf_buff",(uchar*) leaf_buff,mi_getint(leaf_buff));
endpos=leaf_buff+mi_getint(leaf_buff);
if (!(key_start=_mi_get_last_key(info,keyinfo,leaf_buff,keybuff,endpos,
@@ -428,7 +428,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
ret_value= -1;
else
{
- DBUG_DUMP("next_page",(byte*) next_buff,mi_getint(next_buff));
+ DBUG_DUMP("next_page",(uchar*) next_buff,mi_getint(next_buff));
if ((ret_value=del(info,keyinfo,key,anc_buff,next_page,next_buff,
keypos,next_block,ret_key)) >0)
{
@@ -455,7 +455,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
if (_mi_write_keypage(info,keyinfo,leaf_page,DFLT_INIT_HITS,leaf_buff))
goto err;
}
- my_afree((byte*) next_buff);
+ my_afree((uchar*) next_buff);
DBUG_RETURN(ret_value);
}
@@ -479,7 +479,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
prev_key, prev_key,
keybuff,&s_temp);
if (length > 0)
- bmove_upp((byte*) endpos+length,(byte*) endpos,(uint) (endpos-keypos));
+ bmove_upp((uchar*) endpos+length,(uchar*) endpos,(uint) (endpos-keypos));
else
bmove(keypos,keypos-length, (int) (endpos-keypos)+length);
(*keyinfo->store_key)(keyinfo,keypos,&s_temp);
@@ -517,8 +517,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
DBUG_ENTER("underflow");
DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx",(long) leaf_page,
(ulong) keypos));
- DBUG_DUMP("anc_buff",(byte*) anc_buff,mi_getint(anc_buff));
- DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff));
+ DBUG_DUMP("anc_buff",(uchar*) anc_buff,mi_getint(anc_buff));
+ DBUG_DUMP("leaf_buff",(uchar*) leaf_buff,mi_getint(leaf_buff));
buff=info->buff;
info->buff_used=1;
@@ -554,10 +554,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,buff,0))
goto err;
buff_length=mi_getint(buff);
- DBUG_DUMP("next",(byte*) buff,buff_length);
+ DBUG_DUMP("next",(uchar*) buff,buff_length);
/* find keys to make a big key-page */
- bmove((byte*) next_keypos-key_reflength,(byte*) buff+2,
+ bmove((uchar*) next_keypos-key_reflength,(uchar*) buff+2,
key_reflength);
if (!_mi_get_last_key(info,keyinfo,anc_buff,anc_key,next_keypos,&length)
|| !_mi_get_last_key(info,keyinfo,leaf_buff,leaf_key,
@@ -572,8 +572,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
length=buff_length-p_length;
endpos=buff+length+leaf_length+t_length;
/* buff will always be larger than before !*/
- bmove_upp((byte*) endpos, (byte*) buff+buff_length,length);
- memcpy((byte*) buff, (byte*) leaf_buff,(size_t) leaf_length);
+ bmove_upp((uchar*) endpos, (uchar*) buff+buff_length,length);
+ memcpy((uchar*) buff, (uchar*) leaf_buff,(size_t) leaf_length);
(*keyinfo->store_key)(keyinfo,buff+leaf_length,&s_temp);
buff_length=(uint) (endpos-buff);
mi_putint(buff,buff_length,nod_flag);
@@ -589,7 +589,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (buff_length <= keyinfo->block_length)
{ /* Keys in one page */
- memcpy((byte*) leaf_buff,(byte*) buff,(size_t) buff_length);
+ memcpy((uchar*) leaf_buff,(uchar*) buff,(size_t) buff_length);
if (_mi_dispose(info,keyinfo,next_page,DFLT_INIT_HITS))
goto err;
}
@@ -605,7 +605,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
&key_length, &after_key)))
goto err;
length=(uint) (half_pos-buff);
- memcpy((byte*) leaf_buff,(byte*) buff,(size_t) length);
+ memcpy((uchar*) leaf_buff,(uchar*) buff,(size_t) length);
mi_putint(leaf_buff,length,nod_flag);
/* Correct new keypointer to leaf_page */
@@ -619,7 +619,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
prev_key, prev_key,
leaf_key, &s_temp);
if (t_length >= 0)
- bmove_upp((byte*) endpos+t_length,(byte*) endpos,
+ bmove_upp((uchar*) endpos+t_length,(uchar*) endpos,
(uint) (endpos-keypos));
else
bmove(keypos,keypos-t_length,(uint) (endpos-keypos)+t_length);
@@ -628,7 +628,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
/* Store key first in new page */
if (nod_flag)
- bmove((byte*) buff+2,(byte*) half_pos-nod_flag,(size_t) nod_flag);
+ bmove((uchar*) buff+2,(uchar*) half_pos-nod_flag,(size_t) nod_flag);
if (!(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key))
goto err;
t_length=(int) (*keyinfo->pack_key)(keyinfo, nod_flag, (uchar*) 0,
@@ -636,7 +636,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
leaf_key, &s_temp);
/* t_length will always be > 0 for a new page !*/
length=(uint) ((buff+mi_getint(buff))-half_pos);
- bmove((byte*) buff+p_length+t_length,(byte*) half_pos,(size_t) length);
+ bmove((uchar*) buff+p_length+t_length,(uchar*) half_pos,(size_t) length);
(*keyinfo->store_key)(keyinfo,buff+p_length,&s_temp);
mi_putint(buff,length+t_length+p_length,nod_flag);
@@ -659,10 +659,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
goto err;
buff_length=mi_getint(buff);
endpos=buff+buff_length;
- DBUG_DUMP("prev",(byte*) buff,buff_length);
+ DBUG_DUMP("prev",(uchar*) buff,buff_length);
/* find keys to make a big key-page */
- bmove((byte*) next_keypos - key_reflength,(byte*) leaf_buff+2,
+ bmove((uchar*) next_keypos - key_reflength,(uchar*) leaf_buff+2,
key_reflength);
next_keypos=keypos;
if (!(*keyinfo->get_key)(keyinfo,key_reflength,&next_keypos,
@@ -679,10 +679,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
prev_key, prev_key,
anc_key, &s_temp);
if (t_length >= 0)
- bmove((byte*) endpos+t_length,(byte*) leaf_buff+p_length,
+ bmove((uchar*) endpos+t_length,(uchar*) leaf_buff+p_length,
(size_t) (leaf_length-p_length));
else /* We gained space */
- bmove((byte*) endpos,(byte*) leaf_buff+((int) p_length-t_length),
+ bmove((uchar*) endpos,(uchar*) leaf_buff+((int) p_length-t_length),
(size_t) (leaf_length-p_length+t_length));
(*keyinfo->store_key)(keyinfo,endpos,&s_temp);
@@ -715,8 +715,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
goto err;
_mi_kpointer(info,leaf_key+key_length,leaf_page);
/* Save key in anc_buff */
- DBUG_DUMP("anc_buff",(byte*) anc_buff,anc_length);
- DBUG_DUMP("key_to_anc",(byte*) leaf_key,key_length);
+ DBUG_DUMP("anc_buff",(uchar*) anc_buff,anc_length);
+ DBUG_DUMP("key_to_anc",(uchar*) leaf_key,key_length);
temp_pos=anc_buff+anc_length;
t_length=(*keyinfo->pack_key)(keyinfo,key_reflength,
@@ -725,7 +725,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
anc_pos, anc_pos,
leaf_key,&s_temp);
if (t_length > 0)
- bmove_upp((byte*) temp_pos+t_length,(byte*) temp_pos,
+ bmove_upp((uchar*) temp_pos+t_length,(uchar*) temp_pos,
(uint) (temp_pos-keypos));
else
bmove(keypos,keypos-t_length,(uint) (temp_pos-keypos)+t_length);
@@ -734,15 +734,15 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
/* Store first key on new page */
if (nod_flag)
- bmove((byte*) leaf_buff+2,(byte*) half_pos-nod_flag,(size_t) nod_flag);
+ bmove((uchar*) leaf_buff+2,(uchar*) half_pos-nod_flag,(size_t) nod_flag);
if (!(length=(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key)))
goto err;
- DBUG_DUMP("key_to_leaf",(byte*) leaf_key,length);
+ DBUG_DUMP("key_to_leaf",(uchar*) leaf_key,length);
t_length=(*keyinfo->pack_key)(keyinfo,nod_flag, (uchar*) 0,
(uchar*) 0, (uchar*) 0, leaf_key, &s_temp);
length=(uint) ((buff+buff_length)-half_pos);
DBUG_PRINT("info",("t_length: %d length: %d",t_length,(int) length));
- bmove((byte*) leaf_buff+p_length+t_length,(byte*) half_pos,
+ bmove((uchar*) leaf_buff+p_length+t_length,(uchar*) half_pos,
(size_t) length);
(*keyinfo->store_key)(keyinfo,leaf_buff+p_length,&s_temp);
mi_putint(leaf_buff,length+t_length+p_length,nod_flag);
@@ -886,7 +886,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
}
}
end:
- bmove((byte*) start,(byte*) start+s_length,
+ bmove((uchar*) start,(uchar*) start+s_length,
(uint) (page_end-start-s_length));
DBUG_RETURN((uint) s_length);
} /* remove_key */
diff --git a/storage/myisam/mi_delete_all.c b/storage/myisam/mi_delete_all.c
index a17514486d5..dea0385cbca 100644
--- a/storage/myisam/mi_delete_all.c
+++ b/storage/myisam/mi_delete_all.c
@@ -47,7 +47,7 @@ int mi_delete_all_rows(MI_INFO *info)
for (i=0 ; i < share->base.keys ; i++)
state->key_root[i]= HA_OFFSET_ERROR;
- myisam_log_command(MI_LOG_DELETE_ALL,info,(byte*) 0,0,0);
+ myisam_log_command(MI_LOG_DELETE_ALL,info,(uchar*) 0,0,0);
/*
If we are using delayed keys or if the user has done changes to the tables
since it was locked then there may be key blocks in the key cache
diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c
index 5342619c79b..eba868bfb82 100644
--- a/storage/myisam/mi_dynrec.c
+++ b/storage/myisam/mi_dynrec.c
@@ -28,15 +28,15 @@
/* Enough for comparing if number is zero */
static char zero_string[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-static int write_dynamic_record(MI_INFO *info,const byte *record,
+static int write_dynamic_record(MI_INFO *info,const uchar *record,
ulong reclength);
static int _mi_find_writepos(MI_INFO *info,ulong reclength,my_off_t *filepos,
ulong *length);
-static int update_dynamic_record(MI_INFO *info,my_off_t filepos,byte *record,
+static int update_dynamic_record(MI_INFO *info,my_off_t filepos,uchar *record,
ulong reclength);
static int delete_dynamic_record(MI_INFO *info,my_off_t filepos,
uint second_read);
-static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos,
+static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
uint length);
#ifdef THREAD
@@ -79,13 +79,13 @@ my_bool mi_dynmap_file(MI_INFO *info, my_off_t size)
mapping. When swap space is not reserved one might get SIGSEGV
upon a write if no physical memory is available.
*/
- info->s->file_map= (byte*)
+ info->s->file_map= (uchar*)
my_mmap(0, (size_t)(size + MEMMAP_EXTRA_MARGIN),
info->s->mode==O_RDONLY ? PROT_READ :
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_NORESERVE,
info->dfile, 0L);
- if (info->s->file_map == (byte*) MAP_FAILED)
+ if (info->s->file_map == (uchar*) MAP_FAILED)
{
info->s->file_map= NULL;
DBUG_RETURN(1);
@@ -135,7 +135,7 @@ void mi_remap_file(MI_INFO *info, my_off_t size)
0 ok
*/
-uint mi_mmap_pread(MI_INFO *info, byte *Buffer,
+uint mi_mmap_pread(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags)
{
DBUG_PRINT("info", ("mi_read with mmap %d\n", info->dfile));
@@ -167,7 +167,7 @@ uint mi_mmap_pread(MI_INFO *info, byte *Buffer,
/* wrapper for my_pread in case if mmap isn't used */
-uint mi_nommap_pread(MI_INFO *info, byte *Buffer,
+uint mi_nommap_pread(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags)
{
return my_pread(info->dfile, Buffer, Count, offset, MyFlags);
@@ -190,7 +190,7 @@ uint mi_nommap_pread(MI_INFO *info, byte *Buffer,
!=0 error. In this case return error from pwrite
*/
-uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer,
+uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags)
{
DBUG_PRINT("info", ("mi_write with mmap %d\n", info->dfile));
@@ -224,28 +224,28 @@ uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer,
/* wrapper for my_pwrite in case if mmap isn't used */
-uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer,
+uint mi_nommap_pwrite(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags)
{
return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags);
}
-int _mi_write_dynamic_record(MI_INFO *info, const byte *record)
+int _mi_write_dynamic_record(MI_INFO *info, const uchar *record)
{
ulong reclength=_mi_rec_pack(info,info->rec_buff,record);
return (write_dynamic_record(info,info->rec_buff,reclength));
}
-int _mi_update_dynamic_record(MI_INFO *info, my_off_t pos, const byte *record)
+int _mi_update_dynamic_record(MI_INFO *info, my_off_t pos, const uchar *record)
{
uint length=_mi_rec_pack(info,info->rec_buff,record);
return (update_dynamic_record(info,pos,info->rec_buff,length));
}
-int _mi_write_blob_record(MI_INFO *info, const byte *record)
+int _mi_write_blob_record(MI_INFO *info, const uchar *record)
{
- byte *rec_buff;
+ uchar *rec_buff;
int error;
ulong reclength,reclength2,extra;
@@ -260,7 +260,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
return -1;
}
#endif
- if (!(rec_buff=(byte*) my_alloca(reclength)))
+ if (!(rec_buff=(uchar*) my_alloca(reclength)))
{
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(-1);
@@ -277,9 +277,9 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
}
-int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record)
+int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const uchar *record)
{
- byte *rec_buff;
+ uchar *rec_buff;
int error;
ulong reclength,extra;
@@ -294,7 +294,7 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record)
return -1;
}
#endif
- if (!(rec_buff=(byte*) my_alloca(reclength)))
+ if (!(rec_buff=(uchar*) my_alloca(reclength)))
{
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(-1);
@@ -317,7 +317,7 @@ int _mi_delete_dynamic_record(MI_INFO *info)
/* Write record to data-file */
-static int write_dynamic_record(MI_INFO *info, const byte *record,
+static int write_dynamic_record(MI_INFO *info, const uchar *record,
ulong reclength)
{
int flag;
@@ -333,7 +333,7 @@ static int write_dynamic_record(MI_INFO *info, const byte *record,
if (_mi_write_part_record(info,filepos,length,
(info->append_insert_at_end ?
HA_OFFSET_ERROR : info->s->state.dellink),
- (byte**) &record,&reclength,&flag))
+ (uchar**) &record,&reclength,&flag))
goto err;
} while (reclength);
@@ -543,7 +543,7 @@ static int delete_dynamic_record(MI_INFO *info, my_off_t filepos,
bfill(block_info.header+12,8,255);
else
mi_sizestore(block_info.header+12,block_info.next_filepos);
- if (info->s->file_write(info,(byte*) block_info.header,20,filepos,
+ if (info->s->file_write(info,(uchar*) block_info.header,20,filepos,
MYF(MY_NABP)))
DBUG_RETURN(1);
info->s->state.dellink = filepos;
@@ -566,12 +566,12 @@ int _mi_write_part_record(MI_INFO *info,
my_off_t filepos, /* points at empty block */
ulong length, /* length of block */
my_off_t next_filepos,/* Next empty block */
- byte **record, /* pointer to record ptr */
+ uchar **record, /* pointer to record ptr */
ulong *reclength, /* length of *record */
int *flag) /* *flag == 0 if header */
{
ulong head_length,res_length,extra_length,long_block,del_length;
- byte *pos,*record_end;
+ uchar *pos,*record_end;
my_off_t next_delete_block;
uchar temp[MI_SPLIT_LENGTH+MI_DYN_DELETE_BLOCK_HEADER];
DBUG_ENTER("_mi_write_part_record");
@@ -615,7 +615,7 @@ int _mi_write_part_record(MI_INFO *info,
temp[0]=13;
mi_int4store(temp+1,*reclength);
mi_int3store(temp+5,length-head_length);
- mi_sizestore((byte*) temp+8,next_filepos);
+ mi_sizestore((uchar*) temp+8,next_filepos);
}
else
{
@@ -625,13 +625,13 @@ int _mi_write_part_record(MI_INFO *info,
{
mi_int3store(temp+1,*reclength);
mi_int3store(temp+4,length-head_length);
- mi_sizestore((byte*) temp+7,next_filepos);
+ mi_sizestore((uchar*) temp+7,next_filepos);
}
else
{
mi_int2store(temp+1,*reclength);
mi_int2store(temp+3,length-head_length);
- mi_sizestore((byte*) temp+5,next_filepos);
+ mi_sizestore((uchar*) temp+5,next_filepos);
}
}
}
@@ -642,12 +642,12 @@ int _mi_write_part_record(MI_INFO *info,
if (long_block)
{
mi_int3store(temp+1,length-head_length);
- mi_sizestore((byte*) temp+4,next_filepos);
+ mi_sizestore((uchar*) temp+4,next_filepos);
}
else
{
mi_int2store(temp+1,length-head_length);
- mi_sizestore((byte*) temp+3,next_filepos);
+ mi_sizestore((uchar*) temp+3,next_filepos);
}
}
}
@@ -668,14 +668,14 @@ int _mi_write_part_record(MI_INFO *info,
}
length= *reclength+head_length; /* Write only what is needed */
}
- DBUG_DUMP("header",(byte*) temp,head_length);
+ DBUG_DUMP("header",(uchar*) temp,head_length);
/* Make a long block for one write */
record_end= *record+length-head_length;
del_length=(res_length ? MI_DYN_DELETE_BLOCK_HEADER : 0);
- bmove((byte*) (*record-head_length),(byte*) temp,head_length);
+ bmove((uchar*) (*record-head_length),(uchar*) temp,head_length);
memcpy(temp,record_end,(size_t) (extra_length+del_length));
- bzero((byte*) record_end,extra_length);
+ bzero((uchar*) record_end,extra_length);
if (res_length)
{
@@ -715,18 +715,18 @@ int _mi_write_part_record(MI_INFO *info,
if (info->update & HA_STATE_EXTEND_BLOCK)
{
info->update&= ~HA_STATE_EXTEND_BLOCK;
- if (my_block_write(&info->rec_cache,(byte*) *record-head_length,
+ if (my_block_write(&info->rec_cache,(uchar*) *record-head_length,
length+extra_length+del_length,filepos))
goto err;
}
- else if (my_b_write(&info->rec_cache,(byte*) *record-head_length,
+ else if (my_b_write(&info->rec_cache,(uchar*) *record-head_length,
length+extra_length+del_length))
goto err;
}
else
{
info->rec_cache.seek_not_done=1;
- if (info->s->file_write(info,(byte*) *record-head_length,length+extra_length+
+ if (info->s->file_write(info,(uchar*) *record-head_length,length+extra_length+
del_length,filepos,info->s->write_flag))
goto err;
}
@@ -752,7 +752,7 @@ err:
/* update record from datafile */
-static int update_dynamic_record(MI_INFO *info, my_off_t filepos, byte *record,
+static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record,
ulong reclength)
{
int flag;
@@ -836,7 +836,7 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, byte *record,
mi_int3store(del_block.header+1, rest_length);
mi_sizestore(del_block.header+4,info->s->state.dellink);
bfill(del_block.header+12,8,255);
- if (info->s->file_write(info,(byte*) del_block.header,20, next_pos,
+ if (info->s->file_write(info,(uchar*) del_block.header,20, next_pos,
MYF(MY_NABP)))
DBUG_RETURN(1);
info->s->state.dellink= next_pos;
@@ -875,10 +875,11 @@ err:
/* Pack a record. Return new reclength */
-uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
+uint _mi_rec_pack(MI_INFO *info, register uchar *to,
+ register const uchar *from)
{
uint length,new_length,flag,bit,i;
- char *pos,*end,*startpos,*packpos;
+ uchar *pos,*end,*startpos,*packpos;
enum en_fieldtype type;
reg3 MI_COLUMNDEF *rec;
MI_BLOB *blob;
@@ -901,7 +902,7 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
{
char *temp_pos;
size_t tmp_length=length-mi_portable_sizeof_char_ptr;
- memcpy((byte*) to,from,tmp_length);
+ memcpy((uchar*) to,from,tmp_length);
memcpy_fixed(&temp_pos,from+tmp_length,sizeof(char*));
memcpy(to+tmp_length,temp_pos,(size_t) blob->length);
to+=tmp_length+blob->length;
@@ -910,17 +911,17 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
}
else if (type == FIELD_SKIP_ZERO)
{
- if (memcmp((byte*) from,zero_string,length) == 0)
+ if (memcmp((uchar*) from,zero_string,length) == 0)
flag|=bit;
else
{
- memcpy((byte*) to,from,(size_t) length); to+=length;
+ memcpy((uchar*) to,from,(size_t) length); to+=length;
}
}
else if (type == FIELD_SKIP_ENDSPACE ||
type == FIELD_SKIP_PRESPACE)
{
- pos= (byte*) from; end= (byte*) from + length;
+ pos= (uchar*) from; end= (uchar*) from + length;
if (type == FIELD_SKIP_ENDSPACE)
{ /* Pack trailing spaces */
while (end > from && *(end-1) == ' ')
@@ -943,7 +944,7 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
}
else
*to++= (char) new_length;
- memcpy((byte*) to,pos,(size_t) new_length); to+=new_length;
+ memcpy((uchar*) to,pos,(size_t) new_length); to+=new_length;
flag|=bit;
}
else
@@ -1000,11 +1001,11 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
Returns 0 if record is ok.
*/
-my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff,
+my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *rec_buff,
ulong packed_length, my_bool with_checksum)
{
uint length,new_length,flag,bit,i;
- char *pos,*end,*packpos,*to;
+ uchar *pos,*end,*packpos,*to;
enum en_fieldtype type;
reg3 MI_COLUMNDEF *rec;
DBUG_ENTER("_mi_rec_check");
@@ -1029,7 +1030,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff,
}
else if (type == FIELD_SKIP_ZERO)
{
- if (memcmp((byte*) record,zero_string,length) == 0)
+ if (memcmp((uchar*) record,zero_string,length) == 0)
{
if (!(flag & bit))
goto err;
@@ -1040,7 +1041,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff,
else if (type == FIELD_SKIP_ENDSPACE ||
type == FIELD_SKIP_PRESPACE)
{
- pos= (byte*) record; end= (byte*) record + length;
+ pos= (uchar*) record; end= (uchar*) record + length;
if (type == FIELD_SKIP_ENDSPACE)
{ /* Pack trailing spaces */
while (end > record && *(end-1) == ' ')
@@ -1122,12 +1123,12 @@ err:
/* Returns -1 and my_errno =HA_ERR_RECORD_DELETED if reclength isn't */
/* right. Returns reclength (>0) if ok */
-ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
+ulong _mi_rec_unpack(register MI_INFO *info, register uchar *to, uchar *from,
ulong found_length)
{
uint flag,bit,length,rec_length,min_pack_length;
enum en_fieldtype type;
- byte *from_end,*to_end,*packpos;
+ uchar *from_end,*to_end,*packpos;
reg3 MI_COLUMNDEF *rec,*end_field;
DBUG_ENTER("_mi_rec_unpack");
@@ -1173,7 +1174,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
if (flag & bit)
{
if (type == FIELD_BLOB || type == FIELD_SKIP_ZERO)
- bzero((byte*) to,rec_length);
+ bzero((uchar*) to,rec_length);
else if (type == FIELD_SKIP_ENDSPACE ||
type == FIELD_SKIP_PRESPACE)
{
@@ -1195,13 +1196,13 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
goto err;
if (type == FIELD_SKIP_ENDSPACE)
{
- memcpy(to,(byte*) from,(size_t) length);
- bfill((byte*) to+length,rec_length-length,' ');
+ memcpy(to,(uchar*) from,(size_t) length);
+ bfill((uchar*) to+length,rec_length-length,' ');
}
else
{
- bfill((byte*) to,rec_length-length,' ');
- memcpy(to+rec_length-length,(byte*) from,(size_t) length);
+ bfill((uchar*) to,rec_length-length,' ');
+ memcpy(to+rec_length-length,(uchar*) from,(size_t) length);
}
from+=length;
}
@@ -1215,9 +1216,9 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
from_left - size_length < blob_length ||
from_left - size_length - blob_length < min_pack_length)
goto err;
- memcpy((byte*) to,(byte*) from,(size_t) size_length);
+ memcpy((uchar*) to,(uchar*) from,(size_t) size_length);
from+=size_length;
- memcpy_fixed((byte*) to+size_length,(byte*) &from,sizeof(char*));
+ memcpy_fixed((uchar*) to+size_length,(uchar*) &from,sizeof(char*));
from+=blob_length;
}
else
@@ -1226,7 +1227,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
min_pack_length--;
if (min_pack_length + rec_length > (uint) (from_end - from))
goto err;
- memcpy(to,(byte*) from,(size_t) rec_length); from+=rec_length;
+ memcpy(to,(uchar*) from,(size_t) rec_length); from+=rec_length;
}
if ((bit= bit << 1) >= 256)
{
@@ -1238,7 +1239,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
if (min_pack_length > (uint) (from_end - from))
goto err;
min_pack_length-=rec_length;
- memcpy(to, (byte*) from, (size_t) rec_length);
+ memcpy(to, (uchar*) from, (size_t) rec_length);
from+=rec_length;
}
}
@@ -1251,14 +1252,14 @@ err:
my_errno= HA_ERR_WRONG_IN_RECORD;
DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx from_end: 0x%lx -> 0x%lx",
(long) to, (long) to_end, (long) from, (long) from_end));
- DBUG_DUMP("from",(byte*) info->rec_buff,info->s->base.min_pack_length);
+ DBUG_DUMP("from",(uchar*) info->rec_buff,info->s->base.min_pack_length);
DBUG_RETURN(MY_FILE_ERROR);
} /* _mi_rec_unpack */
/* Calc length of blob. Update info in blobs->length */
-ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record)
+ulong _my_calc_total_blob_length(MI_INFO *info, const uchar *record)
{
ulong length;
MI_BLOB *blob,*end;
@@ -1274,7 +1275,7 @@ ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record)
}
-ulong _mi_calc_blob_length(uint length, const byte *pos)
+ulong _mi_calc_blob_length(uint length, const uchar *pos)
{
switch (length) {
case 1:
@@ -1292,7 +1293,7 @@ ulong _mi_calc_blob_length(uint length, const byte *pos)
}
-void _my_store_blob_length(byte *pos,uint pack_length,uint length)
+void _my_store_blob_length(uchar *pos,uint pack_length,uint length)
{
switch (pack_length) {
case 1:
@@ -1345,11 +1346,11 @@ void _my_store_blob_length(byte *pos,uint pack_length,uint length)
-1 Error
*/
-int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf)
+int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *buf)
{
int block_of_record;
uint b_type,left_length;
- byte *to;
+ uchar *to;
MI_BLOCK_INFO block_info;
File file;
DBUG_ENTER("mi_read_dynamic_record");
@@ -1405,7 +1406,7 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf)
prefetch_len= block_info.data_len;
if (prefetch_len)
{
- memcpy((byte*) to, block_info.header + offset, prefetch_len);
+ memcpy((uchar*) to, block_info.header + offset, prefetch_len);
block_info.data_len-= prefetch_len;
left_length-= prefetch_len;
to+= prefetch_len;
@@ -1423,7 +1424,7 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf)
there is no equivalent without seeking. We are at the right
position already. :(
*/
- if (info->s->file_read(info, (byte*) to, block_info.data_len,
+ if (info->s->file_read(info, (uchar*) to, block_info.data_len,
filepos, MYF(MY_NABP)))
goto panic;
left_length-=block_info.data_len;
@@ -1450,9 +1451,9 @@ err:
/* compare unique constraint between stored rows */
int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def,
- const byte *record, my_off_t pos)
+ const uchar *record, my_off_t pos)
{
- byte *rec_buff,*old_record;
+ uchar *rec_buff,*old_record;
int error;
DBUG_ENTER("_mi_cmp_dynamic_unique");
@@ -1478,11 +1479,11 @@ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def,
/* Compare of record one disk with packed record in memory */
-int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record)
+int _mi_cmp_dynamic_record(register MI_INFO *info, register const uchar *record)
{
uint flag,reclength,b_type;
my_off_t filepos;
- byte *buffer;
+ uchar *buffer;
MI_BLOCK_INFO block_info;
DBUG_ENTER("_mi_cmp_dynamic_record");
@@ -1504,7 +1505,7 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record)
{ /* If check isn't disabled */
if (info->s->base.blobs)
{
- if (!(buffer=(byte*) my_alloca(info->s->base.pack_reclength+
+ if (!(buffer=(uchar*) my_alloca(info->s->base.pack_reclength+
_my_calc_total_blob_length(info,record))))
DBUG_RETURN(-1);
}
@@ -1552,14 +1553,14 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record)
my_errno=0;
err:
if (buffer != info->rec_buff)
- my_afree((gptr) buffer);
+ my_afree((uchar*) buffer);
DBUG_RETURN(my_errno);
}
/* Compare file to buffert */
-static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos,
+static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
uint length)
{
uint next_length;
@@ -1571,7 +1572,7 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos,
while (length > IO_SIZE*2)
{
if (my_pread(file,temp_buff,next_length,filepos, MYF(MY_NABP)) ||
- memcmp((byte*) buff,temp_buff,next_length))
+ memcmp((uchar*) buff,temp_buff,next_length))
goto err;
filepos+=next_length;
buff+=next_length;
@@ -1580,7 +1581,7 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos,
}
if (my_pread(file,temp_buff,length,filepos,MYF(MY_NABP)))
goto err;
- DBUG_RETURN(memcmp((byte*) buff,temp_buff,length));
+ DBUG_RETURN(memcmp((uchar*) buff,temp_buff,length));
err:
DBUG_RETURN(1);
}
@@ -1620,13 +1621,13 @@ err:
!= 0 Error
*/
-int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
+int _mi_read_rnd_dynamic_record(MI_INFO *info, uchar *buf,
register my_off_t filepos,
my_bool skip_deleted_blocks)
{
int block_of_record, info_read, save_errno;
uint left_len,b_type;
- byte *to;
+ uchar *to;
MI_BLOCK_INFO block_info;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("_mi_read_rnd_dynamic_record");
@@ -1672,7 +1673,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
}
if (info->opt_flag & READ_CACHE_USED)
{
- if (_mi_read_cache(&info->rec_cache,(byte*) block_info.header,filepos,
+ if (_mi_read_cache(&info->rec_cache,(uchar*) block_info.header,filepos,
sizeof(block_info.header),
(!block_of_record && skip_deleted_blocks ?
READING_NEXT : 0) | READING_HEADER))
@@ -1735,7 +1736,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
tmp_length= block_info.data_len;
if (tmp_length)
{
- memcpy((byte*) to, block_info.header+offset,tmp_length);
+ memcpy((uchar*) to, block_info.header+offset,tmp_length);
block_info.data_len-=tmp_length;
left_len-=tmp_length;
to+=tmp_length;
@@ -1747,7 +1748,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
{
if (info->opt_flag & READ_CACHE_USED)
{
- if (_mi_read_cache(&info->rec_cache,(byte*) to,filepos,
+ if (_mi_read_cache(&info->rec_cache,(uchar*) to,filepos,
block_info.data_len,
(!block_of_record && skip_deleted_blocks) ?
READING_NEXT : 0))
@@ -1761,7 +1762,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
flush_io_cache(&info->rec_cache))
goto err;
/* VOID(my_seek(info->dfile,filepos,MY_SEEK_SET,MYF(0))); */
- if (my_read(info->dfile,(byte*) to,block_info.data_len,MYF(MY_NABP)))
+ if (my_read(info->dfile,(uchar*) to,block_info.data_len,MYF(MY_NABP)))
{
if (my_errno == -1)
my_errno= HA_ERR_WRONG_IN_RECORD; /* Unexpected end of file */
@@ -1818,7 +1819,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
sizeof(info->header))
goto err;
}
- DBUG_DUMP("header",(byte*) header,MI_BLOCK_INFO_HEADER_LENGTH);
+ DBUG_DUMP("header",(uchar*) header,MI_BLOCK_INFO_HEADER_LENGTH);
if (info->second_read)
{
if (info->header[0] <= 6 || info->header[0] == 13)
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index 729174b6f88..72c40741a22 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -180,8 +180,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
case HA_EXTRA_KEYREAD: /* Read only keys to record */
case HA_EXTRA_REMEMBER_POS:
info->opt_flag |= REMEMBER_OLD_POS;
- bmove((byte*) info->lastkey+share->base.max_key_length*2,
- (byte*) info->lastkey,info->lastkey_length);
+ bmove((uchar*) info->lastkey+share->base.max_key_length*2,
+ (uchar*) info->lastkey,info->lastkey_length);
info->save_update= info->update;
info->save_lastinx= info->lastinx;
info->save_lastpos= info->lastpos;
@@ -197,8 +197,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
case HA_EXTRA_RESTORE_POS:
if (info->opt_flag & REMEMBER_OLD_POS)
{
- bmove((byte*) info->lastkey,
- (byte*) info->lastkey+share->base.max_key_length*2,
+ bmove((uchar*) info->lastkey,
+ (uchar*) info->lastkey+share->base.max_key_length*2,
info->save_lastkey_length);
info->update= info->save_update | HA_STATE_WRITTEN;
info->lastinx= info->save_lastinx;
@@ -385,7 +385,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
{
char tmp[1];
tmp[0]=function;
- myisam_log_command(MI_LOG_EXTRA,info,(byte*) tmp,1,error);
+ myisam_log_command(MI_LOG_EXTRA,info,(uchar*) tmp,1,error);
}
DBUG_RETURN(error);
} /* mi_extra */
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c
index 2f4915dec39..230ebac3bb0 100644
--- a/storage/myisam/mi_key.c
+++ b/storage/myisam/mi_key.c
@@ -31,7 +31,7 @@
set_if_smaller(char_length,length); \
} while(0)
-static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record);
+static int _mi_put_key_in_record(MI_INFO *info,uint keynr,uchar *record);
/*
Make a intern key from a record
@@ -49,9 +49,9 @@ static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record);
*/
uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
- const byte *record, my_off_t filepos)
+ const uchar *record, my_off_t filepos)
{
- byte *pos;
+ uchar *pos;
uchar *start;
reg1 HA_KEYSEG *keyseg;
my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT;
@@ -90,7 +90,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
char_length= ((!is_ft && cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen :
length);
- pos= (byte*) record+keyseg->start;
+ pos= (uchar*) record+keyseg->start;
if (type == HA_KEYTYPE_BIT)
{
if (keyseg->bit_length)
@@ -100,7 +100,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
*key++= bits;
length--;
}
- memcpy((byte*) key, pos, length);
+ memcpy((uchar*) key, pos, length);
key+= length;
continue;
}
@@ -112,14 +112,14 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
}
else
{
- byte *end= pos + length;
+ uchar *end= pos + length;
while (pos < end && pos[0] == ' ')
pos++;
length=(uint) (end-pos);
}
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key,(byte*) pos,(size_t) char_length);
+ memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
key+=char_length;
continue;
}
@@ -132,18 +132,18 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
set_if_smaller(length,tmp_length);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key,(byte*) pos,(size_t) char_length);
+ memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
key+= char_length;
continue;
}
else if (keyseg->flag & HA_BLOB_PART)
{
uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos);
- memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*));
+ memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*));
set_if_smaller(length,tmp_length);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key,(byte*) pos,(size_t) char_length);
+ memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
key+= char_length;
continue;
}
@@ -182,14 +182,14 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
continue;
}
FIX_LENGTH(cs, pos, length, char_length);
- memcpy((byte*) key, pos, char_length);
+ memcpy((uchar*) key, pos, char_length);
if (length > char_length)
cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' ');
key+= length;
}
_mi_dpointer(info,key,filepos);
DBUG_PRINT("exit",("keynr: %d",keynr));
- DBUG_DUMP("key",(byte*) start,(uint) (key-start)+keyseg->length);
+ DBUG_DUMP("key",(uchar*) start,(uint) (key-start)+keyseg->length);
DBUG_EXECUTE("key",
_mi_print_key(DBUG_FILE,info->s->keyinfo[keynr].seg,start,
(uint) (key-start)););
@@ -267,7 +267,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
length=(uint) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key,pos,(size_t) char_length);
+ memcpy((uchar*) key,pos,(size_t) char_length);
key+= char_length;
continue;
}
@@ -280,7 +280,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
old+=2; /* Skip length */
- memcpy((byte*) key, pos,(size_t) char_length);
+ memcpy((uchar*) key, pos,(size_t) char_length);
key+= char_length;
continue;
}
@@ -292,7 +292,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
continue;
}
FIX_LENGTH(cs, pos, length, char_length);
- memcpy((byte*) key, pos, char_length);
+ memcpy((uchar*) key, pos, char_length);
if (length > char_length)
cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' ');
key+= length;
@@ -325,16 +325,16 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
*/
static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
- byte *record)
+ uchar *record)
{
- reg2 byte *key;
- byte *pos,*key_end;
+ reg2 uchar *key;
+ uchar *pos,*key_end;
reg1 HA_KEYSEG *keyseg;
- byte *blob_ptr;
+ uchar *blob_ptr;
DBUG_ENTER("_mi_put_key_in_record");
- blob_ptr= (byte*) info->lastkey2; /* Place to put blob parts */
- key=(byte*) info->lastkey; /* KEy that was read */
+ blob_ptr= (uchar*) info->lastkey2; /* Place to put blob parts */
+ key=(uchar*) info->lastkey; /* KEy that was read */
key_end=key+info->lastkey_length;
for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++)
{
@@ -363,7 +363,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
clr_rec_bits(record + keyseg->bit_pos, keyseg->bit_start,
keyseg->bit_length);
}
- memcpy(record + keyseg->start, (byte*) key, length);
+ memcpy(record + keyseg->start, (uchar*) key, length);
key+= length;
continue;
}
@@ -406,7 +406,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
else
int2store(record+keyseg->start, length);
/* And key data */
- memcpy(record+keyseg->start + keyseg->bit_start, (byte*) key, length);
+ memcpy(record+keyseg->start + keyseg->bit_start, (uchar*) key, length);
key+= length;
}
else if (keyseg->flag & HA_BLOB_PART)
@@ -431,8 +431,8 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
}
else if (keyseg->flag & HA_SWAP_KEY)
{
- byte *to= record+keyseg->start+keyseg->length;
- byte *end= key+keyseg->length;
+ uchar *to= record+keyseg->start+keyseg->length;
+ uchar *end= key+keyseg->length;
#ifdef CHECK_KEYS
if (end > key_end)
goto err;
@@ -449,7 +449,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
if (key+keyseg->length > key_end)
goto err;
#endif
- memcpy(record+keyseg->start,(byte*) key,
+ memcpy(record+keyseg->start,(uchar*) key,
(size_t) keyseg->length);
key+= keyseg->length;
}
@@ -463,7 +463,7 @@ err:
/* Here when key reads are used */
-int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf)
+int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf)
{
fast_mi_writeinfo(info);
if (filepos != HA_OFFSET_ERROR)
@@ -498,7 +498,7 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf)
less than zero.
*/
-ulonglong retrieve_auto_increment(MI_INFO *info,const byte *record)
+ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record)
{
ulonglong value= 0; /* Store unsigned values here */
longlong s_value= 0; /* Store signed values here */
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index e822ea9e6da..6aa62b70ae3 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -254,7 +254,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
pthread_mutex_unlock(&share->intern_lock);
#if defined(FULL_LOG) || defined(_lint)
lock_type|=(int) (flag << 8); /* Set bit to set if real lock */
- myisam_log_command(MI_LOG_LOCK,info,(byte*) &lock_type,sizeof(lock_type),
+ myisam_log_command(MI_LOG_LOCK,info,(uchar*) &lock_type,sizeof(lock_type),
error);
#endif
DBUG_RETURN(error);
diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c
index f720f752a06..91d3bb6f702 100644
--- a/storage/myisam/mi_log.c
+++ b/storage/myisam/mi_log.c
@@ -74,7 +74,7 @@ int mi_log(int activate_log)
/* All logs starts with command(1) dfile(2) process(4) result(2) */
void _myisam_log(enum myisam_log_commands command, MI_INFO *info,
- const byte *buffert, uint length)
+ const uchar *buffert, uint length)
{
char buff[11];
int error,old_errno;
@@ -98,7 +98,7 @@ void _myisam_log(enum myisam_log_commands command, MI_INFO *info,
void _myisam_log_command(enum myisam_log_commands command, MI_INFO *info,
- const byte *buffert, uint length, int result)
+ const uchar *buffert, uint length, int result)
{
char buff[9];
int error,old_errno;
@@ -122,7 +122,7 @@ void _myisam_log_command(enum myisam_log_commands command, MI_INFO *info,
void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info,
- const byte *record, my_off_t filepos, int result)
+ const uchar *record, my_off_t filepos, int result)
{
char buff[21],*pos;
int error,old_errno;
@@ -143,7 +143,7 @@ void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info,
pthread_mutex_lock(&THR_LOCK_myisam);
error=my_lock(myisam_log_file,F_WRLCK,0L,F_TO_EOF,MYF(MY_SEEK_NOT_DONE));
VOID(my_write(myisam_log_file,buff,sizeof(buff),MYF(0)));
- VOID(my_write(myisam_log_file,(byte*) record,info->s->base.reclength,MYF(0)));
+ VOID(my_write(myisam_log_file,(uchar*) record,info->s->base.reclength,MYF(0)));
if (info->s->base.blobs)
{
MI_BLOB *blob,*end;
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index f4e089b6313..9ff8ecdb14d 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -92,7 +92,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
lock_error=1;
errpos=0;
head_length=sizeof(share_buff.state.header);
- bzero((byte*) &info,sizeof(info));
+ bzero((uchar*) &info,sizeof(info));
my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT,
MY_UNPACK_FILENAME),MYF(0));
@@ -100,7 +100,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
if (!(old_info=test_if_reopen(name_buff)))
{
share= &share_buff;
- bzero((gptr) &share_buff,sizeof(share_buff));
+ bzero((uchar*) &share_buff,sizeof(share_buff));
share_buff.state.rec_per_key_part=rec_per_key_part;
share_buff.state.key_root=key_root;
share_buff.state.key_del=key_del;
@@ -127,8 +127,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
my_errno= HA_ERR_NOT_A_TABLE;
goto err;
}
- if (memcmp((byte*) share->state.header.file_version,
- (byte*) myisam_file_magic, 4))
+ if (memcmp((uchar*) share->state.header.file_version,
+ (uchar*) myisam_file_magic, 4))
{
DBUG_PRINT("error",("Wrong header in %s",name_buff));
DBUG_DUMP("error_dump",(char*) share->state.header.file_version,
@@ -504,7 +504,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
else if (share->options & HA_OPTION_PACK_RECORD)
share->data_file_type = DYNAMIC_RECORD;
- my_afree((gptr) disk_cache);
+ my_afree((uchar*) disk_cache);
mi_setup_functions(share);
share->is_log_table= FALSE;
#ifdef THREAD
@@ -642,7 +642,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
if (myisam_log_file >= 0)
{
intern_filename(name_buff,share->index_file_name);
- _myisam_log(MI_LOG_OPEN,m_info,name_buff,(uint) strlen(name_buff));
+ _myisam_log(MI_LOG_OPEN, m_info,name_buff, strlen(name_buff));
}
DBUG_RETURN(m_info);
@@ -654,7 +654,7 @@ err:
mi_report_error(save_errno, name);
switch (errpos) {
case 6:
- my_free((gptr) m_info,MYF(0));
+ my_free((uchar*) m_info,MYF(0));
/* fall through */
case 5:
VOID(my_close(info.dfile,MYF(0)));
@@ -662,14 +662,14 @@ err:
break; /* Don't remove open table */
/* fall through */
case 4:
- my_free((gptr) share,MYF(0));
+ my_free((uchar*) share,MYF(0));
/* fall through */
case 3:
if (! lock_error)
VOID(my_lock(kfile, F_UNLCK, 0L, F_TO_EOF, MYF(MY_SEEK_NOT_DONE)));
/* fall through */
case 2:
- my_afree((gptr) disk_cache);
+ my_afree((uchar*) disk_cache);
/* fall through */
case 1:
VOID(my_close(kfile,MYF(0)));
@@ -684,7 +684,7 @@ err:
} /* mi_open */
-byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf)
+uchar *mi_alloc_rec_buff(MI_INFO *info, ulong length, uchar **buf)
{
uint extra;
uint32 old_length;
@@ -692,7 +692,7 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf)
if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf)))
{
- byte *newptr = *buf;
+ uchar *newptr = *buf;
/* to simplify initial init of info->rec_buf in mi_open and mi_extra */
if (length == (ulong) -1)
@@ -709,7 +709,7 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf)
MI_REC_BUFF_OFFSET : 0);
if (extra && newptr)
newptr-= MI_REC_BUFF_OFFSET;
- if (!(newptr=(byte*) my_realloc((gptr)newptr, length+extra+8,
+ if (!(newptr=(uchar*) my_realloc((uchar*)newptr, length+extra+8,
MYF(MY_ALLOW_ZERO_PTR))))
return newptr;
*((uint32 *) newptr)= (uint32) length;
@@ -899,10 +899,10 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite)
}
if (pWrite & 1)
- DBUG_RETURN(my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L,
- MYF(MY_NABP | MY_THREADSAFE)));
- DBUG_RETURN(my_write(file, (char*) buff, (uint) (ptr-buff),
- MYF(MY_NABP)));
+ DBUG_RETURN(my_pwrite(file, buff, (size_t) (ptr-buff), 0L,
+ MYF(MY_NABP | MY_THREADSAFE)) != 0);
+ DBUG_RETURN(my_write(file, buff, (size_t) (ptr-buff),
+ MYF(MY_NABP)) != 0);
}
@@ -968,10 +968,10 @@ uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead)
if (pRead)
{
if (my_pread(file, buff, state->state_length,0L, MYF(MY_NABP)))
- return (MY_FILE_ERROR);
+ return 1;
}
else if (my_read(file, buff, state->state_length,MYF(MY_NABP)))
- return (MY_FILE_ERROR);
+ return 1;
mi_state_info_read((uchar*) buff, state);
}
return 0;
@@ -1013,7 +1013,7 @@ uint mi_base_info_write(File file, MI_BASE_INFO *base)
mi_int2store(ptr,base->raid_chunks); ptr +=2;
mi_int4store(ptr,base->raid_chunksize); ptr +=4;
bzero(ptr,6); ptr +=6; /* extra */
- return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
@@ -1073,7 +1073,7 @@ uint mi_keydef_write(File file, MI_KEYDEF *keydef)
mi_int2store(ptr,keydef->keylength); ptr +=2;
mi_int2store(ptr,keydef->minlength); ptr +=2;
mi_int2store(ptr,keydef->maxlength); ptr +=2;
- return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef)
@@ -1117,7 +1117,7 @@ int mi_keyseg_write(File file, const HA_KEYSEG *keyseg)
mi_int4store(ptr, pos);
ptr+=4;
- return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
@@ -1157,7 +1157,7 @@ uint mi_uniquedef_write(File file, MI_UNIQUEDEF *def)
*ptr++= (uchar) def->key;
*ptr++ = (uchar) def->null_are_equal;
- return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
char *mi_uniquedef_read(char *ptr, MI_UNIQUEDEF *def)
@@ -1181,7 +1181,7 @@ uint mi_recinfo_write(File file, MI_COLUMNDEF *recinfo)
mi_int2store(ptr,recinfo->length); ptr +=2;
*ptr++ = recinfo->null_bit;
mi_int2store(ptr,recinfo->null_pos); ptr+= 2;
- return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo)
@@ -1202,7 +1202,8 @@ The argument file_to_dup is here for the future if there would on some OS
exist a dup()-like call that would give us two different file descriptors.
*************************************************************************/
-int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup __attribute__((unused)))
+int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share,
+ File file_to_dup __attribute__((unused)))
{
#ifdef USE_RAID
if (share->base.raid_type)
diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c
index a5a9aaededd..1231ef026f7 100644
--- a/storage/myisam/mi_packrec.c
+++ b/storage/myisam/mi_packrec.c
@@ -48,7 +48,7 @@
#define OFFSET_TABLE_SIZE 512
static uint read_huff_table(MI_BIT_BUFF *bit_buff,MI_DECODE_TREE *decode_tree,
- uint16 **decode_table,byte **intervall_buff,
+ uint16 **decode_table,uchar **intervall_buff,
uint16 *tmp_buff);
static void make_quick_table(uint16 *to_table,uint16 *decode_table,
uint *next_free,uint value,uint bits,
@@ -107,7 +107,7 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff);
static uint max_bit(uint value);
#ifdef HAVE_MMAP
static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
- MI_BLOCK_INFO *info, byte **rec_buff_p,
+ MI_BLOCK_INFO *info, uchar **rec_buff_p,
uchar *header);
#endif
@@ -136,7 +136,8 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
uint i,trees,huff_tree_bits,rec_reflength,length;
uint16 *decode_table,*tmp_buff;
ulong elements,intervall_length;
- char *disk_cache,*intervall_buff;
+ char *disk_cache;
+ uchar *intervall_buff;
uchar header[HEAD_LENGTH];
MYISAM_SHARE *share=info->s;
MI_BIT_BUFF bit_buff;
@@ -149,14 +150,14 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
file=info->dfile;
my_errno=0;
- if (my_read(file,(byte*) header,sizeof(header),MYF(MY_NABP)))
+ if (my_read(file,(uchar*) header,sizeof(header),MYF(MY_NABP)))
{
if (!my_errno)
my_errno=HA_ERR_END_OF_FILE;
goto err0;
}
/* Only the first three bytes of magic number are independent of version. */
- if (memcmp((byte*) header, (byte*) myisam_pack_file_magic, 3))
+ if (memcmp((uchar*) header, (uchar*) myisam_pack_file_magic, 3))
{
my_errno=HA_ERR_WRONG_IN_RECORD;
goto err0;
@@ -195,10 +196,10 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
*/
if (!(share->decode_trees=(MI_DECODE_TREE*)
my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+
- intervall_length*sizeof(byte)),
+ intervall_length*sizeof(uchar)),
MYF(MY_WME))))
goto err0;
- intervall_buff=(byte*) (share->decode_trees+trees);
+ intervall_buff=(uchar*) (share->decode_trees+trees);
/*
Memory segment #2:
@@ -215,7 +216,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
MYF(MY_WME | MY_ZEROFILL))))
goto err1;
tmp_buff=share->decode_tables+length;
- disk_cache=(byte*) (tmp_buff+OFFSET_TABLE_SIZE);
+ disk_cache=(uchar*) (tmp_buff+OFFSET_TABLE_SIZE);
if (my_read(file,disk_cache,
(uint) (share->pack.header_length-sizeof(header)),
@@ -250,8 +251,8 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
goto err3;
/* Reallocate the decoding tables to the used size. */
decode_table=(uint16*)
- my_realloc((gptr) share->decode_tables,
- (uint) ((byte*) decode_table - (byte*) share->decode_tables),
+ my_realloc((uchar*) share->decode_tables,
+ (uint) ((uchar*) decode_table - (uchar*) share->decode_tables),
MYF(MY_HOLD_ON_ERROR));
/* Fix the table addresses in the tree heads. */
{
@@ -291,9 +292,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
err3:
my_errno=HA_ERR_WRONG_IN_RECORD;
err2:
- my_free((gptr) share->decode_tables,MYF(0));
+ my_free((uchar*) share->decode_tables,MYF(0));
err1:
- my_free((gptr) share->decode_trees,MYF(0));
+ my_free((uchar*) share->decode_trees,MYF(0));
err0:
DBUG_RETURN(1);
}
@@ -318,7 +319,7 @@ err0:
*/
static uint read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree,
- uint16 **decode_table, byte **intervall_buff,
+ uint16 **decode_table, uchar **intervall_buff,
uint16 *tmp_buff)
{
uint min_chr,elements,char_bits,offset_bits,size,intervall_length,table_bits,
@@ -697,7 +698,7 @@ static uint find_longest_bitstream(uint16 *table, uint16 *end)
HA_ERR_WRONG_IN_RECORD or -1 on error
*/
-int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf)
+int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, uchar *buf)
{
MI_BLOCK_INFO block_info;
File file;
@@ -710,7 +711,7 @@ int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf)
if (_mi_pack_get_block_info(info, &info->bit_buff, &block_info,
&info->rec_buff, file, filepos))
goto err;
- if (my_read(file,(byte*) info->rec_buff + block_info.offset ,
+ if (my_read(file,(uchar*) info->rec_buff + block_info.offset ,
block_info.rec_len - block_info.offset, MYF(MY_NABP)))
goto panic;
info->update|= HA_STATE_AKTIV;
@@ -725,9 +726,9 @@ err:
int _mi_pack_rec_unpack(register MI_INFO *info, MI_BIT_BUFF *bit_buff,
- register byte *to, byte *from, ulong reclength)
+ register uchar *to, uchar *from, ulong reclength)
{
- byte *end_field;
+ uchar *end_field;
reg3 MI_COLUMNDEF *end;
MI_COLUMNDEF *current_field;
MYISAM_SHARE *share=info->s;
@@ -834,7 +835,7 @@ static void uf_space_normal(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
uchar *end)
{
if (get_bit(bit_buff))
- bfill((byte*) to,(end-to),' ');
+ bfill((uchar*) to,(end-to),' ');
else
decode_bytes(rec,bit_buff,to,end);
}
@@ -844,7 +845,7 @@ static void uf_space_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
{
uint spaces;
if (get_bit(bit_buff))
- bfill((byte*) to,(end-to),' ');
+ bfill((uchar*) to,(end-to),' ');
else
{
if (get_bit(bit_buff))
@@ -856,7 +857,7 @@ static void uf_space_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
}
if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces);
- bfill((byte*) end-spaces,spaces,' ');
+ bfill((uchar*) end-spaces,spaces,' ');
}
else
decode_bytes(rec,bit_buff,to,end);
@@ -876,7 +877,7 @@ static void uf_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
}
if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces);
- bfill((byte*) end-spaces,spaces,' ');
+ bfill((uchar*) end-spaces,spaces,' ');
}
else
decode_bytes(rec,bit_buff,to,end);
@@ -887,7 +888,7 @@ static void uf_space_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t
{
uint spaces;
if (get_bit(bit_buff))
- bfill((byte*) to,(end-to),' ');
+ bfill((uchar*) to,(end-to),' ');
else
{
if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end)
@@ -897,7 +898,7 @@ static void uf_space_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t
}
if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces);
- bfill((byte*) end-spaces,spaces,' ');
+ bfill((uchar*) end-spaces,spaces,' ');
}
}
@@ -912,7 +913,7 @@ static void uf_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
}
if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces);
- bfill((byte*) end-spaces,spaces,' ');
+ bfill((uchar*) end-spaces,spaces,' ');
}
static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
@@ -920,7 +921,7 @@ static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
{
uint spaces;
if (get_bit(bit_buff))
- bfill((byte*) to,(end-to),' ');
+ bfill((uchar*) to,(end-to),' ');
else
{
if (get_bit(bit_buff))
@@ -930,7 +931,7 @@ static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
bit_buff->error=1;
return;
}
- bfill((byte*) to,spaces,' ');
+ bfill((uchar*) to,spaces,' ');
if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end);
}
@@ -951,7 +952,7 @@ static void uf_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
bit_buff->error=1;
return;
}
- bfill((byte*) to,spaces,' ');
+ bfill((uchar*) to,spaces,' ');
if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end);
}
@@ -965,7 +966,7 @@ static void uf_space_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t
{
uint spaces;
if (get_bit(bit_buff))
- bfill((byte*) to,(end-to),' ');
+ bfill((uchar*) to,(end-to),' ');
else
{
if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end)
@@ -973,7 +974,7 @@ static void uf_space_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t
bit_buff->error=1;
return;
}
- bfill((byte*) to,spaces,' ');
+ bfill((uchar*) to,spaces,' ');
if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end);
}
@@ -988,7 +989,7 @@ static void uf_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
bit_buff->error=1;
return;
}
- bfill((byte*) to,spaces,' ');
+ bfill((uchar*) to,spaces,' ');
if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end);
}
@@ -1031,7 +1032,7 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
uchar *to, uchar *end)
{
if (get_bit(bit_buff))
- bzero((byte*) to,(end-to));
+ bzero((uchar*) to,(end-to));
else
{
ulong length=get_bits(bit_buff,rec->space_length_bits);
@@ -1039,11 +1040,11 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
if (bit_buff->blob_pos+length > bit_buff->blob_end)
{
bit_buff->error=1;
- bzero((byte*) to,(end-to));
+ bzero((uchar*) to,(end-to));
return;
}
decode_bytes(rec,bit_buff,bit_buff->blob_pos,bit_buff->blob_pos+length);
- _my_store_blob_length((byte*) to,pack_length,length);
+ _my_store_blob_length((uchar*) to,pack_length,length);
memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos,
sizeof(char*));
bit_buff->blob_pos+=length;
@@ -1286,7 +1287,7 @@ static uint decode_pos(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree)
}
-int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
+int _mi_read_rnd_pack_record(MI_INFO *info, uchar *buf,
register my_off_t filepos,
my_bool skip_deleted_blocks)
{
@@ -1303,7 +1304,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
if (info->opt_flag & READ_CACHE_USED)
{
- if (_mi_read_cache(&info->rec_cache, (byte*) block_info.header,
+ if (_mi_read_cache(&info->rec_cache, (uchar*) block_info.header,
filepos, share->pack.ref_length,
skip_deleted_blocks ? READING_NEXT : 0))
goto err;
@@ -1325,14 +1326,14 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
if (info->opt_flag & READ_CACHE_USED)
{
- if (_mi_read_cache(&info->rec_cache, (byte*) info->rec_buff,
+ if (_mi_read_cache(&info->rec_cache, (uchar*) info->rec_buff,
block_info.filepos, block_info.rec_len,
skip_deleted_blocks ? READING_NEXT : 0))
goto err;
}
else
{
- if (my_read(info->dfile,(byte*) info->rec_buff + block_info.offset,
+ if (my_read(info->dfile,(uchar*) info->rec_buff + block_info.offset,
block_info.rec_len-block_info.offset,
MYF(MY_NABP)))
goto err;
@@ -1352,7 +1353,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
/* Read and process header from a huff-record-file */
uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
- MI_BLOCK_INFO *info, byte **rec_buff_p,
+ MI_BLOCK_INFO *info, uchar **rec_buff_p,
File file, my_off_t filepos)
{
uchar *header=info->header;
@@ -1369,7 +1370,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
if (my_read(file,(char*) header,ref_length,MYF(MY_NABP)))
return BLOCK_FATAL_ERROR;
- DBUG_DUMP("header",(byte*) header,ref_length);
+ DBUG_DUMP("header",(uchar*) header,ref_length);
}
head_length= read_pack_length((uint) myisam->s->pack.version, header,
&info->rec_len);
@@ -1478,8 +1479,8 @@ static uint max_bit(register uint value)
#ifdef HAVE_MMAP
-static int _mi_read_mempack_record(MI_INFO *info,my_off_t filepos,byte *buf);
-static int _mi_read_rnd_mempack_record(MI_INFO*, byte *,my_off_t, my_bool);
+static int _mi_read_mempack_record(MI_INFO *info,my_off_t filepos,uchar *buf);
+static int _mi_read_rnd_mempack_record(MI_INFO*, uchar *,my_off_t, my_bool);
my_bool _mi_memmap_file(MI_INFO *info)
{
@@ -1512,7 +1513,7 @@ void _mi_unmap_file(MI_INFO *info)
static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
- MI_BLOCK_INFO *info, byte **rec_buff_p,
+ MI_BLOCK_INFO *info, uchar **rec_buff_p,
uchar *header)
{
header+= read_pack_length((uint) myisam->s->pack.version, header,
@@ -1532,17 +1533,17 @@ static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
}
-static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, byte *buf)
+static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, uchar *buf)
{
MI_BLOCK_INFO block_info;
MYISAM_SHARE *share=info->s;
- byte *pos;
+ uchar *pos;
DBUG_ENTER("mi_read_mempack_record");
if (filepos == HA_OFFSET_ERROR)
DBUG_RETURN(-1); /* _search() didn't find record */
- if (!(pos= (byte*) _mi_mempack_get_block_info(info, &info->bit_buff,
+ if (!(pos= (uchar*) _mi_mempack_get_block_info(info, &info->bit_buff,
&block_info, &info->rec_buff,
(uchar*) share->file_map+
filepos)))
@@ -1553,14 +1554,14 @@ static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, byte *buf)
/*ARGSUSED*/
-static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf,
+static int _mi_read_rnd_mempack_record(MI_INFO *info, uchar *buf,
register my_off_t filepos,
my_bool skip_deleted_blocks
__attribute__((unused)))
{
MI_BLOCK_INFO block_info;
MYISAM_SHARE *share=info->s;
- byte *pos,*start;
+ uchar *pos,*start;
DBUG_ENTER("_mi_read_rnd_mempack_record");
if (filepos >= share->state.state.data_file_length)
@@ -1568,7 +1569,7 @@ static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf,
my_errno=HA_ERR_END_OF_FILE;
goto err;
}
- if (!(pos= (byte*) _mi_mempack_get_block_info(info, &info->bit_buff,
+ if (!(pos= (uchar*) _mi_mempack_get_block_info(info, &info->bit_buff,
&block_info, &info->rec_buff,
(uchar*)
(start=share->file_map+
@@ -1596,7 +1597,7 @@ static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf,
/* Save length of row */
-uint save_pack_length(uint version, byte *block_buff, ulong length)
+uint save_pack_length(uint version, uchar *block_buff, ulong length)
{
if (length < 254)
{
diff --git a/storage/myisam/mi_page.c b/storage/myisam/mi_page.c
index da9e19275c9..ede379feea6 100644
--- a/storage/myisam/mi_page.c
+++ b/storage/myisam/mi_page.c
@@ -29,7 +29,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
DBUG_PRINT("enter",("page: %ld", (long) page));
tmp=(uchar*) key_cache_read(info->s->key_cache,
- info->s->kfile, page, level, (byte*) buff,
+ info->s->kfile, page, level, (uchar*) buff,
(uint) keyinfo->block_length,
(uint) keyinfo->block_length,
return_buffer);
@@ -80,7 +80,7 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
DBUG_RETURN((-1));
}
DBUG_PRINT("page",("write page at: %lu",(long) page));
- DBUG_DUMP("buff",(byte*) buff,mi_getint(buff));
+ DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff));
#endif
if ((length=keyinfo->block_length) > IO_SIZE*2 &&
@@ -89,12 +89,12 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
#ifdef HAVE_purify
{
length=mi_getint(buff);
- bzero((byte*) buff+length,keyinfo->block_length-length);
+ bzero((uchar*) buff+length,keyinfo->block_length-length);
length=keyinfo->block_length;
}
#endif
DBUG_RETURN((key_cache_write(info->s->key_cache,
- info->s->kfile,page, level, (byte*) buff,length,
+ info->s->kfile,page, level, (uchar*) buff,length,
(uint) keyinfo->block_length,
(int) ((info->lock_type != F_UNLCK) ||
info->s->delay_key_write))));
diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c
index 06c66c06bf4..60ab55106cb 100644
--- a/storage/myisam/mi_preload.c
+++ b/storage/myisam/mi_preload.c
@@ -81,7 +81,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
/* Read the next block of index file into the preload buffer */
if ((my_off_t) length > (key_file_length-pos))
length= (ulong) (key_file_length-pos);
- if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE|MY_FNABP)))
+ if (my_pread(share->kfile, (uchar*) buff, length, pos, MYF(MY_FAE|MY_FNABP)))
goto err;
if (ignore_leaves)
@@ -93,7 +93,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
if (key_cache_insert(share->key_cache,
share->kfile, pos, DFLT_INIT_HITS,
- (byte*) buff, block_length))
+ (uchar*) buff, block_length))
goto err;
}
pos+= block_length;
@@ -105,7 +105,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
if (key_cache_insert(share->key_cache,
share->kfile, pos, DFLT_INIT_HITS,
- (byte*) buff, length))
+ (uchar*) buff, length))
goto err;
pos+= length;
}
diff --git a/storage/myisam/mi_range.c b/storage/myisam/mi_range.c
index c7ab6731a2c..932a4abd1b3 100644
--- a/storage/myisam/mi_range.c
+++ b/storage/myisam/mi_range.c
@@ -21,7 +21,7 @@
#include "myisamdef.h"
#include "rt_index.h"
-static ha_rows _mi_record_pos(MI_INFO *, const byte *, key_part_map,
+static ha_rows _mi_record_pos(MI_INFO *, const uchar *, key_part_map,
enum ha_rkey_function);
static double _mi_search_pos(MI_INFO *,MI_KEYDEF *,uchar *, uint,uint,my_off_t);
static uint _mi_keynr(MI_INFO *info,MI_KEYDEF *,uchar *, uchar *,uint *);
@@ -116,7 +116,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx,
/* Find relative position (in records) for key in index-tree */
-static ha_rows _mi_record_pos(MI_INFO *info, const byte *key,
+static ha_rows _mi_record_pos(MI_INFO *info, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function search_flag)
{
diff --git a/storage/myisam/mi_rfirst.c b/storage/myisam/mi_rfirst.c
index d23bda46b1a..5a8b27b3e85 100644
--- a/storage/myisam/mi_rfirst.c
+++ b/storage/myisam/mi_rfirst.c
@@ -17,7 +17,7 @@
/* Read first row through a specfic key */
-int mi_rfirst(MI_INFO *info, byte *buf, int inx)
+int mi_rfirst(MI_INFO *info, uchar *buf, int inx)
{
DBUG_ENTER("mi_rfirst");
info->lastpos= HA_OFFSET_ERROR;
diff --git a/storage/myisam/mi_rkey.c b/storage/myisam/mi_rkey.c
index a69e276a6d8..3dcaa27d3ca 100644
--- a/storage/myisam/mi_rkey.c
+++ b/storage/myisam/mi_rkey.c
@@ -21,7 +21,7 @@
/* Read a record using key */
/* Ordinary search_flag is 0 ; Give error if no record with key */
-int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key,
+int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function search_flag)
{
uchar *key_buff;
diff --git a/storage/myisam/mi_rlast.c b/storage/myisam/mi_rlast.c
index 7805755ab70..07be619617f 100644
--- a/storage/myisam/mi_rlast.c
+++ b/storage/myisam/mi_rlast.c
@@ -17,7 +17,7 @@
/* Read last row with the same key as the previous read. */
-int mi_rlast(MI_INFO *info, byte *buf, int inx)
+int mi_rlast(MI_INFO *info, uchar *buf, int inx)
{
DBUG_ENTER("mi_rlast");
info->lastpos= HA_OFFSET_ERROR;
diff --git a/storage/myisam/mi_rnext.c b/storage/myisam/mi_rnext.c
index f6a0a47413e..7ce66d41e0f 100644
--- a/storage/myisam/mi_rnext.c
+++ b/storage/myisam/mi_rnext.c
@@ -24,7 +24,7 @@
based on the position of the last used key!
*/
-int mi_rnext(MI_INFO *info, byte *buf, int inx)
+int mi_rnext(MI_INFO *info, uchar *buf, int inx)
{
int error,changed;
uint flag;
diff --git a/storage/myisam/mi_rnext_same.c b/storage/myisam/mi_rnext_same.c
index 3a7004bf47c..1892fe3e1e0 100644
--- a/storage/myisam/mi_rnext_same.c
+++ b/storage/myisam/mi_rnext_same.c
@@ -24,7 +24,7 @@
based on the position of the last used key!
*/
-int mi_rnext_same(MI_INFO *info, byte *buf)
+int mi_rnext_same(MI_INFO *info, uchar *buf)
{
int error;
uint inx,not_used[2];
diff --git a/storage/myisam/mi_rprev.c b/storage/myisam/mi_rprev.c
index 09802627185..d1407012590 100644
--- a/storage/myisam/mi_rprev.c
+++ b/storage/myisam/mi_rprev.c
@@ -22,7 +22,7 @@
based on the position of the last used key!
*/
-int mi_rprev(MI_INFO *info, byte *buf, int inx)
+int mi_rprev(MI_INFO *info, uchar *buf, int inx)
{
int error,changed;
register uint flag;
diff --git a/storage/myisam/mi_rrnd.c b/storage/myisam/mi_rrnd.c
index d31e6c24a37..211e5fa51cc 100644
--- a/storage/myisam/mi_rrnd.c
+++ b/storage/myisam/mi_rrnd.c
@@ -29,7 +29,7 @@
HA_ERR_END_OF_FILE = EOF.
*/
-int mi_rrnd(MI_INFO *info, byte *buf, register my_off_t filepos)
+int mi_rrnd(MI_INFO *info, uchar *buf, register my_off_t filepos)
{
my_bool skip_deleted_blocks;
DBUG_ENTER("mi_rrnd");
diff --git a/storage/myisam/mi_rsame.c b/storage/myisam/mi_rsame.c
index 4831ebb3d7c..8093498483f 100644
--- a/storage/myisam/mi_rsame.c
+++ b/storage/myisam/mi_rsame.c
@@ -25,7 +25,7 @@
*/
-int mi_rsame(MI_INFO *info, byte *record, int inx)
+int mi_rsame(MI_INFO *info, uchar *record, int inx)
{
DBUG_ENTER("mi_rsame");
diff --git a/storage/myisam/mi_rsamepos.c b/storage/myisam/mi_rsamepos.c
index 717b9ab52d5..6a1e462b686 100644
--- a/storage/myisam/mi_rsamepos.c
+++ b/storage/myisam/mi_rsamepos.c
@@ -27,7 +27,7 @@
** HA_ERR_END_OF_FILE = End of file
*/
-int mi_rsame_with_pos(MI_INFO *info, byte *record, int inx, my_off_t filepos)
+int mi_rsame_with_pos(MI_INFO *info, uchar *record, int inx, my_off_t filepos)
{
DBUG_ENTER("mi_rsame_with_pos");
DBUG_PRINT("enter",("index: %d filepos: %ld", inx, (long) filepos));
diff --git a/storage/myisam/mi_scan.c b/storage/myisam/mi_scan.c
index 87debb67b37..a225b399660 100644
--- a/storage/myisam/mi_scan.c
+++ b/storage/myisam/mi_scan.c
@@ -36,7 +36,7 @@ int mi_scan_init(register MI_INFO *info)
HA_ERR_END_OF_FILE = EOF.
*/
-int mi_scan(MI_INFO *info, byte *buf)
+int mi_scan(MI_INFO *info, uchar *buf)
{
DBUG_ENTER("mi_scan");
/* Init all but update-flag */
diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c
index d313619e007..acc8c073297 100644
--- a/storage/myisam/mi_search.c
+++ b/storage/myisam/mi_search.c
@@ -78,7 +78,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff,
test(!(nextflag & SEARCH_SAVE_BUFF)))))
goto err;
- DBUG_DUMP("page",(byte*) buff,mi_getint(buff));
+ DBUG_DUMP("page",(uchar*) buff,mi_getint(buff));
flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag,
&keypos,lastkey, &last_key);
@@ -753,7 +753,7 @@ void _mi_dpointer(MI_INFO *info, uchar *buff, my_off_t pos)
uint _mi_get_static_key(register MI_KEYDEF *keyinfo, uint nod_flag,
register uchar **page, register uchar *key)
{
- memcpy((byte*) key,(byte*) *page,
+ memcpy((uchar*) key,(uchar*) *page,
(size_t) (keyinfo->keylength+nod_flag));
*page+=keyinfo->keylength+nod_flag;
return(keyinfo->keylength);
@@ -897,12 +897,12 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
else
length=keyseg->length;
}
- memcpy((byte*) key,(byte*) page,(size_t) length);
+ memcpy((uchar*) key,(uchar*) page,(size_t) length);
key+=length;
page+=length;
}
length=keyseg->length+nod_flag;
- bmove((byte*) key,(byte*) page,length);
+ bmove((uchar*) key,(uchar*) page,length);
*page_pos= page+length;
return ((uint) (key-start_key)+keyseg->length);
} /* _mi_get_pack_key */
@@ -1003,7 +1003,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
}
DBUG_PRINT("info",("key: 0x%lx from: 0x%lx length: %u",
(long) key, (long) from, length));
- memmove((byte*) key, (byte*) from, (size_t) length);
+ memmove((uchar*) key, (uchar*) from, (size_t) length);
key+=length;
from+=length;
}
@@ -1035,7 +1035,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_RETURN(0); /* Error */
}
/* Copy data pointer and, if appropriate, key block pointer. */
- memcpy((byte*) key,(byte*) from,(size_t) length);
+ memcpy((uchar*) key,(uchar*) from,(size_t) length);
*page_pos= from+length;
}
DBUG_RETURN((uint) (key-start_key)+keyseg->length);
@@ -1054,7 +1054,7 @@ uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
nod_flag=mi_test_if_nod(page);
if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
{
- bmove((byte*) key,(byte*) keypos,keyinfo->keylength+nod_flag);
+ bmove((uchar*) key,(uchar*) keypos,keyinfo->keylength+nod_flag);
DBUG_RETURN(keypos+keyinfo->keylength+nod_flag);
}
else
@@ -1092,7 +1092,7 @@ static my_bool _mi_get_prev_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
{
*return_key_length=keyinfo->keylength;
- bmove((byte*) key,(byte*) keypos- *return_key_length-nod_flag,
+ bmove((uchar*) key,(uchar*) keypos- *return_key_length-nod_flag,
*return_key_length);
DBUG_RETURN(0);
}
@@ -1134,7 +1134,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
lastpos=endpos-keyinfo->keylength-nod_flag;
*return_key_length=keyinfo->keylength;
if (lastpos > page)
- bmove((byte*) lastkey,(byte*) lastpos,keyinfo->keylength+nod_flag);
+ bmove((uchar*) lastkey,(uchar*) lastpos,keyinfo->keylength+nod_flag);
}
else
{
@@ -1225,7 +1225,7 @@ uint _mi_keylength_part(MI_KEYDEF *keyinfo, register uchar *key,
uchar *_mi_move_key(MI_KEYDEF *keyinfo, uchar *to, uchar *from)
{
reg1 uint length;
- memcpy((byte*) to, (byte*) from,
+ memcpy((uchar*) to, (uchar*) from,
(size_t) (length=_mi_keylength(keyinfo,from)));
return to+length;
}
@@ -1827,7 +1827,7 @@ void _mi_store_static_key(MI_KEYDEF *keyinfo __attribute__((unused)),
register uchar *key_pos,
register MI_KEY_PARAM *s_temp)
{
- memcpy((byte*) key_pos,(byte*) s_temp->key,(size_t) s_temp->totlength);
+ memcpy((uchar*) key_pos,(uchar*) s_temp->key,(size_t) s_temp->totlength);
}
@@ -1860,7 +1860,7 @@ void _mi_store_var_pack_key(MI_KEYDEF *keyinfo __attribute__((unused)),
/* Not packed against previous key */
store_pack_length(s_temp->pack_marker == 128,key_pos,s_temp->key_length);
}
- bmove((byte*) key_pos,(byte*) s_temp->key,
+ bmove((uchar*) key_pos,(uchar*) s_temp->key,
(length=s_temp->totlength-(uint) (key_pos-start)));
if (!s_temp->next_key_pos) /* No following key */
diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c
index 21a25f66b7c..c92d577b621 100644
--- a/storage/myisam/mi_static.c
+++ b/storage/myisam/mi_static.c
@@ -27,7 +27,7 @@ uchar NEAR myisam_file_magic[]=
{ (uchar) 254, (uchar) 254,'\007', '\001', };
uchar NEAR myisam_pack_file_magic[]=
{ (uchar) 254, (uchar) 254,'\010', '\002', };
-my_string myisam_log_filename=(char*) "myisam.log";
+char * myisam_log_filename=(char*) "myisam.log";
File myisam_log_file= -1;
uint myisam_quick_table_bits=9;
ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */
diff --git a/storage/myisam/mi_statrec.c b/storage/myisam/mi_statrec.c
index 3f92ec31d4c..93e91fb9e32 100644
--- a/storage/myisam/mi_statrec.c
+++ b/storage/myisam/mi_statrec.c
@@ -18,7 +18,7 @@
#include "myisamdef.h"
-int _mi_write_static_record(MI_INFO *info, const byte *record)
+int _mi_write_static_record(MI_INFO *info, const uchar *record)
{
uchar temp[8]; /* max pointer length */
if (info->s->state.dellink != HA_OFFSET_ERROR &&
@@ -48,14 +48,14 @@ int _mi_write_static_record(MI_INFO *info, const byte *record)
}
if (info->opt_flag & WRITE_CACHE_USED)
{ /* Cash in use */
- if (my_b_write(&info->rec_cache, (byte*) record,
+ if (my_b_write(&info->rec_cache, (uchar*) record,
info->s->base.reclength))
goto err;
if (info->s->base.pack_reclength != info->s->base.reclength)
{
uint length=info->s->base.pack_reclength - info->s->base.reclength;
bzero((char*) temp,length);
- if (my_b_write(&info->rec_cache, (byte*) temp,length))
+ if (my_b_write(&info->rec_cache, (uchar*) temp,length))
goto err;
}
}
@@ -70,7 +70,7 @@ int _mi_write_static_record(MI_INFO *info, const byte *record)
{
uint length=info->s->base.pack_reclength - info->s->base.reclength;
bzero((char*) temp,length);
- if (info->s->file_write(info, (byte*) temp,length,
+ if (info->s->file_write(info, (uchar*) temp,length,
info->state->data_file_length+
info->s->base.reclength,
info->s->write_flag))
@@ -85,7 +85,7 @@ int _mi_write_static_record(MI_INFO *info, const byte *record)
return 1;
}
-int _mi_update_static_record(MI_INFO *info, my_off_t pos, const byte *record)
+int _mi_update_static_record(MI_INFO *info, my_off_t pos, const uchar *record)
{
info->rec_cache.seek_not_done=1; /* We have done a seek */
return (info->s->file_write(info,
@@ -105,12 +105,12 @@ int _mi_delete_static_record(MI_INFO *info)
_mi_dpointer(info,temp+1,info->s->state.dellink);
info->s->state.dellink = info->lastpos;
info->rec_cache.seek_not_done=1;
- return (info->s->file_write(info,(byte*) temp, 1+info->s->rec_reflength,
+ return (info->s->file_write(info,(uchar*) temp, 1+info->s->rec_reflength,
info->lastpos, MYF(MY_NABP)) != 0);
}
-int _mi_cmp_static_record(register MI_INFO *info, register const byte *old)
+int _mi_cmp_static_record(register MI_INFO *info, register const uchar *old)
{
DBUG_ENTER("_mi_cmp_static_record");
@@ -133,7 +133,7 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old)
info->lastpos,
MYF(MY_NABP)))
DBUG_RETURN(-1);
- if (memcmp((byte*) info->rec_buff, (byte*) old,
+ if (memcmp((uchar*) info->rec_buff, (uchar*) old,
(uint) info->s->base.reclength))
{
DBUG_DUMP("read",old,info->s->base.reclength);
@@ -147,7 +147,7 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old)
int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def,
- const byte *record, my_off_t pos)
+ const uchar *record, my_off_t pos)
{
DBUG_ENTER("_mi_cmp_static_unique");
@@ -166,7 +166,7 @@ int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def,
/* MY_FILE_ERROR on read-error or locking-error */
int _mi_read_static_record(register MI_INFO *info, register my_off_t pos,
- register byte *record)
+ register uchar *record)
{
int error;
@@ -199,7 +199,7 @@ int _mi_read_static_record(register MI_INFO *info, register my_off_t pos,
-int _mi_read_rnd_static_record(MI_INFO *info, byte *buf,
+int _mi_read_rnd_static_record(MI_INFO *info, uchar *buf,
register my_off_t filepos,
my_bool skip_deleted_blocks)
{
@@ -274,11 +274,11 @@ int _mi_read_rnd_static_record(MI_INFO *info, byte *buf,
}
/* Read record with cacheing */
- error=my_b_read(&info->rec_cache,(byte*) buf,share->base.reclength);
+ error=my_b_read(&info->rec_cache,(uchar*) buf,share->base.reclength);
if (info->s->base.pack_reclength != info->s->base.reclength && !error)
{
char tmp[8]; /* Skill fill bytes */
- error=my_b_read(&info->rec_cache,(byte*) tmp,
+ error=my_b_read(&info->rec_cache,(uchar*) tmp,
info->s->base.pack_reclength - info->s->base.reclength);
}
if (locked)
diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c
index ebb9cdcb2f7..1165ea4bb32 100644
--- a/storage/myisam/mi_test1.c
+++ b/storage/myisam/mi_test1.c
@@ -109,7 +109,7 @@ static int run_test(const char *filename)
}
keyinfo[0].flag = (uint8) (pack_keys | unique_key);
- bzero((byte*) flags,sizeof(flags));
+ bzero((uchar*) flags,sizeof(flags));
if (opt_unique)
{
uint start;
@@ -534,21 +534,21 @@ static struct my_option my_long_options[] =
{"debug", '#', "Undocumented",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"delete_rows", 'd', "Undocumented", (gptr*) &remove_count,
- (gptr*) &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+ {"delete_rows", 'd', "Undocumented", (uchar**) &remove_count,
+ (uchar**) &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
{"help", '?', "Display help and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"insert_rows", 'i', "Undocumented", (gptr*) &insert_count,
- (gptr*) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+ {"insert_rows", 'i', "Undocumented", (uchar**) &insert_count,
+ (uchar**) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
{"key_alpha", 'a', "Use a key of type HA_KEYTYPE_TEXT",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key_binary_pack", 'B', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key_blob", 'b', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"key_cache", 'K', "Undocumented", (gptr*) &key_cacheing,
- (gptr*) &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"key_length", 'k', "Undocumented", (gptr*) &key_length, (gptr*) &key_length,
+ {"key_cache", 'K', "Undocumented", (uchar**) &key_cacheing,
+ (uchar**) &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"key_length", 'k', "Undocumented", (uchar**) &key_length, (uchar**) &key_length,
0, GET_UINT, REQUIRED_ARG, 6, 0, 0, 0, 0, 0},
{"key_multiple", 'm', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -559,21 +559,21 @@ static struct my_option my_long_options[] =
{"key_varchar", 'w', "Test VARCHAR keys",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"null_fields", 'N', "Define fields with NULL",
- (gptr*) &null_fields, (gptr*) &null_fields, 0, GET_BOOL, NO_ARG,
+ (uchar**) &null_fields, (uchar**) &null_fields, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"row_fixed_size", 'S', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"row_pointer_size", 'R', "Undocumented", (gptr*) &rec_pointer_size,
- (gptr*) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"row_pointer_size", 'R', "Undocumented", (uchar**) &rec_pointer_size,
+ (uchar**) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Undocumented",
- (gptr*) &silent, (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"skip_update", 'U', "Undocumented", (gptr*) &skip_update,
- (gptr*) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"unique", 'C', "Undocumented", (gptr*) &opt_unique, (gptr*) &opt_unique, 0,
+ (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"skip_update", 'U', "Undocumented", (uchar**) &skip_update,
+ (uchar**) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"unique", 'C', "Undocumented", (uchar**) &opt_unique, (uchar**) &opt_unique, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"update_rows", 'u', "Undocumented", (gptr*) &update_count,
- (gptr*) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
- {"verbose", 'v', "Be more verbose", (gptr*) &verbose, (gptr*) &verbose, 0,
+ {"update_rows", 'u', "Undocumented", (uchar**) &update_count,
+ (uchar**) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Be more verbose", (uchar**) &verbose, (uchar**) &verbose, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Print version number and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c
index 878bba31ea8..96ee82e023c 100644
--- a/storage/myisam/mi_test2.c
+++ b/storage/myisam/mi_test2.c
@@ -36,7 +36,7 @@
static void get_options(int argc, char *argv[]);
static uint rnd(uint max_value);
-static void fix_length(byte *record,uint length);
+static void fix_length(uchar *record,uint length);
static void put_blob_in_record(char *blob_pos,char **blob_buffer);
static void copy_key(struct st_myisam_info *info,uint inx,
uchar *record,uchar *key);
@@ -455,8 +455,8 @@ int main(int argc, char *argv[])
bcmp(read_record2,read_record3,reclength))
{
printf("Can't find last record\n");
- DBUG_DUMP("record2",(byte*) read_record2,reclength);
- DBUG_DUMP("record3",(byte*) read_record3,reclength);
+ DBUG_DUMP("record2",(uchar*) read_record2,reclength);
+ DBUG_DUMP("record3",(uchar*) read_record3,reclength);
goto end;
}
ant=1;
@@ -1001,7 +1001,7 @@ static uint rnd(uint max_value)
/* Create a variable length record */
-static void fix_length(byte *rec, uint length)
+static void fix_length(uchar *rec, uint length)
{
bmove(rec+STANDARD_LENGTH,
"0123456789012345678901234567890123456789012345678901234567890",
diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c
index 3987c20ab69..982b999c3a5 100644
--- a/storage/myisam/mi_test3.c
+++ b/storage/myisam/mi_test3.c
@@ -243,7 +243,7 @@ int test_read(MI_INFO *file,int id)
for (i=0 ; i < 100 ; i++)
{
find=rnd(100000);
- if (!mi_rkey(file,record.id,1,(byte*) &find,
+ if (!mi_rkey(file,record.id,1,(uchar*) &find,
sizeof(find),HA_READ_KEY_EXACT))
found++;
else
@@ -426,7 +426,7 @@ int test_update(MI_INFO *file,int id,int lock_type)
{
tmp=rnd(100000);
int4store(find,tmp);
- if (!mi_rkey(file,record.id,1,(byte*) find,
+ if (!mi_rkey(file,record.id,1,(uchar*) find,
sizeof(find),HA_READ_KEY_EXACT))
found++;
else
diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c
index 635f6c18247..e490fb683e4 100644
--- a/storage/myisam/mi_unique.c
+++ b/storage/myisam/mi_unique.c
@@ -18,7 +18,7 @@
#include "myisamdef.h"
#include <m_ctype.h>
-my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
+my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record,
ha_checksum unique_hash, my_off_t disk_pos)
{
my_off_t lastpos=info->lastpos;
@@ -73,9 +73,9 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
Add support for bit fields
*/
-ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
+ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *record)
{
- const byte *pos, *end;
+ const uchar *pos, *end;
ha_checksum crc= 0;
ulong seed1=0, seed2= 4;
HA_KEYSEG *keyseg;
@@ -111,7 +111,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
else if (keyseg->flag & HA_BLOB_PART)
{
uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos);
- memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*));
+ memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*));
if (!length || length > tmp_length)
length=tmp_length; /* The whole blob */
}
@@ -145,10 +145,10 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
# Rows are different
*/
-int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b,
+int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b,
my_bool null_are_equal)
{
- const byte *pos_a, *pos_b, *end;
+ const uchar *pos_a, *pos_b, *end;
HA_KEYSEG *keyseg;
for (keyseg=def->seg ; keyseg < def->end ; keyseg++)
@@ -206,8 +206,8 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b,
set_if_smaller(a_length, keyseg->length);
set_if_smaller(b_length, keyseg->length);
}
- memcpy_fixed((byte*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*));
- memcpy_fixed((byte*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*));
+ memcpy_fixed((uchar*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*));
+ memcpy_fixed((uchar*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*));
}
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 ||
type == HA_KEYTYPE_VARTEXT2)
diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c
index bea457d2e9a..924cdfcbc21 100644
--- a/storage/myisam/mi_update.c
+++ b/storage/myisam/mi_update.c
@@ -18,7 +18,7 @@
#include "fulltext.h"
#include "rt_index.h"
-int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
+int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec)
{
int flag,key_changed,save_errno;
reg3 my_off_t pos;
@@ -115,7 +115,7 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
info->update&= ~HA_STATE_RNEXT_SAME;
if (new_length != old_length ||
- memcmp((byte*) old_key,(byte*) new_key,new_length))
+ memcmp((uchar*) old_key,(uchar*) new_key,new_length))
{
if ((int) i == info->lastinx)
key_changed|=HA_STATE_WRITTEN; /* Mark that keyfile changed */
diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c
index 57c054f2de8..8ae979f8bf6 100644
--- a/storage/myisam/mi_write.c
+++ b/storage/myisam/mi_write.c
@@ -40,7 +40,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr,uchar *key,
/* Write new record to database */
-int mi_write(MI_INFO *info, byte *record)
+int mi_write(MI_INFO *info, uchar *record)
{
MYISAM_SHARE *share=info->s;
uint i;
@@ -286,7 +286,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr, uchar *key,
if (!error)
error= _mi_ft_convert_to_ft2(info, keynr, key);
delete_dynamic(info->ft1_to_ft2);
- my_free((gptr)info->ft1_to_ft2, MYF(0));
+ my_free((uchar*)info->ft1_to_ft2, MYF(0));
info->ft1_to_ft2=0;
}
DBUG_RETURN(error);
@@ -403,14 +403,14 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
ft_intXstore(keypos, subkeys);
if (!error)
error=_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff);
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(error);
}
}
else /* not HA_FULLTEXT, normal HA_NOSAME key */
{
info->dupp_key_pos= dupp_key_pos;
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
my_errno=HA_ERR_FOUND_DUPP_KEY;
DBUG_RETURN(-1);
}
@@ -429,10 +429,10 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff))
goto err;
}
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(error);
err:
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_PRINT("exit",("Error: %d",my_errno));
DBUG_RETURN (-1);
} /* w_search */
@@ -488,7 +488,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (key_pos != anc_buff+2+nod_flag && (keyinfo->flag &
(HA_BINARY_PACK_KEY | HA_PACK_KEY)))
{
- DBUG_DUMP("prev_key",(byte*) key_buff,_mi_keylength(keyinfo,key_buff));
+ DBUG_DUMP("prev_key",(uchar*) key_buff,_mi_keylength(keyinfo,key_buff));
}
if (keyinfo->flag & HA_PACK_KEY)
{
@@ -506,7 +506,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_errno=HA_ERR_CRASHED;
DBUG_RETURN(-1);
}
- bmove_upp((byte*) endpos+t_length,(byte*) endpos,(uint) (endpos-key_pos));
+ bmove_upp((uchar*) endpos+t_length,(uchar*) endpos,(uint) (endpos-key_pos));
}
else
{
@@ -595,7 +595,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo,
MI_KEY_PARAM s_temp;
DBUG_ENTER("mi_split_page");
LINT_INIT(after_key);
- DBUG_DUMP("buff",(byte*) buff,mi_getint(buff));
+ DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff));
if (info->s->keyinfo+info->lastinx == keyinfo)
info->page_changed=1; /* Info->buff is used */
@@ -619,7 +619,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{
DBUG_PRINT("test",("Splitting nod"));
pos=key_pos-nod_flag;
- memcpy((byte*) info->buff+2,(byte*) pos,(size_t) nod_flag);
+ memcpy((uchar*) info->buff+2,(uchar*) pos,(size_t) nod_flag);
}
/* Move middle item to key and pointer to new page */
@@ -635,14 +635,14 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo,
(uchar*) 0, (uchar*) 0,
key_buff, &s_temp);
length=(uint) ((buff+a_length)-key_pos);
- memcpy((byte*) info->buff+key_ref_length+t_length,(byte*) key_pos,
+ memcpy((uchar*) info->buff+key_ref_length+t_length,(uchar*) key_pos,
(size_t) length);
(*keyinfo->store_key)(keyinfo,info->buff+key_ref_length,&s_temp);
mi_putint(info->buff,length+t_length+key_ref_length,nod_flag);
if (_mi_write_keypage(info,keyinfo,new_pos,DFLT_INIT_HITS,info->buff))
DBUG_RETURN(-1);
- DBUG_DUMP("key",(byte*) key,_mi_keylength(keyinfo,key));
+ DBUG_DUMP("key",(uchar*) key,_mi_keylength(keyinfo,key));
DBUG_RETURN(2); /* Middle key up */
} /* _mi_split_page */
@@ -764,7 +764,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo,
length,keys;
uchar *pos,*buff,*extra_buff;
my_off_t next_page,new_pos;
- byte tmp_part_key[MI_MAX_KEY_BUFF];
+ uchar tmp_part_key[MI_MAX_KEY_BUFF];
DBUG_ENTER("_mi_balance_page");
k_length=keyinfo->keylength;
@@ -796,7 +796,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo,
if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff,0))
goto err;
- DBUG_DUMP("next",(byte*) info->buff,mi_getint(info->buff));
+ DBUG_DUMP("next",(uchar*) info->buff,mi_getint(info->buff));
/* Test if there is room to share keys */
@@ -815,23 +815,23 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo,
if (left_length < new_left_length)
{ /* Move keys buff -> leaf */
pos=curr_buff+left_length;
- memcpy((byte*) pos,(byte*) father_key_pos, (size_t) k_length);
- memcpy((byte*) pos+k_length, (byte*) buff+2,
+ memcpy((uchar*) pos,(uchar*) father_key_pos, (size_t) k_length);
+ memcpy((uchar*) pos+k_length, (uchar*) buff+2,
(size_t) (length=new_left_length - left_length - k_length));
pos=buff+2+length;
- memcpy((byte*) father_key_pos,(byte*) pos,(size_t) k_length);
- bmove((byte*) buff+2,(byte*) pos+k_length,new_right_length);
+ memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length);
+ bmove((uchar*) buff+2,(uchar*) pos+k_length,new_right_length);
}
else
{ /* Move keys -> buff */
- bmove_upp((byte*) buff+new_right_length,(byte*) buff+right_length,
+ bmove_upp((uchar*) buff+new_right_length,(uchar*) buff+right_length,
right_length-2);
length=new_right_length-right_length-k_length;
- memcpy((byte*) buff+2+length,father_key_pos,(size_t) k_length);
+ memcpy((uchar*) buff+2+length,father_key_pos,(size_t) k_length);
pos=curr_buff+new_left_length;
- memcpy((byte*) father_key_pos,(byte*) pos,(size_t) k_length);
- memcpy((byte*) buff+2,(byte*) pos+k_length,(size_t) length);
+ memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length);
+ memcpy((uchar*) buff+2,(uchar*) pos+k_length,(size_t) length);
}
if (_mi_write_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff) ||
@@ -858,22 +858,22 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo,
/* move first largest keys to new page */
pos=buff+right_length-extra_length;
- memcpy((byte*) extra_buff+2,pos,(size_t) extra_length);
+ memcpy((uchar*) extra_buff+2,pos,(size_t) extra_length);
/* Save new parting key */
memcpy(tmp_part_key, pos-k_length,k_length);
/* Make place for new keys */
- bmove_upp((byte*) buff+new_right_length,(byte*) pos-k_length,
+ bmove_upp((uchar*) buff+new_right_length,(uchar*) pos-k_length,
right_length-extra_length-k_length-2);
/* Copy keys from left page */
pos= curr_buff+new_left_length;
- memcpy((byte*) buff+2,(byte*) pos+k_length,
+ memcpy((uchar*) buff+2,(uchar*) pos+k_length,
(size_t) (length=left_length-new_left_length-k_length));
/* Copy old parting key */
- memcpy((byte*) buff+2+length,father_key_pos,(size_t) k_length);
+ memcpy((uchar*) buff+2+length,father_key_pos,(size_t) k_length);
/* Move new parting keys up to caller */
- memcpy((byte*) (right ? key : father_key_pos),pos,(size_t) k_length);
- memcpy((byte*) (right ? father_key_pos : key),tmp_part_key, k_length);
+ memcpy((uchar*) (right ? key : father_key_pos),pos,(size_t) k_length);
+ memcpy((uchar*) (right ? father_key_pos : key),tmp_part_key, k_length);
if ((new_pos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
goto err;
diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c
index 4bc1833cca6..63d954242a0 100644
--- a/storage/myisam/myisam_ftdump.c
+++ b/storage/myisam/myisam_ftdump.c
@@ -46,7 +46,7 @@ static struct my_option my_long_options[] =
{"stats", 's', "Report global stats.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Be verbose.",
- (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 066e6cdb81b..3700251ab15 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -68,9 +68,9 @@ static void get_options(int *argc,char * * *argv);
static void print_version(void);
static void usage(void);
static int myisamchk(MI_CHECK *param, char *filename);
-static void descript(MI_CHECK *param, register MI_INFO *info, my_string name);
+static void descript(MI_CHECK *param, register MI_INFO *info, char * name);
static int mi_sort_records(MI_CHECK *param, register MI_INFO *info,
- my_string name, uint sort_key,
+ char * name, uint sort_key,
my_bool write_info, my_bool update_index);
static int sort_record_index(MI_SORT_PARAM *sort_param, MI_INFO *info,
MI_KEYDEF *keyinfo,
@@ -167,7 +167,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.",
- (gptr*) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c',
"Check table for errors.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -187,8 +187,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"data-file-length", 'D',
"Max length of data file (when recreating data-file when it's full).",
- (gptr*) &check_param.max_data_file_length,
- (gptr*) &check_param.max_data_file_length,
+ (uchar**) &check_param.max_data_file_length,
+ (uchar**) &check_param.max_data_file_length,
0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extend-check", 'e',
"If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.",
@@ -210,13 +210,13 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"keys-used", 'k',
"Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts.",
- (gptr*) &check_param.keys_in_use,
- (gptr*) &check_param.keys_in_use,
+ (uchar**) &check_param.keys_in_use,
+ (uchar**) &check_param.keys_in_use,
0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
{"max-record-length", OPT_MAX_RECORD_LENGTH,
"Skip rows bigger than this if myisamchk can't allocate memory to hold it",
- (gptr*) &check_param.max_record_length,
- (gptr*) &check_param.max_record_length,
+ (uchar**) &check_param.max_record_length,
+ (uchar**) &check_param.max_record_length,
0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0},
{"medium-check", 'm',
"Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.",
@@ -245,12 +245,12 @@ static struct my_option my_long_options[] =
#endif
{"set-auto-increment", 'A',
"Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.",
- (gptr*) &check_param.auto_increment_value,
- (gptr*) &check_param.auto_increment_value,
+ (uchar**) &check_param.auto_increment_value,
+ (uchar**) &check_param.auto_increment_value,
0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"set-collation", OPT_SET_COLLATION,
"Change the collation used by the index",
- (gptr*) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -262,12 +262,12 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sort-records", 'R',
"Sort records according to an index. This makes your data much more localized and may speed up things. (It may be VERY slow to do a sort the first time!)",
- (gptr*) &check_param.opt_sort_key,
- (gptr*) &check_param.opt_sort_key,
+ (uchar**) &check_param.opt_sort_key,
+ (uchar**) &check_param.opt_sort_key,
0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't',
"Path for temporary files.",
- (gptr*) &opt_tmpdir,
+ (uchar**) &opt_tmpdir,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"update-state", 'U',
"Mark tables as crashed if any errors were found.",
@@ -285,54 +285,54 @@ static struct my_option my_long_options[] =
"Wait if table is locked.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "key_buffer_size", OPT_KEY_BUFFER_SIZE, "",
- (gptr*) &check_param.use_buffers, (gptr*) &check_param.use_buffers, 0,
+ (uchar**) &check_param.use_buffers, (uchar**) &check_param.use_buffers, 0,
GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0},
{ "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "",
- (gptr*) &opt_key_cache_block_size,
- (gptr*) &opt_key_cache_block_size, 0,
+ (uchar**) &opt_key_cache_block_size,
+ (uchar**) &opt_key_cache_block_size, 0,
GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH,
MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0},
{ "myisam_block_size", OPT_MYISAM_BLOCK_SIZE, "",
- (gptr*) &opt_myisam_block_size, (gptr*) &opt_myisam_block_size, 0,
+ (uchar**) &opt_myisam_block_size, (uchar**) &opt_myisam_block_size, 0,
GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH,
MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0},
{ "read_buffer_size", OPT_READ_BUFFER_SIZE, "",
- (gptr*) &check_param.read_buffer_length,
- (gptr*) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &check_param.read_buffer_length,
+ (uchar**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
- (gptr*) &check_param.write_buffer_length,
- (gptr*) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &check_param.write_buffer_length,
+ (uchar**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
- (gptr*) &check_param.sort_buffer_length,
- (gptr*) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &check_param.sort_buffer_length,
+ (uchar**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
- (gptr*) &check_param.sort_key_blocks,
- (gptr*) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &check_param.sort_key_blocks,
+ (uchar**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0},
- { "decode_bits", OPT_DECODE_BITS, "", (gptr*) &decode_bits,
- (gptr*) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
- { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (gptr*) &ft_min_word_len,
- (gptr*) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
+ { "decode_bits", OPT_DECODE_BITS, "", (uchar**) &decode_bits,
+ (uchar**) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
+ { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (uchar**) &ft_min_word_len,
+ (uchar**) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
0, 1, 0},
- { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len,
- (gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
+ { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (uchar**) &ft_max_word_len,
+ (uchar**) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
HA_FT_MAXCHARLEN, 0, 1, 0},
{ "ft_stopword_file", OPT_FT_STOPWORD_FILE,
"Use stopwords from this file instead of built-in list.",
- (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR,
+ (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"stats_method", OPT_STATS_METHOD,
"Specifies how index statistics collection code should threat NULLs. "
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
- (gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0,
+ (uchar**) &myisam_stats_method_str, (uchar**) &myisam_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -794,7 +794,7 @@ static void get_options(register int *argc,register char ***argv)
/* Check table */
-static int myisamchk(MI_CHECK *param, my_string filename)
+static int myisamchk(MI_CHECK *param, char * filename)
{
int error,lock_type,recreate;
int rep_quick= param->testflag & (T_QUICK | T_FORCE_UNIQUENESS);
@@ -1199,7 +1199,7 @@ end2:
/* Write info about table */
-static void descript(MI_CHECK *param, register MI_INFO *info, my_string name)
+static void descript(MI_CHECK *param, register MI_INFO *info, char * name)
{
uint key,keyseg_nr,field,start;
reg3 MI_KEYDEF *keyinfo;
@@ -1465,7 +1465,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name)
/* Sort records according to one key */
static int mi_sort_records(MI_CHECK *param,
- register MI_INFO *info, my_string name,
+ register MI_INFO *info, char * name,
uint sort_key,
my_bool write_info,
my_bool update_index)
@@ -1536,7 +1536,7 @@ static int mi_sort_records(MI_CHECK *param,
mi_check_print_error(param,"Not enough memory for key block");
goto err;
}
- if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength,
+ if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength,
MYF(0))))
{
mi_check_print_error(param,"Not enough memory for record");
@@ -1567,7 +1567,7 @@ static int mi_sort_records(MI_CHECK *param,
for (key=0 ; key < share->base.keys ; key++)
share->keyinfo[key].flag|= HA_SORT_ALLOWS_SAME;
- if (my_pread(share->kfile,(byte*) temp_buff,
+ if (my_pread(share->kfile,(uchar*) temp_buff,
(uint) keyinfo->block_length,
share->state.key_root[sort_key],
MYF(MY_NABP+MY_WME)))
@@ -1630,7 +1630,7 @@ err:
}
if (temp_buff)
{
- my_afree((gptr) temp_buff);
+ my_afree((uchar*) temp_buff);
}
my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@@ -1679,7 +1679,7 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info,
if (nod_flag)
{
next_page=_mi_kpos(nod_flag,keypos);
- if (my_pread(info->s->kfile,(byte*) temp_buff,
+ if (my_pread(info->s->kfile,(uchar*) temp_buff,
(uint) keyinfo->block_length, next_page,
MYF(MY_NABP+MY_WME)))
{
@@ -1718,19 +1718,19 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info,
goto err;
}
/* Clear end of block to get better compression if the table is backuped */
- bzero((byte*) buff+used_length,keyinfo->block_length-used_length);
- if (my_pwrite(info->s->kfile,(byte*) buff,(uint) keyinfo->block_length,
+ bzero((uchar*) buff+used_length,keyinfo->block_length-used_length);
+ if (my_pwrite(info->s->kfile,(uchar*) buff,(uint) keyinfo->block_length,
page,param->myf_rw))
{
mi_check_print_error(param,"%d when updating keyblock",my_errno);
goto err;
}
if (temp_buff)
- my_afree((gptr) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(0);
err:
if (temp_buff)
- my_afree((gptr) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(1);
} /* sort_record_index */
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index a491e6d210c..f68d66d4cbb 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -167,22 +167,22 @@ typedef struct st_mi_isam_share { /* Shared between opens */
char *unique_file_name; /* realpath() of index file */
char *data_file_name, /* Resolved path names from symlinks */
*index_file_name;
- byte *file_map; /* mem-map of file if possible */
+ uchar *file_map; /* mem-map of file if possible */
KEY_CACHE *key_cache; /* ref to the current key cache */
MI_DECODE_TREE *decode_trees;
uint16 *decode_tables;
- int (*read_record)(struct st_myisam_info*, my_off_t, byte*);
- int (*write_record)(struct st_myisam_info*, const byte*);
- int (*update_record)(struct st_myisam_info*, my_off_t, const byte*);
+ int (*read_record)(struct st_myisam_info*, my_off_t, uchar*);
+ int (*write_record)(struct st_myisam_info*, const uchar*);
+ int (*update_record)(struct st_myisam_info*, my_off_t, const uchar*);
int (*delete_record)(struct st_myisam_info*);
- int (*read_rnd)(struct st_myisam_info*, byte*, my_off_t, my_bool);
- int (*compare_record)(struct st_myisam_info*, const byte *);
+ int (*read_rnd)(struct st_myisam_info*, uchar*, my_off_t, my_bool);
+ int (*compare_record)(struct st_myisam_info*, const uchar *);
/* Function to use for a row checksum. */
- ha_checksum (*calc_checksum)(struct st_myisam_info*, const byte *);
+ ha_checksum (*calc_checksum)(struct st_myisam_info*, const uchar *);
int (*compare_unique)(struct st_myisam_info*, MI_UNIQUEDEF *,
- const byte *record, my_off_t pos);
- uint (*file_read)(MI_INFO *, byte *, uint, my_off_t, myf);
- uint (*file_write)(MI_INFO *, byte *, uint, my_off_t, myf);
+ const uchar *record, my_off_t pos);
+ uint (*file_read)(MI_INFO *, uchar *, uint, my_off_t, myf);
+ uint (*file_write)(MI_INFO *, uchar *, uint, my_off_t, myf);
invalidator_by_filename invalidator; /* query cache invalidator */
ulong this_process; /* processid */
ulong last_process; /* For table-change-check */
@@ -245,12 +245,12 @@ struct st_myisam_info {
uchar *buff, /* Temp area for key */
*lastkey,*lastkey2; /* Last used search key */
uchar *first_mbr_key; /* Searhed spatial key */
- byte *rec_buff; /* Tempbuff for recordpack */
+ uchar *rec_buff; /* Tempbuff for recordpack */
uchar *int_keypos, /* Save position for next/previous */
*int_maxpos; /* -""- */
uint int_nod_flag; /* -""- */
uint32 int_keytree_version; /* -""- */
- int (*read_record)(struct st_myisam_info*, my_off_t, byte*);
+ int (*read_record)(struct st_myisam_info*, my_off_t, uchar*);
invalidator_by_filename invalidator; /* query cache invalidator */
ulong this_unique; /* uniq filenumber or thread */
ulong last_unique; /* last unique number */
@@ -334,10 +334,10 @@ typedef struct st_mi_sort_param
HA_KEYSEG *seg;
SORT_INFO *sort_info;
uchar **sort_keys;
- byte *rec_buff;
+ uchar *rec_buff;
void *wordlist, *wordptr;
MEM_ROOT wordroot;
- char *record;
+ uchar *record;
MY_TMPDIR *tmpdir;
int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *);
int (*key_read)(struct st_mi_sort_param *,void *);
@@ -349,6 +349,7 @@ typedef struct st_mi_sort_param
NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,char *,
uint, uint);
} MI_SORT_PARAM;
+
/* Some defines used by isam-funktions */
#define USE_WHOLE_KEY MI_MAX_KEY_BUFF*2 /* Use whole key in _mi_search() */
@@ -497,20 +498,20 @@ typedef struct st_mi_s_param
/* Prototypes for intern functions */
-extern int _mi_read_dynamic_record(MI_INFO *info,my_off_t filepos,byte *buf);
-extern int _mi_write_dynamic_record(MI_INFO*, const byte*);
-extern int _mi_update_dynamic_record(MI_INFO*, my_off_t, const byte*);
+extern int _mi_read_dynamic_record(MI_INFO *info,my_off_t filepos,uchar *buf);
+extern int _mi_write_dynamic_record(MI_INFO*, const uchar*);
+extern int _mi_update_dynamic_record(MI_INFO*, my_off_t, const uchar*);
extern int _mi_delete_dynamic_record(MI_INFO *info);
-extern int _mi_cmp_dynamic_record(MI_INFO *info,const byte *record);
-extern int _mi_read_rnd_dynamic_record(MI_INFO *, byte *,my_off_t, my_bool);
-extern int _mi_write_blob_record(MI_INFO*, const byte*);
-extern int _mi_update_blob_record(MI_INFO*, my_off_t, const byte*);
-extern int _mi_read_static_record(MI_INFO *info, my_off_t filepos,byte *buf);
-extern int _mi_write_static_record(MI_INFO*, const byte*);
-extern int _mi_update_static_record(MI_INFO*, my_off_t, const byte*);
+extern int _mi_cmp_dynamic_record(MI_INFO *info,const uchar *record);
+extern int _mi_read_rnd_dynamic_record(MI_INFO *, uchar *,my_off_t, my_bool);
+extern int _mi_write_blob_record(MI_INFO*, const uchar*);
+extern int _mi_update_blob_record(MI_INFO*, my_off_t, const uchar*);
+extern int _mi_read_static_record(MI_INFO *info, my_off_t filepos,uchar *buf);
+extern int _mi_write_static_record(MI_INFO*, const uchar*);
+extern int _mi_update_static_record(MI_INFO*, my_off_t, const uchar*);
extern int _mi_delete_static_record(MI_INFO *info);
-extern int _mi_cmp_static_record(MI_INFO *info,const byte *record);
-extern int _mi_read_rnd_static_record(MI_INFO*, byte *,my_off_t, my_bool);
+extern int _mi_cmp_static_record(MI_INFO *info,const uchar *record);
+extern int _mi_read_rnd_static_record(MI_INFO*, uchar *,my_off_t, my_bool);
extern int _mi_ck_write(MI_INFO *info,uint keynr,uchar *key,uint length);
extern int _mi_ck_real_write_btree(MI_INFO *info, MI_KEYDEF *keyinfo,
uchar *key, uint key_length,
@@ -604,39 +605,39 @@ extern int _mi_dispose(MI_INFO *info,MI_KEYDEF *keyinfo,my_off_t pos,
int level);
extern my_off_t _mi_new(MI_INFO *info,MI_KEYDEF *keyinfo,int level);
extern uint _mi_make_key(MI_INFO *info,uint keynr,uchar *key,
- const byte *record,my_off_t filepos);
+ const uchar *record,my_off_t filepos);
extern uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key,
uchar *old, key_part_map keypart_map,
HA_KEYSEG **last_used_keyseg);
-extern int _mi_read_key_record(MI_INFO *info,my_off_t filepos,byte *buf);
-extern int _mi_read_cache(IO_CACHE *info,byte *buff,my_off_t pos,
+extern int _mi_read_key_record(MI_INFO *info,my_off_t filepos,uchar *buf);
+extern int _mi_read_cache(IO_CACHE *info,uchar *buff,my_off_t pos,
uint length,int re_read_if_possibly);
-extern ulonglong retrieve_auto_increment(MI_INFO *info,const byte *record);
+extern ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record);
-extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**);
+extern uchar *mi_alloc_rec_buff(MI_INFO *,ulong, uchar**);
#define mi_get_rec_buff_ptr(info,buf) \
((((info)->s->options & HA_OPTION_PACK_RECORD) && (buf)) ? \
(buf) - MI_REC_BUFF_OFFSET : (buf))
#define mi_get_rec_buff_len(info,buf) \
(*((uint32 *)(mi_get_rec_buff_ptr(info,buf))))
-extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from,
+extern ulong _mi_rec_unpack(MI_INFO *info,uchar *to,uchar *from,
ulong reclength);
-extern my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *packpos,
+extern my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *packpos,
ulong packed_length, my_bool with_checkum);
extern int _mi_write_part_record(MI_INFO *info,my_off_t filepos,ulong length,
- my_off_t next_filepos,byte **record,
+ my_off_t next_filepos,uchar **record,
ulong *reclength,int *flag);
extern void _mi_print_key(FILE *stream,HA_KEYSEG *keyseg,const uchar *key,
uint length);
extern my_bool _mi_read_pack_info(MI_INFO *info,pbool fix_keys);
-extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,byte *buf);
-extern int _mi_read_rnd_pack_record(MI_INFO*, byte *,my_off_t, my_bool);
+extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,uchar *buf);
+extern int _mi_read_rnd_pack_record(MI_INFO*, uchar *,my_off_t, my_bool);
extern int _mi_pack_rec_unpack(MI_INFO *info, MI_BIT_BUFF *bit_buff,
- byte *to, byte *from, ulong reclength);
+ uchar *to, uchar *from, ulong reclength);
extern ulonglong mi_safe_mul(ulonglong a,ulonglong b);
-extern int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
- const byte *oldrec, const byte *newrec, my_off_t pos);
+extern int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf,
+ const uchar *oldrec, const uchar *newrec, my_off_t pos);
struct st_sort_info;
@@ -697,32 +698,32 @@ extern "C" {
#endif
extern uint _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t);
-extern uint _mi_rec_pack(MI_INFO *info,byte *to,const byte *from);
+extern uint _mi_rec_pack(MI_INFO *info,uchar *to,const uchar *from);
extern uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
- MI_BLOCK_INFO *info, byte **rec_buff_p,
+ MI_BLOCK_INFO *info, uchar **rec_buff_p,
File file, my_off_t filepos);
-extern void _my_store_blob_length(byte *pos,uint pack_length,uint length);
+extern void _my_store_blob_length(uchar *pos,uint pack_length,uint length);
extern void _myisam_log(enum myisam_log_commands command,MI_INFO *info,
- const byte *buffert,uint length);
+ const uchar *buffert,uint length);
extern void _myisam_log_command(enum myisam_log_commands command,
- MI_INFO *info, const byte *buffert,
+ MI_INFO *info, const uchar *buffert,
uint length, int result);
extern void _myisam_log_record(enum myisam_log_commands command,MI_INFO *info,
- const byte *record,my_off_t filepos,
+ const uchar *record,my_off_t filepos,
int result);
extern void mi_report_error(int errcode, const char *file_name);
extern my_bool _mi_memmap_file(MI_INFO *info);
extern void _mi_unmap_file(MI_INFO *info);
-extern uint save_pack_length(uint version, byte *block_buff, ulong length);
+extern uint save_pack_length(uint version, uchar *block_buff, ulong length);
extern uint read_pack_length(uint version, const uchar *buf, ulong *length);
extern uint calc_pack_length(uint version, ulong length);
-extern uint mi_mmap_pread(MI_INFO *info, byte *Buffer,
+extern uint mi_mmap_pread(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags);
-extern uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer,
+extern uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags);
-extern uint mi_nommap_pread(MI_INFO *info, byte *Buffer,
+extern uint mi_nommap_pread(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags);
-extern uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer,
+extern uint mi_nommap_pwrite(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags);
uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite);
@@ -741,17 +742,17 @@ char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo);
extern int mi_disable_indexes(MI_INFO *info);
extern int mi_enable_indexes(MI_INFO *info);
extern int mi_indexes_are_disabled(MI_INFO *info);
-ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record);
-ha_checksum mi_checksum(MI_INFO *info, const byte *buf);
-ha_checksum mi_static_checksum(MI_INFO *info, const byte *buf);
-my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
+ulong _my_calc_total_blob_length(MI_INFO *info, const uchar *record);
+ha_checksum mi_checksum(MI_INFO *info, const uchar *buf);
+ha_checksum mi_static_checksum(MI_INFO *info, const uchar *buf);
+my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record,
ha_checksum unique_hash, my_off_t pos);
-ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *buf);
+ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *buf);
int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def,
- const byte *record, my_off_t pos);
+ const uchar *record, my_off_t pos);
int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def,
- const byte *record, my_off_t pos);
-int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b,
+ const uchar *record, my_off_t pos);
+int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b,
my_bool null_are_equal);
void mi_get_status(void* param, int concurrent_insert);
void mi_update_status(void* param);
diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c
index 0bcf74d87a4..1cf4ad730cb 100644
--- a/storage/myisam/myisamlog.c
+++ b/storage/myisam/myisamlog.c
@@ -32,14 +32,14 @@ struct file_info {
long process;
int filenr,id;
uint rnd;
- my_string name,show_name,record;
+ char *name, *show_name, *record;
MI_INFO *isam;
bool closed,used;
ulong accessed;
};
struct test_if_open_param {
- my_string name;
+ char * name;
int max_id;
};
@@ -53,24 +53,25 @@ struct st_access_param
extern int main(int argc,char * *argv);
static void get_options(int *argc,char ***argv);
-static int examine_log(my_string file_name,char **table_names);
-static int read_string(IO_CACHE *file,gptr *to,uint length);
+static int examine_log(char * file_name,char **table_names);
+static int read_string(IO_CACHE *file,uchar* *to,uint length);
static int file_info_compare(void *cmp_arg, void *a,void *b);
static int test_if_open(struct file_info *key,element_count count,
struct test_if_open_param *param);
-static void fix_blob_pointers(MI_INFO *isam,byte *record);
+static void fix_blob_pointers(MI_INFO *isam,uchar *record);
static int test_when_accessed(struct file_info *key,element_count count,
struct st_access_param *access_param);
static void file_info_free(struct file_info *info);
static int close_some_file(TREE *tree);
static int reopen_closed_file(TREE *tree,struct file_info *file_info);
-static int find_record_with_key(struct file_info *file_info,byte *record);
+static int find_record_with_key(struct file_info *file_info,uchar *record);
static void printf_log(const char *str,...);
-static bool cmp_filename(struct file_info *file_info,my_string name);
+static bool cmp_filename(struct file_info *file_info,char * name);
static uint verbose=0,update=0,test_info=0,max_files=0,re_open_count=0,
recover=0,prefix_remove=0,opt_processes=0;
-static my_string log_filename=0,filepath=0,write_filename=0,record_pos_file=0;
+static char *log_filename=0, *filepath=0, *write_filename=0;
+static char *record_pos_file= 0;
static ulong com_count[10][3],number_of_commands=(ulong) ~0L,
isamlog_process;
static my_off_t isamlog_filepos,start_offset=0,record_pos= HA_OFFSET_ERROR;
@@ -296,7 +297,7 @@ static void get_options(register int *argc, register char ***argv)
}
-static int examine_log(my_string file_name, char **table_names)
+static int examine_log(char * file_name, char **table_names)
{
uint command,result,files_open;
ulong access_time,length;
@@ -304,7 +305,7 @@ static int examine_log(my_string file_name, char **table_names)
int lock_command,mi_result;
char isam_file_name[FN_REFLEN],llbuff[21],llbuff2[21];
uchar head[20];
- gptr buff;
+ uchar* buff;
struct test_if_open_param open_param;
IO_CACHE cache;
File file;
@@ -327,7 +328,7 @@ static int examine_log(my_string file_name, char **table_names)
}
init_io_cache(&cache,file,0,READ_CACHE,start_offset,0,MYF(0));
- bzero((gptr) com_count,sizeof(com_count));
+ bzero((uchar*) com_count,sizeof(com_count));
init_tree(&tree,0,0,sizeof(file_info),(qsort_cmp2) file_info_compare,1,
(tree_element_free) file_info_free, NULL);
VOID(init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,KEY_CACHE_SIZE,
@@ -335,7 +336,7 @@ static int examine_log(my_string file_name, char **table_names)
files_open=0; access_time=0;
while (access_time++ != number_of_commands &&
- !my_b_read(&cache,(byte*) head,9))
+ !my_b_read(&cache,(uchar*) head,9))
{
isamlog_filepos=my_b_tell(&cache)-9L;
file_info.filenr= mi_uint2korr(head+1);
@@ -375,14 +376,15 @@ static int examine_log(my_string file_name, char **table_names)
}
if (curr_file_info)
- printf("\nWarning: %s is opened with same process and filenumber\nMaybe you should use the -P option ?\n",
+ printf("\nWarning: %s is opened with same process and filenumber\n"
+ "Maybe you should use the -P option ?\n",
curr_file_info->show_name);
- if (my_b_read(&cache,(byte*) head,2))
+ if (my_b_read(&cache,(uchar*) head,2))
goto err;
file_info.name=0;
file_info.show_name=0;
file_info.record=0;
- if (read_string(&cache,(gptr*) &file_info.name,
+ if (read_string(&cache,(uchar**) &file_info.name,
(uint) mi_uint2korr(head)))
goto err;
{
@@ -455,7 +457,7 @@ static int examine_log(my_string file_name, char **table_names)
files_open++;
file_info.closed=0;
}
- VOID(tree_insert(&tree, (gptr) &file_info, 0, tree.custom_arg));
+ VOID(tree_insert(&tree, (uchar*) &file_info, 0, tree.custom_arg));
if (file_info.used)
{
if (verbose && !record_pos_file)
@@ -474,11 +476,11 @@ static int examine_log(my_string file_name, char **table_names)
{
if (!curr_file_info->closed)
files_open--;
- VOID(tree_delete(&tree, (gptr) curr_file_info, 0, tree.custom_arg));
+ VOID(tree_delete(&tree, (uchar*) curr_file_info, 0, tree.custom_arg));
}
break;
case MI_LOG_EXTRA:
- if (my_b_read(&cache,(byte*) head,1))
+ if (my_b_read(&cache,(uchar*) head,1))
goto err;
extra_command=(enum ha_extra_function) head[0];
if (verbose && !record_pos_file &&
@@ -499,7 +501,7 @@ static int examine_log(my_string file_name, char **table_names)
}
break;
case MI_LOG_DELETE:
- if (my_b_read(&cache,(byte*) head,8))
+ if (my_b_read(&cache,(uchar*) head,8))
goto err;
filepos=mi_sizekorr(head);
if (verbose && (!record_pos_file ||
@@ -534,7 +536,7 @@ static int examine_log(my_string file_name, char **table_names)
break;
case MI_LOG_WRITE:
case MI_LOG_UPDATE:
- if (my_b_read(&cache,(byte*) head,12))
+ if (my_b_read(&cache,(uchar*) head,12))
goto err;
filepos=mi_sizekorr(head);
length=mi_uint4korr(head+8);
@@ -616,7 +618,7 @@ static int examine_log(my_string file_name, char **table_names)
my_free(buff,MYF(0));
break;
case MI_LOG_LOCK:
- if (my_b_read(&cache,(byte*) head,sizeof(lock_command)))
+ if (my_b_read(&cache,(uchar*) head,sizeof(lock_command)))
goto err;
memcpy_fixed(&lock_command,head,sizeof(lock_command));
if (verbose && !record_pos_file &&
@@ -675,14 +677,14 @@ static int examine_log(my_string file_name, char **table_names)
}
-static int read_string(IO_CACHE *file, register gptr *to, register uint length)
+static int read_string(IO_CACHE *file, register uchar* *to, register uint length)
{
DBUG_ENTER("read_string");
if (*to)
- my_free((gptr) *to,MYF(0));
- if (!(*to= (gptr) my_malloc(length+1,MYF(MY_WME))) ||
- my_b_read(file,(byte*) *to,length))
+ my_free((uchar*) *to,MYF(0));
+ if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) ||
+ my_b_read(file,(uchar*) *to,length))
{
if (*to)
my_free(*to,MYF(0));
@@ -717,9 +719,9 @@ static int test_if_open (struct file_info *key,
}
-static void fix_blob_pointers(MI_INFO *info, byte *record)
+static void fix_blob_pointers(MI_INFO *info, uchar *record)
{
- byte *pos;
+ uchar *pos;
MI_BLOB *blob,*end;
pos=record+info->s->base.reclength;
@@ -801,7 +803,7 @@ static int reopen_closed_file(TREE *tree, struct file_info *fileinfo)
/* Try to find record with uniq key */
-static int find_record_with_key(struct file_info *file_info, byte *record)
+static int find_record_with_key(struct file_info *file_info, uchar *record)
{
uint key;
MI_INFO *info=file_info->isam;
@@ -836,7 +838,7 @@ static void printf_log(const char *format,...)
}
-static bool cmp_filename(struct file_info *file_info, my_string name)
+static bool cmp_filename(struct file_info *file_info, char * name)
{
if (!file_info)
return 1;
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index fb631b5e63e..5f7c4ee8f2e 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -69,8 +69,8 @@ typedef struct st_huff_counts {
my_off_t pre_space[8];
my_off_t tot_end_space,tot_pre_space,zero_fields,empty_fields,bytes_packed;
TREE int_tree; /* Tree for detecting distinct column values. */
- byte *tree_buff; /* Column values, 'field_length' each. */
- byte *tree_pos; /* Points to end of column values in 'tree_buff'. */
+ uchar *tree_buff; /* Column values, 'field_length' each. */
+ uchar *tree_pos; /* Points to end of column values in 'tree_buff'. */
} HUFF_COUNTS;
typedef struct st_huff_element HUFF_ELEMENT;
@@ -141,8 +141,8 @@ static int test_space_compress(HUFF_COUNTS *huff_counts,my_off_t records,
enum en_fieldtype field_type);
static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts,uint trees);
static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts);
-static int compare_huff_elements(void *not_used, byte *a,byte *b);
-static int save_counts_in_queue(byte *key,element_count count,
+static int compare_huff_elements(void *not_used, uchar *a,uchar *b);
+static int save_counts_in_queue(uchar *key,element_count count,
HUFF_TREE *tree);
static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag);
static uint join_same_trees(HUFF_COUNTS *huff_counts,uint trees);
@@ -171,7 +171,7 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
static int save_state_mrg(File file,PACK_MRG_INFO *isam_file,my_off_t new_length,
ha_checksum crc);
static int mrg_close(PACK_MRG_INFO *mrg);
-static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf);
+static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf);
static void mrg_reset(PACK_MRG_INFO *mrg);
#if !defined(DBUG_OFF)
static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count);
@@ -257,10 +257,10 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"backup", 'b', "Make a backup of the table as table_name.OLD.",
- (gptr*) &backup, (gptr*) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &backup, (uchar**) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR_MP,
- "Directory where character sets are.", (gptr*) &charsets_dir,
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (uchar**) &charsets_dir,
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
@@ -268,7 +268,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"join", 'j',
"Join all given tables into 'new_table_name'. All tables MUST have identical layouts.",
- (gptr*) &join_table, (gptr*) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ (uchar**) &join_table, (uchar**) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -282,8 +282,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"wait", 'w', "Wait and retry if table is in use.", (gptr*) &opt_wait,
- (gptr*) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"wait", 'w', "Wait and retry if table is in use.", (uchar**) &opt_wait,
+ (uchar**) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -478,7 +478,7 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
error:
while (i--)
mi_close(mrg->file[i]);
- my_free((gptr) mrg->file,MYF(0));
+ my_free((uchar*) mrg->file,MYF(0));
return 1;
}
@@ -811,11 +811,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
for (i=0 ; i < trees ; i++)
{
if (huff_trees[i].element_buffer)
- my_free((gptr) huff_trees[i].element_buffer,MYF(0));
+ my_free((uchar*) huff_trees[i].element_buffer,MYF(0));
if (huff_trees[i].code)
- my_free((gptr) huff_trees[i].code,MYF(0));
+ my_free((uchar*) huff_trees[i].code,MYF(0));
}
- my_free((gptr) huff_trees,MYF(0));
+ my_free((uchar*) huff_trees,MYF(0));
}
if (huff_counts)
{
@@ -823,11 +823,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
{
if (huff_counts[i].tree_buff)
{
- my_free((gptr) huff_counts[i].tree_buff,MYF(0));
+ my_free((uchar*) huff_counts[i].tree_buff,MYF(0));
delete_tree(&huff_counts[i].int_tree);
}
}
- my_free((gptr) huff_counts,MYF(0));
+ my_free((uchar*) huff_counts,MYF(0));
}
delete_queue(&queue); /* This is safe to free */
return;
@@ -840,7 +840,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
int error;
uint length;
ulong reclength,max_blob_length;
- byte *record,*pos,*next_pos,*end_pos,*start_pos;
+ uchar *record,*pos,*next_pos,*end_pos,*start_pos;
ha_rows record_count;
my_bool static_row_size;
HUFF_COUNTS *count,*end_count;
@@ -848,7 +848,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
DBUG_ENTER("get_statistic");
reclength=mrg->file[0]->s->base.reclength;
- record=(byte*) my_alloca(reclength);
+ record=(uchar*) my_alloca(reclength);
end_count=huff_counts+mrg->file[0]->s->base.fields;
record_count=0; glob_crc=0;
max_blob_length=0;
@@ -1032,7 +1032,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
{
uint i;
/* Zero fields are just counted. Go to the next record. */
- if (!memcmp((byte*) start_pos,zero_string,count->field_length))
+ if (!memcmp((uchar*) start_pos,zero_string,count->field_length))
{
count->zero_fields++;
continue;
@@ -1141,12 +1141,12 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
mrg->records=record_count;
mrg->max_blob_length=max_blob_length;
- my_afree((gptr) record);
+ my_afree((uchar*) record);
DBUG_RETURN(error != HA_ERR_END_OF_FILE);
}
static int compare_huff_elements(void *not_used __attribute__((unused)),
- byte *a, byte *b)
+ uchar *a, uchar *b)
{
return *((my_off_t*) a) < *((my_off_t*) b) ? -1 :
(*((my_off_t*) a) == *((my_off_t*) b) ? 0 : 1);
@@ -1162,7 +1162,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
my_off_t old_length,new_length,length;
DBUG_ENTER("check_counts");
- bzero((gptr) field_count,sizeof(field_count));
+ bzero((uchar*) field_count,sizeof(field_count));
space_fields=fill_zero_fields=0;
for (; trees-- ; huff_counts++)
@@ -1328,12 +1328,12 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
}
else
{
- my_free((gptr) huff_counts->tree_buff,MYF(0));
+ my_free((uchar*) huff_counts->tree_buff,MYF(0));
delete_tree(&huff_counts->int_tree);
huff_counts->tree_buff=0;
}
if (tree.element_buffer)
- my_free((gptr) tree.element_buffer,MYF(0));
+ my_free((uchar*) tree.element_buffer,MYF(0));
}
if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS)
space_fields++;
@@ -1450,8 +1450,8 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts, uint trees)
if (make_huff_tree(huff_tree+tree,huff_counts+tree))
{
while (tree--)
- my_free((gptr) huff_tree[tree].element_buffer,MYF(0));
- my_free((gptr) huff_tree,MYF(0));
+ my_free((uchar*) huff_tree[tree].element_buffer,MYF(0));
+ my_free((uchar*) huff_tree,MYF(0));
DBUG_RETURN(0);
}
}
@@ -1526,7 +1526,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
{
HUFF_ELEMENT *temp;
if (!(temp=
- (HUFF_ELEMENT*) my_realloc((gptr) huff_tree->element_buffer,
+ (HUFF_ELEMENT*) my_realloc((uchar*) huff_tree->element_buffer,
found*2*sizeof(HUFF_ELEMENT),
MYF(MY_WME))))
return 1;
@@ -1561,7 +1561,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
*/
tree_walk(&huff_counts->int_tree,
(int (*)(void*, element_count,void*)) save_counts_in_queue,
- (gptr) huff_tree, left_root_right);
+ (uchar*) huff_tree, left_root_right);
}
else
{
@@ -1587,7 +1587,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
new_huff_el->count=huff_counts->counts[i];
new_huff_el->a.leaf.null=0;
new_huff_el->a.leaf.element_nr=i;
- queue.root[found]=(byte*) new_huff_el;
+ queue.root[found]=(uchar*) new_huff_el;
}
}
/*
@@ -1604,7 +1604,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
new_huff_el->a.leaf.element_nr=huff_tree->min_chr=last-1;
else
new_huff_el->a.leaf.element_nr=huff_tree->max_chr=last+1;
- queue.root[found]=(byte*) new_huff_el;
+ queue.root[found]=(uchar*) new_huff_el;
}
}
@@ -1654,7 +1654,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
Replace the copied top element by the new element and re-order the
queue.
*/
- queue.root[1]=(byte*) new_huff_el;
+ queue.root[1]=(uchar*) new_huff_el;
queue_replaced(&queue);
}
huff_tree->root=(HUFF_ELEMENT*) queue.root[1];
@@ -1693,7 +1693,7 @@ static int compare_tree(void* cmp_arg __attribute__((unused)),
0
*/
-static int save_counts_in_queue(byte *key, element_count count,
+static int save_counts_in_queue(uchar *key, element_count count,
HUFF_TREE *tree)
{
HUFF_ELEMENT *new_huff_el;
@@ -1703,7 +1703,7 @@ static int save_counts_in_queue(byte *key, element_count count,
new_huff_el->a.leaf.null=0;
new_huff_el->a.leaf.element_nr= (uint) (key- tree->counts->tree_buff) /
tree->counts->field_length;
- queue.root[tree->elements]=(byte*) new_huff_el;
+ queue.root[tree->elements]=(uchar*) new_huff_el;
return 0;
}
@@ -1760,7 +1760,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
first=i;
last=i;
/* We start with root[1], which is the queues top element. */
- queue.root[found]=(byte*) &huff_counts->counts[i];
+ queue.root[found]=(uchar*) &huff_counts->counts[i];
}
}
if (!found)
@@ -1771,7 +1771,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
the loop, which follows the Huffman algorithm.
*/
if (found < 2)
- queue.root[++found]=(byte*) &huff_counts->counts[last ? 0 : 1];
+ queue.root[++found]=(uchar*) &huff_counts->counts[last ? 0 : 1];
/* Make a queue from the queue buffer. */
queue.elements=found;
@@ -1826,7 +1826,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
queue. This successively replaces the references to counts by
references to HUFF_ELEMENTs.
*/
- queue.root[1]=(byte*) new_huff_el;
+ queue.root[1]=(uchar*) new_huff_el;
queue_replaced(&queue);
}
DBUG_RETURN(bytes_packed+(bits_packed+7)/8);
@@ -1859,12 +1859,12 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees)
i->tree->tree_pack_length+j->tree->tree_pack_length+
ALLOWED_JOIN_DIFF)
{
- memcpy_fixed((byte*) i->counts,(byte*) count.counts,
+ memcpy_fixed((uchar*) i->counts,(uchar*) count.counts,
sizeof(count.counts[0])*256);
- my_free((gptr) j->tree->element_buffer,MYF(0));
+ my_free((uchar*) j->tree->element_buffer,MYF(0));
j->tree->element_buffer=0;
j->tree=i->tree;
- bmove((byte*) i->counts,(byte*) count.counts,
+ bmove((uchar*) i->counts,(uchar*) count.counts,
sizeof(count.counts[0])*256);
if (make_huff_tree(i->tree,i))
return (uint) -1;
@@ -2007,7 +2007,7 @@ static char *hexdigits(ulonglong value)
static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees,
my_off_t tot_elements,my_off_t filelength)
{
- byte *buff= (byte*) file_buffer.pos;
+ uchar *buff= (uchar*) file_buffer.pos;
bzero(buff,HEAD_LENGTH);
memcpy_fixed(buff,myisam_pack_file_magic,4);
@@ -2023,7 +2023,7 @@ static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees,
if (test_only)
return 0;
VOID(my_seek(file_buffer.file,0L,MY_SEEK_SET,MYF(0)));
- return my_write(file_buffer.file,(const byte *) file_buffer.pos,HEAD_LENGTH,
+ return my_write(file_buffer.file,(const uchar *) file_buffer.pos,HEAD_LENGTH,
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)) != 0;
}
@@ -2159,7 +2159,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
{ /* This should be impossible */
VOID(fprintf(stderr, "Tree offset got too big: %d, aborted\n",
huff_tree->max_offset));
- my_afree((gptr) packed_tree);
+ my_afree((uchar*) packed_tree);
return 0;
}
@@ -2331,7 +2331,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
DBUG_PRINT("info", (" "));
if (verbose >= 2)
VOID(printf("\n"));
- my_afree((gptr) packed_tree);
+ my_afree((uchar*) packed_tree);
if (errors)
{
VOID(fprintf(stderr, "Error: Generated decode trees are corrupt. Stop.\n"));
@@ -2412,7 +2412,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
my_off_t record_count;
char llbuf[32];
ulong length,pack_length;
- byte *record,*pos,*end_pos,*record_pos,*start_pos;
+ uchar *record,*pos,*end_pos,*record_pos,*start_pos;
HUFF_COUNTS *count,*end_count;
HUFF_TREE *tree;
MI_INFO *isam_file=mrg->file[0];
@@ -2420,7 +2420,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
DBUG_ENTER("compress_isam_file");
/* Allocate a buffer for the records (excluding blobs). */
- if (!(record=(byte*) my_alloca(isam_file->s->base.reclength)))
+ if (!(record=(uchar*) my_alloca(isam_file->s->base.reclength)))
return -1;
end_count=huff_counts+isam_file->s->base.fields;
@@ -2471,7 +2471,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
{
if (flush_buffer((ulong) max_calc_length + (ulong) max_pack_length))
break;
- record_pos= (byte*) file_buffer.pos;
+ record_pos= (uchar*) file_buffer.pos;
file_buffer.pos+=max_pack_length;
for (start_pos=record, count= huff_counts; count < end_count ; count++)
{
@@ -2508,7 +2508,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
switch (count->field_type) {
case FIELD_SKIP_ZERO:
- if (!memcmp((byte*) start_pos,zero_string,field_length))
+ if (!memcmp((uchar*) start_pos,zero_string,field_length))
{
DBUG_PRINT("fields", ("FIELD_SKIP_ZERO zeroes only, bits: 1"));
write_bits(1,1);
@@ -2637,7 +2637,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
break;
case FIELD_INTERVALL:
global_count=count;
- pos=(byte*) tree_search(&count->int_tree, start_pos,
+ pos=(uchar*) tree_search(&count->int_tree, start_pos,
count->int_tree.custom_arg);
intervall=(uint) (pos - count->tree_buff)/field_length;
DBUG_PRINT("fields", ("FIELD_INTERVALL"));
@@ -2660,7 +2660,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
}
else
{
- byte *blob,*blob_end;
+ uchar *blob,*blob_end;
DBUG_PRINT("fields", ("FIELD_BLOB not empty, bits: 1"));
write_bits(0,1);
/* Write the blob length. */
@@ -2701,7 +2701,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
}
else
{
- byte *end= start_pos + var_pack_length + col_length;
+ uchar *end= start_pos + var_pack_length + col_length;
DBUG_PRINT("fields", ("FIELD_VARCHAR not empty, bits: 1"));
write_bits(0,1);
/* Write the varchar length. */
@@ -2733,7 +2733,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
DBUG_PRINT("fields", ("---"));
}
flush_bits();
- length=(ulong) ((byte*) file_buffer.pos - record_pos) - max_pack_length;
+ length=(ulong) ((uchar*) file_buffer.pos - record_pos) - max_pack_length;
pack_length= save_pack_length(pack_version, record_pos, length);
if (pack_blob_length)
pack_length+= save_pack_length(pack_version, record_pos + pack_length,
@@ -2773,7 +2773,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
if (verbose >= 2)
VOID(printf("wrote %s records.\n", llstr((longlong) record_count, llbuf)));
- my_afree((gptr) record);
+ my_afree((uchar*) record);
mrg->ref_length=max_pack_length;
mrg->min_pack_length=max_record_length ? min_record_length : 0;
mrg->max_pack_length=max_record_length;
@@ -2840,7 +2840,7 @@ static int flush_buffer(ulong neaded_length)
if (test_only)
return 0;
if (error_on_write|| my_write(file_buffer.file,
- (const byte*) file_buffer.buffer,
+ (const uchar*) file_buffer.buffer,
length,
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)))
{
@@ -2867,7 +2867,7 @@ static int flush_buffer(ulong neaded_length)
static void end_file_buffer(void)
{
- my_free((gptr) file_buffer.buffer,MYF(0));
+ my_free((uchar*) file_buffer.buffer,MYF(0));
}
/* output `bits` low bits of `value' */
@@ -3025,7 +3025,7 @@ static void mrg_reset(PACK_MRG_INFO *mrg)
}
}
-static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf)
+static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf)
{
int error;
MI_INFO *isam_info;
@@ -3048,7 +3048,7 @@ static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf)
for (;;)
{
isam_info->update&= HA_STATE_CHANGED;
- if (!(error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf,
+ if (!(error=(*isam_info->s->read_rnd)(isam_info,(uchar*) buf,
filepos, 1)) ||
error != HA_ERR_END_OF_FILE)
return (error);
@@ -3071,7 +3071,7 @@ static int mrg_close(PACK_MRG_INFO *mrg)
for (i=0 ; i < mrg->count ; i++)
error|=mi_close(mrg->file[i]);
if (mrg->free_file)
- my_free((gptr) mrg->file,MYF(0));
+ my_free((uchar*) mrg->file,MYF(0));
return error;
}
@@ -3134,7 +3134,7 @@ static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count)
*/
if (huff_counts->tree_buff)
{
- my_free((gptr) huff_counts->tree_buff, MYF(0));
+ my_free((uchar*) huff_counts->tree_buff, MYF(0));
delete_tree(&huff_counts->int_tree);
huff_counts->tree_buff= NULL;
DBUG_PRINT("fakebigcodes", ("freed distinct column values"));
diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c
index cf144839dd1..63ed60586d6 100644
--- a/storage/myisam/rt_index.c
+++ b/storage/myisam/rt_index.c
@@ -141,11 +141,11 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
res = 1;
ok:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
return res;
err1:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
info->lastpos = HA_OFFSET_ERROR;
return -1;
}
@@ -356,11 +356,11 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length,
res = 1;
ok:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
return res;
err1:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
info->lastpos = HA_OFFSET_ERROR;
return -1;
}
@@ -602,11 +602,11 @@ static int rtree_insert_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
}
ok:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
DBUG_RETURN(res);
err1:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
DBUG_RETURN(-1); /* purecov: inspected */
}
@@ -690,10 +690,10 @@ static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key,
DBUG_PRINT("rtree", ("new root page: %lu level: %d nod_flag: %u",
(ulong) new_root, 0, mi_test_if_nod(new_root_buf)));
- my_afree((byte*)new_root_buf);
+ my_afree((uchar*)new_root_buf);
break;
err1:
- my_afree((byte*)new_root_buf);
+ my_afree((uchar*)new_root_buf);
DBUG_RETURN(-1); /* purecov: inspected */
}
default:
@@ -739,7 +739,7 @@ static int rtree_fill_reinsert_list(stPageList *ReinsertList, my_off_t page,
if (ReinsertList->n_pages == ReinsertList->m_pages)
{
ReinsertList->m_pages += REINSERT_BUFFER_INC;
- if (!(ReinsertList->pages = (stPageLevel*)my_realloc((gptr)ReinsertList->pages,
+ if (!(ReinsertList->pages = (stPageLevel*)my_realloc((uchar*)ReinsertList->pages,
ReinsertList->m_pages * sizeof(stPageLevel), MYF(MY_ALLOW_ZERO_PTR))))
goto err1;
}
@@ -891,11 +891,11 @@ static int rtree_delete_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
res = 1;
ok:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
DBUG_RETURN(res);
err1:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
DBUG_RETURN(-1); /* purecov: inspected */
}
@@ -968,7 +968,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
if ((res= rtree_insert_level(info, keynr, k, key_length,
ReinsertList.pages[i].level)) == -1)
{
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
goto err1;
}
if (res)
@@ -984,13 +984,13 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
}
}
}
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
if (_mi_dispose(info, keyinfo, ReinsertList.pages[i].offs,
DFLT_INIT_HITS))
goto err1;
}
if (ReinsertList.pages)
- my_free((byte*) ReinsertList.pages, MYF(0));
+ my_free((uchar*) ReinsertList.pages, MYF(0));
/* check for redundant root (not leaf, 1 child) and eliminate */
if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
@@ -1117,11 +1117,11 @@ ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key,
res = HA_POS_ERROR;
}
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
return res;
err1:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
return HA_POS_ERROR;
}
diff --git a/storage/myisam/rt_split.c b/storage/myisam/rt_split.c
index 0f6dc872958..ef988dbd048 100644
--- a/storage/myisam/rt_split.c
+++ b/storage/myisam/rt_split.c
@@ -345,10 +345,10 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
DFLT_INIT_HITS, new_page);
DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs));
- my_afree((byte*)new_page);
+ my_afree((uchar*)new_page);
split_err:
- my_afree((byte*) coord_buf);
+ my_afree((uchar*) coord_buf);
DBUG_RETURN(err_code);
}
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index 9cd9eae5b36..bf3281e7d32 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -84,7 +84,7 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
char* key, uint sort_length,
uint count);
static inline int
-my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs);
+my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs);
/*
Creates a index of sorted keys
@@ -164,7 +164,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer,
maxbuffer/2))
{
- my_free((gptr) sort_keys,MYF(0));
+ my_free((uchar*) sort_keys,MYF(0));
sort_keys= 0;
}
else
@@ -231,9 +231,9 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
reinit_io_cache(&tempfile_for_exceptions,READ_CACHE,0L,0,0))
goto err;
- while (!my_b_read(&tempfile_for_exceptions,(byte*)&key_length,
+ while (!my_b_read(&tempfile_for_exceptions,(uchar*)&key_length,
sizeof(key_length))
- && !my_b_read(&tempfile_for_exceptions,(byte*)sort_keys,
+ && !my_b_read(&tempfile_for_exceptions,(uchar*)sort_keys,
(uint) key_length))
{
if (_mi_ck_write(idx,keyno,(uchar*) sort_keys,key_length-ref_length))
@@ -245,7 +245,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
err:
if (sort_keys)
- my_free((gptr) sort_keys,MYF(0));
+ my_free((uchar*) sort_keys,MYF(0));
delete_dynamic(&buffpek);
close_cached_file(&tempfile);
close_cached_file(&tempfile_for_exceptions);
@@ -384,7 +384,7 @@ pthread_handler_t thr_find_all_keys(void *arg)
if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK),
maxbuffer, maxbuffer/2))
{
- my_free((gptr) sort_keys,MYF(0));
+ my_free((uchar*) sort_keys,MYF(0));
sort_keys= (uchar **) NULL; /* for err: label */
}
else
@@ -454,7 +454,7 @@ err:
DBUG_PRINT("error", ("got some error"));
sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */
if (sort_keys)
- my_free((gptr) sort_keys,MYF(0));
+ my_free((uchar*) sort_keys,MYF(0));
sort_param->sort_keys= 0;
delete_dynamic(& sort_param->buffpek);
close_cached_file(&sort_param->tempfile);
@@ -496,7 +496,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
MI_INFO *info=sort_info->info;
MYISAM_SHARE *share=info->s;
MI_SORT_PARAM *sinfo;
- byte *mergebuf=0;
+ uchar *mergebuf=0;
DBUG_ENTER("thr_write_keys");
LINT_INIT(length);
@@ -531,7 +531,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
sinfo->notnull: NULL,
(ulonglong) info->state->records);
}
- my_free((gptr) sinfo->sort_keys,MYF(0));
+ my_free((uchar*) sinfo->sort_keys,MYF(0));
my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff),
MYF(MY_ALLOW_ZERO_PTR));
sinfo->sort_keys=0;
@@ -622,12 +622,12 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
}
while (!got_error &&
- !my_b_read(&sinfo->tempfile_for_exceptions,(byte*)&key_length,
+ !my_b_read(&sinfo->tempfile_for_exceptions,(uchar*)&key_length,
sizeof(key_length)))
{
- byte ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10];
+ uchar ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10];
if (key_length > sizeof(ft_buf) ||
- my_b_read(&sinfo->tempfile_for_exceptions, (byte*)ft_buf,
+ my_b_read(&sinfo->tempfile_for_exceptions, (uchar*)ft_buf,
(uint)key_length) ||
_mi_ck_write(info, sinfo->key, (uchar*)ft_buf,
key_length - info->s->rec_reflength))
@@ -635,7 +635,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
}
}
}
- my_free((gptr) mergebuf,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(got_error);
}
#endif /* THREAD */
@@ -649,7 +649,7 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
uint sort_length=info->key_length;
DBUG_ENTER("write_keys");
- qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp,
+ qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp,
info);
if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST",
@@ -661,7 +661,7 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
for (end=sort_keys+count ; sort_keys != end ; sort_keys++)
{
- if (my_b_write(tempfile,(byte*) *sort_keys,(uint) sort_length))
+ if (my_b_write(tempfile,(uchar*) *sort_keys,(uint) sort_length))
DBUG_RETURN(1); /* purecov: inspected */
}
DBUG_RETURN(0);
@@ -669,13 +669,13 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
static inline int
-my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs)
+my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs)
{
int err;
uint16 len = _mi_keylength(info->keyinfo, (uchar*) bufs);
/* The following is safe as this is a local file */
- if ((err= my_b_write(to_file, (byte*)&len, sizeof(len))))
+ if ((err= my_b_write(to_file, (uchar*)&len, sizeof(len))))
return (err);
if ((err= my_b_write(to_file,bufs, (uint) len)))
return (err);
@@ -692,7 +692,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,
int err;
DBUG_ENTER("write_keys_varlen");
- qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp,
+ qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp,
info);
if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST",
@@ -703,7 +703,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,
buffpek->count=count;
for (end=sort_keys+count ; sort_keys != end ; sort_keys++)
{
- if ((err= my_var_write(info,tempfile, (byte*) *sort_keys)))
+ if ((err= my_var_write(info,tempfile, (uchar*) *sort_keys)))
DBUG_RETURN(err);
}
DBUG_RETURN(0);
@@ -721,8 +721,8 @@ static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key,
DISK_BUFFER_SIZE, info->sort_info->param->myf_rw))
DBUG_RETURN(1);
- if (my_b_write(tempfile,(byte*)&key_length,sizeof(key_length)) ||
- my_b_write(tempfile,(byte*)key,(uint) key_length))
+ if (my_b_write(tempfile,(uchar*)&key_length,sizeof(key_length)) ||
+ my_b_write(tempfile,(uchar*)key,(uint) key_length))
DBUG_RETURN(1);
DBUG_RETURN(0);
} /* write_key */
@@ -735,7 +735,7 @@ static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys,
{
DBUG_ENTER("write_index");
- qsort2((gptr) sort_keys,(size_t) count,sizeof(byte*),
+ qsort2((uchar*) sort_keys,(size_t) count,sizeof(uchar*),
(qsort2_cmp) info->key_cmp,info);
while (count--)
{
@@ -814,7 +814,7 @@ static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
{
- if (my_pread(fromfile->file,(byte*) buffpek->base,
+ if (my_pread(fromfile->file,(uchar*) buffpek->base,
(length= sort_length*count),buffpek->file_pos,MYF_RW))
return((uint) -1); /* purecov: inspected */
buffpek->key=buffpek->base;
@@ -839,11 +839,11 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
for (idx=1;idx<=count;idx++)
{
- if (my_pread(fromfile->file,(byte*)&length_of_key,sizeof(length_of_key),
+ if (my_pread(fromfile->file,(uchar*)&length_of_key,sizeof(length_of_key),
buffpek->file_pos,MYF_RW))
return((uint) -1);
buffpek->file_pos+=sizeof(length_of_key);
- if (my_pread(fromfile->file,(byte*) buffp,length_of_key,
+ if (my_pread(fromfile->file,(uchar*) buffp,length_of_key,
buffpek->file_pos,MYF_RW))
return((uint) -1);
buffpek->file_pos+=length_of_key;
@@ -867,7 +867,7 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
for (idx=1;idx<=count;idx++)
{
int err;
- if ((err= my_var_write(info,to_file, (byte*) bufs)))
+ if ((err= my_var_write(info,to_file, (uchar*) bufs)))
return (err);
bufs=bufs+sort_length;
}
@@ -879,7 +879,7 @@ static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)),
IO_CACHE *to_file, char* key,
uint sort_length, uint count)
{
- return my_b_write(to_file,(byte*) key,(uint) sort_length*count);
+ return my_b_write(to_file,(uchar*) key,(uint) sort_length*count);
}
/*
@@ -911,7 +911,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
sort_length=info->key_length;
if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0,
- (int (*)(void*, byte *,byte*)) info->key_cmp,
+ (int (*)(void*, uchar *,uchar*)) info->key_cmp,
(void*) info))
DBUG_RETURN(1); /* purecov: inspected */
@@ -938,7 +938,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file)
{
- if (info->write_key(info,to_file,(byte*) buffpek->key,
+ if (info->write_key(info,to_file,(uchar*) buffpek->key,
(uint) sort_length,1))
{
error=1; goto err; /* purecov: inspected */
@@ -994,7 +994,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
{
if (to_file)
{
- if (info->write_key(info,to_file,(byte*) buffpek->key,
+ if (info->write_key(info,to_file,(uchar*) buffpek->key,
sort_length,buffpek->mem_count))
{
error=1; goto err; /* purecov: inspected */
@@ -1047,7 +1047,7 @@ flush_ft_buf(MI_SORT_PARAM *info)
if (info->sort_info->ft_buf)
{
err=sort_ft_buf_flush(info);
- my_free((gptr)info->sort_info->ft_buf, MYF(0));
+ my_free((uchar*)info->sort_info->ft_buf, MYF(0));
info->sort_info->ft_buf=0;
}
return err;
diff --git a/storage/myisam/sp_defs.h b/storage/myisam/sp_defs.h
index 11254d16c97..187ec62b2a3 100644
--- a/storage/myisam/sp_defs.h
+++ b/storage/myisam/sp_defs.h
@@ -40,7 +40,7 @@ enum wkbByteOrder
};
uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
- const byte *record, my_off_t filepos);
+ const uchar *record, my_off_t filepos);
#endif /*HAVE_SPATIAL*/
#endif /* _SP_DEFS_H */
diff --git a/storage/myisam/sp_key.c b/storage/myisam/sp_key.c
index 34c96a219c7..be4021935c4 100644
--- a/storage/myisam/sp_key.c
+++ b/storage/myisam/sp_key.c
@@ -31,25 +31,25 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
double *mbr, int top);
static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr);
-static void get_double(double *d, const byte *pos)
+static void get_double(double *d, const uchar *pos)
{
float8get(*d, pos);
}
uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
- const byte *record, my_off_t filepos)
+ const uchar *record, my_off_t filepos)
{
HA_KEYSEG *keyseg;
MI_KEYDEF *keyinfo = &info->s->keyinfo[keynr];
uint len = 0;
- byte *pos;
+ uchar *pos;
uint dlen;
uchar *dptr;
double mbr[SPDIMS * 2];
uint i;
keyseg = &keyinfo->seg[-1];
- pos = (byte*)record + keyseg->start;
+ pos = (uchar*)record + keyseg->start;
dlen = _mi_calc_blob_length(keyseg->bit_start, pos);
memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*));
@@ -64,7 +64,7 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
{
uint length = keyseg->length;
- pos = ((byte*)mbr) + keyseg->start;
+ pos = ((uchar*)mbr) + keyseg->start;
if (keyseg->flag & HA_SWAP_KEY)
{
#ifdef HAVE_ISNAN
@@ -100,7 +100,7 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
}
else
{
- memcpy((byte*)key, pos, length);
+ memcpy((uchar*)key, pos, length);
key += keyseg->length;
}
len += keyseg->length;
@@ -141,7 +141,7 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
{
if ((*wkb) > end - 8)
return -1;
- get_double(&ord, (const byte*) *wkb);
+ get_double(&ord, (const uchar*) *wkb);
(*wkb)+= 8;
if (ord < *mbr)
float8store((char*) mbr, ord);
diff --git a/storage/myisammrg/CMakeLists.txt b/storage/myisammrg/CMakeLists.txt
index 8c8c8bcf9fb..b35638ac91d 100644
--- a/storage/myisammrg/CMakeLists.txt
+++ b/storage/myisammrg/CMakeLists.txt
@@ -15,6 +15,9 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+IF(EMBEDDED_ONLY)
+ ADD_DEFINITIONS(-DUSE_TLS)
+ENDIF(EMBEDDED_ONLY)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/sql
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 5df3e7799d0..c03c1e28014 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -52,6 +52,24 @@ extern int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
uint t1_keys, uint t1_recs,
MI_KEYDEF *t2_keyinfo, MI_COLUMNDEF *t2_recinfo,
uint t2_keys, uint t2_recs, bool strict);
+static void split_file_name(const char *file_name,
+ LEX_STRING *db, LEX_STRING *name);
+
+
+extern "C" void myrg_print_wrong_table(const char *table_name)
+{
+ LEX_STRING db, name;
+ char buf[FN_REFLEN];
+ split_file_name(table_name, &db, &name);
+ memcpy(buf, db.str, db.length);
+ buf[db.length]= '.';
+ memcpy(buf + db.length + 1, name.str, name.length);
+ buf[db.length + name.length + 1]= 0;
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_ADMIN_WRONG_MRG_TABLE, ER(ER_ADMIN_WRONG_MRG_TABLE),
+ buf);
+}
+
const char **ha_myisammrg::bas_ext() const
{
@@ -102,6 +120,8 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
{
DBUG_PRINT("error",("reclength: %lu mean_rec_length: %lu",
table->s->reclength, stats.mean_rec_length));
+ if (test_if_locked & HA_OPEN_FOR_REPAIR)
+ myrg_print_wrong_table(file->open_tables->table->filename);
error= HA_ERR_WRONG_MRG_TABLE_DEF;
goto err;
}
@@ -120,12 +140,19 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
u_table->table->s->base.keys,
u_table->table->s->base.fields, false))
{
- my_free((gptr) recinfo, MYF(0));
error= HA_ERR_WRONG_MRG_TABLE_DEF;
- goto err;
+ if (test_if_locked & HA_OPEN_FOR_REPAIR)
+ myrg_print_wrong_table(u_table->table->filename);
+ else
+ {
+ my_free((uchar*) recinfo, MYF(0));
+ goto err;
+ }
}
}
- my_free((gptr) recinfo, MYF(0));
+ my_free((uchar*) recinfo, MYF(0));
+ if (error == HA_ERR_WRONG_MRG_TABLE_DEF)
+ goto err;
#if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
/* Merge table has more than 2G rows */
if (table->s->crashed)
@@ -146,7 +173,7 @@ int ha_myisammrg::close(void)
return myrg_close(file);
}
-int ha_myisammrg::write_row(byte * buf)
+int ha_myisammrg::write_row(uchar * buf)
{
ha_statistic_increment(&SSV::ha_write_count);
@@ -164,7 +191,7 @@ int ha_myisammrg::write_row(byte * buf)
return myrg_write(file,buf);
}
-int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
+int ha_myisammrg::update_row(const uchar * old_data, uchar * new_data)
{
ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
@@ -172,13 +199,13 @@ int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
return myrg_update(file,old_data,new_data);
}
-int ha_myisammrg::delete_row(const byte * buf)
+int ha_myisammrg::delete_row(const uchar * buf)
{
ha_statistic_increment(&SSV::ha_delete_count);
return myrg_delete(file,buf);
}
-int ha_myisammrg::index_read(byte * buf, const byte * key,
+int ha_myisammrg::index_read(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -188,7 +215,7 @@ int ha_myisammrg::index_read(byte * buf, const byte * key,
return error;
}
-int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
+int ha_myisammrg::index_read_idx(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -198,7 +225,7 @@ int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
return error;
}
-int ha_myisammrg::index_read_last(byte * buf, const byte * key,
+int ha_myisammrg::index_read_last(uchar * buf, const uchar * key,
key_part_map keypart_map)
{
ha_statistic_increment(&SSV::ha_read_key_count);
@@ -208,7 +235,7 @@ int ha_myisammrg::index_read_last(byte * buf, const byte * key,
return error;
}
-int ha_myisammrg::index_next(byte * buf)
+int ha_myisammrg::index_next(uchar * buf)
{
ha_statistic_increment(&SSV::ha_read_next_count);
int error=myrg_rnext(file,buf,active_index);
@@ -216,7 +243,7 @@ int ha_myisammrg::index_next(byte * buf)
return error;
}
-int ha_myisammrg::index_prev(byte * buf)
+int ha_myisammrg::index_prev(uchar * buf)
{
ha_statistic_increment(&SSV::ha_read_prev_count);
int error=myrg_rprev(file,buf, active_index);
@@ -224,7 +251,7 @@ int ha_myisammrg::index_prev(byte * buf)
return error;
}
-int ha_myisammrg::index_first(byte * buf)
+int ha_myisammrg::index_first(uchar * buf)
{
ha_statistic_increment(&SSV::ha_read_first_count);
int error=myrg_rfirst(file, buf, active_index);
@@ -232,7 +259,7 @@ int ha_myisammrg::index_first(byte * buf)
return error;
}
-int ha_myisammrg::index_last(byte * buf)
+int ha_myisammrg::index_last(uchar * buf)
{
ha_statistic_increment(&SSV::ha_read_last_count);
int error=myrg_rlast(file, buf, active_index);
@@ -240,8 +267,8 @@ int ha_myisammrg::index_last(byte * buf)
return error;
}
-int ha_myisammrg::index_next_same(byte * buf,
- const byte *key __attribute__((unused)),
+int ha_myisammrg::index_next_same(uchar * buf,
+ const uchar *key __attribute__((unused)),
uint length __attribute__((unused)))
{
ha_statistic_increment(&SSV::ha_read_next_count);
@@ -257,7 +284,7 @@ int ha_myisammrg::rnd_init(bool scan)
}
-int ha_myisammrg::rnd_next(byte *buf)
+int ha_myisammrg::rnd_next(uchar *buf)
{
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=myrg_rrnd(file, buf, HA_OFFSET_ERROR);
@@ -266,7 +293,7 @@ int ha_myisammrg::rnd_next(byte *buf)
}
-int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
+int ha_myisammrg::rnd_pos(uchar * buf, uchar *pos)
{
ha_statistic_increment(&SSV::ha_read_rnd_count);
int error=myrg_rrnd(file, buf, my_get_ptr(pos,ref_length));
@@ -274,7 +301,7 @@ int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
return error;
}
-void ha_myisammrg::position(const byte *record)
+void ha_myisammrg::position(const uchar *record)
{
ulonglong row_position= myrg_position(file);
my_store_ptr(ref, ref_length, (my_off_t) row_position);
@@ -464,8 +491,8 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
goto err;
create_info->merge_list.elements++;
- (*create_info->merge_list.next) = (byte*) ptr;
- create_info->merge_list.next= (byte**) &ptr->next_local;
+ (*create_info->merge_list.next) = (uchar*) ptr;
+ create_info->merge_list.next= (uchar**) &ptr->next_local;
}
*create_info->merge_list.next=0;
}
@@ -593,6 +620,13 @@ bool ha_myisammrg::check_if_incompatible_data(HA_CREATE_INFO *info,
return COMPATIBLE_DATA_NO;
}
+
+int ha_myisammrg::check(THD* thd, HA_CHECK_OPT* check_opt)
+{
+ return HA_ADMIN_OK;
+}
+
+
extern int myrg_panic(enum ha_panic_function flag);
int myisammrg_panic(handlerton *hton, ha_panic_function flag)
{
diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h
index 7bbe659d4b7..91f583c3330 100644
--- a/storage/myisammrg/ha_myisammrg.h
+++ b/storage/myisammrg/ha_myisammrg.h
@@ -53,23 +53,23 @@ class ha_myisammrg: public handler
int open(const char *name, int mode, uint test_if_locked);
int close(void);
- int write_row(byte * buf);
- int update_row(const byte * old_data, byte * new_data);
- int delete_row(const byte * buf);
- int index_read(byte * buf, const byte * key, key_part_map keypart_map,
+ int write_row(uchar * buf);
+ int update_row(const uchar * old_data, uchar * new_data);
+ int delete_row(const uchar * buf);
+ int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
enum ha_rkey_function find_flag);
- int index_read_idx(byte * buf, uint index, const byte * key,
+ int index_read_idx(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_read_last(byte * buf, const byte * key, key_part_map keypart_map);
- int index_next(byte * buf);
- int index_prev(byte * buf);
- int index_first(byte * buf);
- int index_last(byte * buf);
- int index_next_same(byte *buf, const byte *key, uint keylen);
+ int index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map);
+ int index_next(uchar * buf);
+ int index_prev(uchar * buf);
+ int index_first(uchar * buf);
+ int index_last(uchar * buf);
+ int index_next_same(uchar *buf, const uchar *key, uint keylen);
int rnd_init(bool scan);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
- void position(const byte *record);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
+ void position(const uchar *record);
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
int info(uint);
int reset(void);
@@ -84,4 +84,5 @@ class ha_myisammrg: public handler
void append_create_info(String *packet);
MYRG_INFO *myrg_info() { return file; }
bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
+ int check(THD* thd, HA_CHECK_OPT* check_opt);
};
diff --git a/storage/myisammrg/myrg_close.c b/storage/myisammrg/myrg_close.c
index 971a83928b1..baae24634b3 100644
--- a/storage/myisammrg/myrg_close.c
+++ b/storage/myisammrg/myrg_close.c
@@ -30,7 +30,7 @@ int myrg_close(MYRG_INFO *info)
pthread_mutex_lock(&THR_LOCK_open);
myrg_open_list=list_delete(myrg_open_list,&info->open_list);
pthread_mutex_unlock(&THR_LOCK_open);
- my_free((gptr) info,MYF(0));
+ my_free((uchar*) info,MYF(0));
if (error)
{
DBUG_RETURN(my_errno=error);
diff --git a/storage/myisammrg/myrg_def.h b/storage/myisammrg/myrg_def.h
index 344bd4edd3c..9c69da1424d 100644
--- a/storage/myisammrg/myrg_def.h
+++ b/storage/myisammrg/myrg_def.h
@@ -28,5 +28,8 @@ extern pthread_mutex_t THR_LOCK_open;
#endif
int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag);
-int _myrg_mi_read_record(MI_INFO *info, byte *buf);
-
+int _myrg_mi_read_record(MI_INFO *info, uchar *buf);
+#ifdef __cplusplus
+extern "C"
+#endif
+void myrg_print_wrong_table(const char *table_name);
diff --git a/storage/myisammrg/myrg_delete.c b/storage/myisammrg/myrg_delete.c
index f9604f66885..93d45198b36 100644
--- a/storage/myisammrg/myrg_delete.c
+++ b/storage/myisammrg/myrg_delete.c
@@ -17,7 +17,7 @@
#include "myrg_def.h"
-int myrg_delete(MYRG_INFO *info, const byte *record)
+int myrg_delete(MYRG_INFO *info, const uchar *record)
{
if (!info->current_table)
return (my_errno= HA_ERR_NO_ACTIVE_RECORD);
diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c
index 3dbb605463e..500d3a29327 100644
--- a/storage/myisammrg/myrg_open.c
+++ b/storage/myisammrg/myrg_open.c
@@ -40,6 +40,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
IO_CACHE file;
MI_INFO *isam=0;
uint found_merge_insert_method= 0;
+ size_t name_buff_length;
DBUG_ENTER("myrg_open");
LINT_INIT(key_parts);
@@ -48,13 +49,13 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,
MY_UNPACK_FILENAME|MY_APPEND_EXT),
O_RDONLY | O_SHARE,MYF(0))) < 0)
- goto err;
- errpos=1;
- if (init_io_cache(&file, fd, 4*IO_SIZE, READ_CACHE, 0, 0,
+ goto err;
+ errpos=1;
+ if (init_io_cache(&file, fd, 4*IO_SIZE, READ_CACHE, 0, 0,
MYF(MY_WME | MY_NABP)))
- goto err;
- errpos=2;
- dir_length=dirname_part(name_buff,name);
+ goto err;
+ errpos=2;
+ dir_length=dirname_part(name_buff, name, &name_buff_length);
while ((length=my_b_gets(&file,buff,FN_REFLEN-1)))
{
if ((end=buff+length)[-1] == '\n')
@@ -91,6 +92,11 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0))))
{
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
+ if (handle_locking & HA_OPEN_FOR_REPAIR)
+ {
+ myrg_print_wrong_table(buff);
+ continue;
+ }
goto err;
}
if (!m_info) /* First file */
@@ -119,6 +125,11 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
if (m_info->reclength != isam->s->base.reclength)
{
my_errno=HA_ERR_WRONG_MRG_TABLE_DEF;
+ if (handle_locking & HA_OPEN_FOR_REPAIR)
+ {
+ myrg_print_wrong_table(buff);
+ continue;
+ }
goto err;
}
m_info->options|= isam->s->options;
@@ -132,6 +143,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
m_info->tables);
}
+ if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF)
+ goto err;
if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO),
MYF(MY_WME | MY_ZEROFILL))))
goto err;
diff --git a/storage/myisammrg/myrg_queue.c b/storage/myisammrg/myrg_queue.c
index 1d252207db1..d2579053784 100644
--- a/storage/myisammrg/myrg_queue.c
+++ b/storage/myisammrg/myrg_queue.c
@@ -15,7 +15,7 @@
#include "myrg_def.h"
-static int queue_key_cmp(void *keyseg, byte *a, byte *b)
+static int queue_key_cmp(void *keyseg, uchar *a, uchar *b)
{
MYRG_TABLE *ma= (MYRG_TABLE *)a;
MYRG_TABLE *mb= (MYRG_TABLE *)b;
@@ -69,7 +69,7 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag)
return error;
}
-int _myrg_mi_read_record(MI_INFO *info, byte *buf)
+int _myrg_mi_read_record(MI_INFO *info, uchar *buf)
{
if (!(*info->read_record)(info,info->lastpos,buf))
{
diff --git a/storage/myisammrg/myrg_rfirst.c b/storage/myisammrg/myrg_rfirst.c
index 80736537d02..9d7b0f9e83f 100644
--- a/storage/myisammrg/myrg_rfirst.c
+++ b/storage/myisammrg/myrg_rfirst.c
@@ -17,7 +17,7 @@
/* Read first row according to specific key */
-int myrg_rfirst(MYRG_INFO *info, byte *buf, int inx)
+int myrg_rfirst(MYRG_INFO *info, uchar *buf, int inx)
{
MYRG_TABLE *table;
MI_INFO *mi;
@@ -35,7 +35,7 @@ int myrg_rfirst(MYRG_INFO *info, byte *buf, int inx)
return err;
}
/* adding to queue */
- queue_insert(&(info->by_key),(byte *)table);
+ queue_insert(&(info->by_key),(uchar *)table);
}
/* We have done a read in all tables */
info->last_used_table=table;
diff --git a/storage/myisammrg/myrg_rkey.c b/storage/myisammrg/myrg_rkey.c
index 2d744ae31ec..8e7886f5a43 100644
--- a/storage/myisammrg/myrg_rkey.c
+++ b/storage/myisammrg/myrg_rkey.c
@@ -35,10 +35,10 @@
SerG
*/
-int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
+int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function search_flag)
{
- byte *key_buff;
+ uchar *key_buff;
uint pack_key_length;
uint16 last_used_keyseg;
MYRG_TABLE *table;
@@ -60,7 +60,7 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
{
err=mi_rkey(mi, 0, inx, key, keypart_map, search_flag);
/* Get the saved packed key and packed key length. */
- key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length;
+ key_buff=(uchar*) mi->lastkey+mi->s->base.max_key_length;
pack_key_length=mi->pack_key_length;
last_used_keyseg= mi->last_used_keyseg;
}
@@ -80,7 +80,7 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
DBUG_RETURN(err);
}
/* adding to queue */
- queue_insert(&(info->by_key),(byte *)table);
+ queue_insert(&(info->by_key),(uchar *)table);
}
@@ -92,6 +92,6 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
mi->once_flags|= RRND_PRESERVE_LASTINX;
DBUG_PRINT("info", ("using table no: %d",
(int) (info->current_table - info->open_tables + 1)));
- DBUG_DUMP("result key", (byte*) mi->lastkey, mi->lastkey_length);
+ DBUG_DUMP("result key", (uchar*) mi->lastkey, mi->lastkey_length);
DBUG_RETURN(_myrg_mi_read_record(mi,buf));
}
diff --git a/storage/myisammrg/myrg_rlast.c b/storage/myisammrg/myrg_rlast.c
index f364bf9b32f..8086a2f8104 100644
--- a/storage/myisammrg/myrg_rlast.c
+++ b/storage/myisammrg/myrg_rlast.c
@@ -17,7 +17,7 @@
/* Read last row with the same key as the previous read. */
-int myrg_rlast(MYRG_INFO *info, byte *buf, int inx)
+int myrg_rlast(MYRG_INFO *info, uchar *buf, int inx)
{
MYRG_TABLE *table;
MI_INFO *mi;
@@ -35,7 +35,7 @@ int myrg_rlast(MYRG_INFO *info, byte *buf, int inx)
return err;
}
/* adding to queue */
- queue_insert(&(info->by_key),(byte *)table);
+ queue_insert(&(info->by_key),(uchar *)table);
}
/* We have done a read in all tables */
info->last_used_table=table;
diff --git a/storage/myisammrg/myrg_rnext.c b/storage/myisammrg/myrg_rnext.c
index de1aa4df4b6..82d5cbf38b1 100644
--- a/storage/myisammrg/myrg_rnext.c
+++ b/storage/myisammrg/myrg_rnext.c
@@ -19,7 +19,7 @@
Read next row with the same key as previous read
*/
-int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
+int myrg_rnext(MYRG_INFO *info, uchar *buf, int inx)
{
int err;
MI_INFO *mi;
@@ -42,7 +42,7 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
else
{
/* Found here, adding to queue */
- queue_top(&(info->by_key))=(byte *)(info->current_table);
+ queue_top(&(info->by_key))=(uchar *)(info->current_table);
queue_replaced(&(info->by_key));
}
diff --git a/storage/myisammrg/myrg_rnext_same.c b/storage/myisammrg/myrg_rnext_same.c
index 9c6b522ee8a..ad7bbfb0f6e 100644
--- a/storage/myisammrg/myrg_rnext_same.c
+++ b/storage/myisammrg/myrg_rnext_same.c
@@ -16,7 +16,7 @@
#include "myrg_def.h"
-int myrg_rnext_same(MYRG_INFO *info, byte *buf)
+int myrg_rnext_same(MYRG_INFO *info, uchar *buf)
{
int err;
MI_INFO *mi;
@@ -39,7 +39,7 @@ int myrg_rnext_same(MYRG_INFO *info, byte *buf)
else
{
/* Found here, adding to queue */
- queue_top(&(info->by_key))=(byte *)(info->current_table);
+ queue_top(&(info->by_key))=(uchar *)(info->current_table);
queue_replaced(&(info->by_key));
}
diff --git a/storage/myisammrg/myrg_rprev.c b/storage/myisammrg/myrg_rprev.c
index b1b86a93fad..66c94974940 100644
--- a/storage/myisammrg/myrg_rprev.c
+++ b/storage/myisammrg/myrg_rprev.c
@@ -19,7 +19,7 @@
Read previous row with the same key as previous read
*/
-int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
+int myrg_rprev(MYRG_INFO *info, uchar *buf, int inx)
{
int err;
MI_INFO *mi;
@@ -42,7 +42,7 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
else
{
/* Found here, adding to queue */
- queue_top(&(info->by_key))=(byte *)(info->current_table);
+ queue_top(&(info->by_key))=(uchar *)(info->current_table);
queue_replaced(&(info->by_key));
}
diff --git a/storage/myisammrg/myrg_rrnd.c b/storage/myisammrg/myrg_rrnd.c
index 55e72b2170d..b598563680c 100644
--- a/storage/myisammrg/myrg_rrnd.c
+++ b/storage/myisammrg/myrg_rrnd.c
@@ -30,7 +30,7 @@ static MYRG_TABLE *find_table(MYRG_TABLE *start,MYRG_TABLE *end,ulonglong pos);
HA_ERR_END_OF_FILE = EOF.
*/
-int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
+int myrg_rrnd(MYRG_INFO *info,uchar *buf,ulonglong filepos)
{
int error;
MI_INFO *isam_info;
@@ -47,7 +47,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
}
isam_info=(info->current_table=info->open_tables)->table;
if (info->cache_in_use)
- mi_extra(isam_info,HA_EXTRA_CACHE,(byte*) &info->cache_size);
+ mi_extra(isam_info,HA_EXTRA_CACHE,(uchar*) &info->cache_size);
filepos=isam_info->s->pack.header_length;
isam_info->lastinx= (uint) -1; /* Can't forward or backward */
}
@@ -60,20 +60,20 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
for (;;)
{
isam_info->update&= HA_STATE_CHANGED;
- if ((error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf,
+ if ((error=(*isam_info->s->read_rnd)(isam_info,(uchar*) buf,
(my_off_t) filepos,1)) !=
HA_ERR_END_OF_FILE)
DBUG_RETURN(error);
if (info->cache_in_use)
mi_extra(info->current_table->table, HA_EXTRA_NO_CACHE,
- (byte*) &info->cache_size);
+ (uchar*) &info->cache_size);
if (info->current_table+1 == info->end_table)
DBUG_RETURN(HA_ERR_END_OF_FILE);
info->current_table++;
info->last_used_table=info->current_table;
if (info->cache_in_use)
mi_extra(info->current_table->table, HA_EXTRA_CACHE,
- (byte*) &info->cache_size);
+ (uchar*) &info->cache_size);
info->current_table->file_offset=
info->current_table[-1].file_offset+
info->current_table[-1].table->state->data_file_length;
@@ -88,7 +88,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
isam_info=info->current_table->table;
isam_info->update&= HA_STATE_CHANGED;
DBUG_RETURN((*isam_info->s->read_rnd)
- (isam_info, (byte*) buf,
+ (isam_info, (uchar*) buf,
(my_off_t) (filepos - info->current_table->file_offset),
0));
}
diff --git a/storage/myisammrg/myrg_rsame.c b/storage/myisammrg/myrg_rsame.c
index 56b16c0aa3c..2f7523759dc 100644
--- a/storage/myisammrg/myrg_rsame.c
+++ b/storage/myisammrg/myrg_rsame.c
@@ -15,7 +15,7 @@
#include "myrg_def.h"
-int myrg_rsame(MYRG_INFO *info,byte *record,int inx)
+int myrg_rsame(MYRG_INFO *info,uchar *record,int inx)
{
if (inx) /* not yet used, should be 0 */
return (my_errno=HA_ERR_WRONG_INDEX);
diff --git a/storage/myisammrg/myrg_update.c b/storage/myisammrg/myrg_update.c
index ba667d69f12..5d883be8484 100644
--- a/storage/myisammrg/myrg_update.c
+++ b/storage/myisammrg/myrg_update.c
@@ -17,7 +17,7 @@
#include "myrg_def.h"
-int myrg_update(register MYRG_INFO *info,const byte *oldrec, byte *newrec)
+int myrg_update(register MYRG_INFO *info,const uchar *oldrec, uchar *newrec)
{
if (!info->current_table)
return (my_errno=HA_ERR_NO_ACTIVE_RECORD);
diff --git a/storage/myisammrg/myrg_write.c b/storage/myisammrg/myrg_write.c
index ed0a4a7996a..27534df2821 100644
--- a/storage/myisammrg/myrg_write.c
+++ b/storage/myisammrg/myrg_write.c
@@ -17,7 +17,7 @@
#include "myrg_def.h"
-int myrg_write(register MYRG_INFO *info, byte *rec)
+int myrg_write(register MYRG_INFO *info, uchar *rec)
{
/* [phi] MERGE_WRITE_DISABLED is handled by the else case */
if (info->merge_insert_method == MERGE_INSERT_TO_FIRST)
diff --git a/storage/ndb/MAINTAINERS b/storage/ndb/MAINTAINERS
new file mode 100644
index 00000000000..d1547d48234
--- /dev/null
+++ b/storage/ndb/MAINTAINERS
@@ -0,0 +1,163 @@
+MySQL Cluster MAINTAINERS
+-------------------------
+
+This is a list of knowledgable people in parts of the NDB code.
+
+In changing that area of code, you probably want to talk to the
+people who know a lot about it to look over the patch.
+
+When sending patches and queries, always CC the mailing list.
+
+If no list specified, assume internals@lists.mysql.com
+
+P: Person
+M: Mail
+L: Mailing list
+W: Web page with status/info
+C: Comment
+SRC: Source directory (relative to this directory)
+T: SCM tree type and location
+S: Status, one of:
+
+ Supported: Somebody is paid to maintain this.
+ Maintained: Not their primary job, but maintained.
+ Orphan: No current obvious maintainer.
+ Obsolete: Replaced by something else.
+
+-------------------------------------------------------------
+
+Binlog Injector
+SRC: ha_ndbcluster_binlog.cc
+C: see also row based replication
+P: Stewart Smith
+M: stewart@mysql.com
+C: Original author
+P: Tomas Ulin
+M: tomas@mysql.com
+C: Lots of updates
+P: Martin Skold
+M: martin@mysql.com
+C: Metadata ops
+S: Supported
+
+BLOBs
+SRC: ha_ndbcluster.cc
+SRC: src/ndbapi/NdbBlob*
+P: Pekka
+M: pekka@mysql.com
+S: Supported
+
+cpcd/cpcc
+SRC: src/cw/cpcd
+SRC: src/cw/cpcc
+C: Maintained only as part of autotest
+P: Jonas Orland
+M: jonas@mysql.com
+S: Maintained
+
+cpcc-win32
+SRC: src/cw/cpcc-win32
+S: Obsolete
+
+Handler
+SRC: ha_ndbcluster.cc
+P: Martin Skold
+M: martin@mysql.com
+S: Supported
+
+Management Server
+SRC: src/mgmsrv/
+P: Stewart Smith
+M: stewart@mysql.com
+S: Supported
+
+Management Client
+SRC: src/mgmclient/
+P: Stewart Smith
+M: stewart@mysql.com
+S: Supported
+
+Management API
+SRC: src/mgmapi/
+P: Stewart Smith
+M: stewart@mysql.com
+S: Supported
+
+NDB API Examples
+SRC: ndbapi-examples/
+P: Tomas Ulin
+M: tomas@mysql.com
+C: Originally by Lars
+P: Lars Thalmann
+M: lars@mysql.com
+S: Maintained
+
+NDB API NdbRecord Examples
+SRC: ndbapi-examples/
+P: Kristian Nielsen
+M: knielsen@mysql.com
+S: Maintained
+
+tsman
+C: Disk Data (Table Space MANager)
+SRC: src/kernel/blocks/tsman.cpp
+SRC: src/kernel/blocks/tsman.hpp
+P: Jonas Oreland
+M: jonas@mysql.com
+S: Supported
+
+lgman
+C: Disk Data (LoG MANager)
+SRC: src/kernel/blocks/lgman.cpp
+SRC: src/kernel/blocks/lgman.hpp
+P: Jonas Oreland
+M: jonas@mysql.com
+S: Supported
+
+pgman
+C: Disk Data (PaGe MANager)
+SRC: src/kernel/blocks/lgman.cpp
+SRC: src/kernel/blocks/lgman.hpp
+P: Jonas Oreland
+M: jonas@mysql.com
+S: Supported
+
+SUMA
+C: SUbscription MAnager
+C: Used for replication
+SRC: src/kernel/blocks/suma/
+P: Tomas Ulin
+P: tomas@mysql.com
+P: Jonas Oreland
+P: jonas@mysql.com
+S: Supported
+
+TRIX
+C: TRiggers and IndeXs (but only online Index build)
+SRC: src/kernel/blocks/trix
+P: Martin Skold
+P: mskold@mysql.com
+S: Supported
+
+QMGR
+C: Cluster (with a Q) ManaGeR
+C: Heartbeats etc
+SRC: src/kernel/blocks/qmgr
+S: Supported
+
+NDBFS
+C: NDB FileSystem
+C: File System abstraction
+SRC: src/kernel/blocks/ndbfs
+S: Supported
+
+TRIX
+C: TRiggers and IndeXs (but only online Index build)
+SRC: src/kernel/blocks/trix
+S: Supported
+
+TRIX
+C: TRiggers and IndeXs (but only online Index build)
+SRC: src/kernel/blocks/trix
+S: Supported
+
diff --git a/storage/ndb/include/Makefile.am b/storage/ndb/include/Makefile.am
index bf8fe392072..9e6ad016d75 100644
--- a/storage/ndb/include/Makefile.am
+++ b/storage/ndb/include/Makefile.am
@@ -45,6 +45,7 @@ ndbapi/ndberror.h
mgmapiinclude_HEADERS = \
mgmapi/mgmapi.h \
+mgmapi/mgmapi_error.h \
mgmapi/mgmapi_debug.h \
mgmapi/mgmapi_config_parameters.h \
mgmapi/mgmapi_config_parameters_debug.h \
diff --git a/storage/ndb/include/debugger/EventLogger.hpp b/storage/ndb/include/debugger/EventLogger.hpp
index 7e47dbf59db..8ae96162a48 100644
--- a/storage/ndb/include/debugger/EventLogger.hpp
+++ b/storage/ndb/include/debugger/EventLogger.hpp
@@ -173,5 +173,5 @@ private:
STATIC_CONST(MAX_TEXT_LENGTH = 256);
};
-
+extern void getRestartAction(Uint32 action, BaseString &str);
#endif
diff --git a/storage/ndb/include/mgmapi/mgmapi.h b/storage/ndb/include/mgmapi/mgmapi.h
index ffed44c7da1..0853f5a4422 100644
--- a/storage/ndb/include/mgmapi/mgmapi.h
+++ b/storage/ndb/include/mgmapi/mgmapi.h
@@ -18,6 +18,7 @@
#include "mgmapi_config_parameters.h"
#include "ndb_logevent.h"
+#include "mgmapi_error.h"
#define MGM_LOGLEVELS CFG_MAX_LOGLEVEL - CFG_MIN_LOGLEVEL + 1
#define NDB_MGM_MAX_LOGLEVEL 15
@@ -212,105 +213,6 @@ extern "C" {
};
/**
- * Error codes
- */
- enum ndb_mgm_error {
- /** Not an error */
- NDB_MGM_NO_ERROR = 0,
-
- /* Request for service errors */
- /** Supplied connectstring is illegal */
- NDB_MGM_ILLEGAL_CONNECT_STRING = 1001,
- /** Supplied NdbMgmHandle is illegal */
- NDB_MGM_ILLEGAL_SERVER_HANDLE = 1005,
- /** Illegal reply from server */
- NDB_MGM_ILLEGAL_SERVER_REPLY = 1006,
- /** Illegal number of nodes */
- NDB_MGM_ILLEGAL_NUMBER_OF_NODES = 1007,
- /** Illegal node status */
- NDB_MGM_ILLEGAL_NODE_STATUS = 1008,
- /** Memory allocation error */
- NDB_MGM_OUT_OF_MEMORY = 1009,
- /** Management server not connected */
- NDB_MGM_SERVER_NOT_CONNECTED = 1010,
- /** Could not connect to socker */
- NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET = 1011,
- /** Could not bind local address */
- NDB_MGM_BIND_ADDRESS = 1012,
-
- /* Alloc node id failures */
- /** Generic error, retry may succeed */
- NDB_MGM_ALLOCID_ERROR = 1101,
- /** Non retriable error */
- NDB_MGM_ALLOCID_CONFIG_MISMATCH = 1102,
-
- /* Service errors - Start/Stop Node or System */
- /** Start failed */
- NDB_MGM_START_FAILED = 2001,
- /** Stop failed */
- NDB_MGM_STOP_FAILED = 2002,
- /** Restart failed */
- NDB_MGM_RESTART_FAILED = 2003,
-
- /* Service errors - Backup */
- /** Unable to start backup */
- NDB_MGM_COULD_NOT_START_BACKUP = 3001,
- /** Unable to abort backup */
- NDB_MGM_COULD_NOT_ABORT_BACKUP = 3002,
-
- /* Service errors - Single User Mode */
- /** Unable to enter single user mode */
- NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE = 4001,
- /** Unable to exit single user mode */
- NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002,
-
- /* Usage errors */
- /** Usage error */
- NDB_MGM_USAGE_ERROR = 5001
- };
-
-#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
- struct Ndb_Mgm_Error_Msg {
- enum ndb_mgm_error code;
- const char * msg;
- };
- const struct Ndb_Mgm_Error_Msg ndb_mgm_error_msgs[] = {
- { NDB_MGM_NO_ERROR, "No error" },
-
- /* Request for service errors */
- { NDB_MGM_ILLEGAL_CONNECT_STRING, "Illegal connect string" },
- { NDB_MGM_ILLEGAL_SERVER_HANDLE, "Illegal server handle" },
- { NDB_MGM_ILLEGAL_SERVER_REPLY, "Illegal reply from server" },
- { NDB_MGM_ILLEGAL_NUMBER_OF_NODES, "Illegal number of nodes" },
- { NDB_MGM_ILLEGAL_NODE_STATUS, "Illegal node status" },
- { NDB_MGM_OUT_OF_MEMORY, "Out of memory" },
- { NDB_MGM_SERVER_NOT_CONNECTED, "Management server not connected" },
- { NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, "Could not connect to socket" },
-
- /* Service errors - Start/Stop Node or System */
- { NDB_MGM_START_FAILED, "Start failed" },
- { NDB_MGM_STOP_FAILED, "Stop failed" },
- { NDB_MGM_RESTART_FAILED, "Restart failed" },
-
- /* Service errors - Backup */
- { NDB_MGM_COULD_NOT_START_BACKUP, "Could not start backup" },
- { NDB_MGM_COULD_NOT_ABORT_BACKUP, "Could not abort backup" },
-
- /* Service errors - Single User Mode */
- { NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE,
- "Could not enter single user mode" },
- { NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE,
- "Could not exit single user mode" },
-
- /* Usage errors */
- { NDB_MGM_USAGE_ERROR,
- "Usage error" }
- };
- const int ndb_mgm_noOfErrorMsgs =
- sizeof(ndb_mgm_error_msgs)/sizeof(struct Ndb_Mgm_Error_Msg);
-#endif
-
- /**
* Status of a node in the cluster.
*
* Sub-structure in enum ndb_mgm_cluster_state
diff --git a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h
index 119958d0ce0..ac2cbf060fd 100644
--- a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h
+++ b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h
@@ -64,6 +64,7 @@
#define CFG_DB_FILESYSTEM_PATH 125
#define CFG_DB_NO_REDOLOG_FILES 126
+#define CFG_DB_REDOLOG_FILE_SIZE 140
#define CFG_DB_LCP_DISC_PAGES_TUP 127
#define CFG_DB_LCP_DISC_PAGES_TUP_SR 128
@@ -81,6 +82,8 @@
#define CFG_DB_BACKUP_WRITE_SIZE 136
#define CFG_DB_BACKUP_MAX_WRITE_SIZE 139
+#define CFG_DB_WATCHDOG_INTERVAL_INITIAL 141
+
#define CFG_LOG_DESTINATION 147
#define CFG_DB_DISCLESS 148
@@ -113,6 +116,10 @@
#define CFG_DB_MEMREPORT_FREQUENCY 166
+#define CFG_DB_O_DIRECT 168
+
+#define CFG_DB_MAX_ALLOCATE 169
+
#define CFG_DB_SGA 198 /* super pool mem */
#define CFG_DB_DATA_MEM_2 199 /* used in special build in 5.1 */
diff --git a/storage/ndb/include/mgmapi/mgmapi_error.h b/storage/ndb/include/mgmapi/mgmapi_error.h
new file mode 100644
index 00000000000..2d0aa1ded0f
--- /dev/null
+++ b/storage/ndb/include/mgmapi/mgmapi_error.h
@@ -0,0 +1,121 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef MGMAPI_ERROR_H
+#define MGMAPI_ERROR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /**
+ * Error codes
+ */
+ enum ndb_mgm_error {
+ /** Not an error */
+ NDB_MGM_NO_ERROR = 0,
+
+ /* Request for service errors */
+ /** Supplied connectstring is illegal */
+ NDB_MGM_ILLEGAL_CONNECT_STRING = 1001,
+ /** Supplied NdbMgmHandle is illegal */
+ NDB_MGM_ILLEGAL_SERVER_HANDLE = 1005,
+ /** Illegal reply from server */
+ NDB_MGM_ILLEGAL_SERVER_REPLY = 1006,
+ /** Illegal number of nodes */
+ NDB_MGM_ILLEGAL_NUMBER_OF_NODES = 1007,
+ /** Illegal node status */
+ NDB_MGM_ILLEGAL_NODE_STATUS = 1008,
+ /** Memory allocation error */
+ NDB_MGM_OUT_OF_MEMORY = 1009,
+ /** Management server not connected */
+ NDB_MGM_SERVER_NOT_CONNECTED = 1010,
+ /** Could not connect to socker */
+ NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET = 1011,
+ /** Could not bind local address */
+ NDB_MGM_BIND_ADDRESS = 1012,
+
+ /* Alloc node id failures */
+ /** Generic error, retry may succeed */
+ NDB_MGM_ALLOCID_ERROR = 1101,
+ /** Non retriable error */
+ NDB_MGM_ALLOCID_CONFIG_MISMATCH = 1102,
+
+ /* Service errors - Start/Stop Node or System */
+ /** Start failed */
+ NDB_MGM_START_FAILED = 2001,
+ /** Stop failed */
+ NDB_MGM_STOP_FAILED = 2002,
+ /** Restart failed */
+ NDB_MGM_RESTART_FAILED = 2003,
+
+ /* Service errors - Backup */
+ /** Unable to start backup */
+ NDB_MGM_COULD_NOT_START_BACKUP = 3001,
+ /** Unable to abort backup */
+ NDB_MGM_COULD_NOT_ABORT_BACKUP = 3002,
+
+ /* Service errors - Single User Mode */
+ /** Unable to enter single user mode */
+ NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE = 4001,
+ /** Unable to exit single user mode */
+ NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002,
+
+ /* Usage errors */
+ /** Usage error */
+ NDB_MGM_USAGE_ERROR = 5001
+ };
+ struct Ndb_Mgm_Error_Msg {
+ enum ndb_mgm_error code;
+ const char * msg;
+ };
+ const struct Ndb_Mgm_Error_Msg ndb_mgm_error_msgs[] = {
+ { NDB_MGM_NO_ERROR, "No error" },
+
+ /* Request for service errors */
+ { NDB_MGM_ILLEGAL_CONNECT_STRING, "Illegal connect string" },
+ { NDB_MGM_ILLEGAL_SERVER_HANDLE, "Illegal server handle" },
+ { NDB_MGM_ILLEGAL_SERVER_REPLY, "Illegal reply from server" },
+ { NDB_MGM_ILLEGAL_NUMBER_OF_NODES, "Illegal number of nodes" },
+ { NDB_MGM_ILLEGAL_NODE_STATUS, "Illegal node status" },
+ { NDB_MGM_OUT_OF_MEMORY, "Out of memory" },
+ { NDB_MGM_SERVER_NOT_CONNECTED, "Management server not connected" },
+ { NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, "Could not connect to socket" },
+
+ /* Service errors - Start/Stop Node or System */
+ { NDB_MGM_START_FAILED, "Start failed" },
+ { NDB_MGM_STOP_FAILED, "Stop failed" },
+ { NDB_MGM_RESTART_FAILED, "Restart failed" },
+
+ /* Service errors - Backup */
+ { NDB_MGM_COULD_NOT_START_BACKUP, "Could not start backup" },
+ { NDB_MGM_COULD_NOT_ABORT_BACKUP, "Could not abort backup" },
+
+ /* Service errors - Single User Mode */
+ { NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE,
+ "Could not enter single user mode" },
+ { NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE,
+ "Could not exit single user mode" },
+
+ /* Usage errors */
+ { NDB_MGM_USAGE_ERROR,
+ "Usage error" }
+ };
+ const int ndb_mgm_noOfErrorMsgs =
+ sizeof(ndb_mgm_error_msgs)/sizeof(struct Ndb_Mgm_Error_Msg);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/storage/ndb/include/ndb_global.h.in b/storage/ndb/include/ndb_global.h.in
index dd4303f949c..2fc594b3f5a 100644
--- a/storage/ndb/include/ndb_global.h.in
+++ b/storage/ndb/include/ndb_global.h.in
@@ -144,4 +144,6 @@ extern "C" {
#define MAX(x,y) (((x)>(y))?(x):(y))
#endif
+#define NDB_O_DIRECT_WRITE_ALIGNMENT 512
+
#endif
diff --git a/storage/ndb/include/ndbapi/Ndb.hpp b/storage/ndb/include/ndbapi/Ndb.hpp
index 5f96408ea30..a6a3df92ddb 100644
--- a/storage/ndb/include/ndbapi/Ndb.hpp
+++ b/storage/ndb/include/ndbapi/Ndb.hpp
@@ -1055,6 +1055,7 @@ class Ndb
friend class NdbDictInterface;
friend class NdbBlob;
friend class NdbImpl;
+ friend class Ndb_internal;
#endif
public:
@@ -1488,12 +1489,15 @@ public:
int initAutoIncrement();
int getAutoIncrementValue(const char* aTableName,
- Uint64 & tupleId, Uint32 cacheSize);
+ Uint64 & tupleId, Uint32 cacheSize,
+ Uint64 step = 1, Uint64 start = 1);
int getAutoIncrementValue(const NdbDictionary::Table * aTable,
- Uint64 & tupleId, Uint32 cacheSize);
+ Uint64 & tupleId, Uint32 cacheSize,
+ Uint64 step = 1, Uint64 start = 1);
int getAutoIncrementValue(const NdbDictionary::Table * aTable,
TupleIdRange & range, Uint64 & tupleId,
- Uint32 cacheSize);
+ Uint32 cacheSize,
+ Uint64 step = 1, Uint64 start = 1);
int readAutoIncrementValue(const char* aTableName,
Uint64 & tupleId);
int readAutoIncrementValue(const NdbDictionary::Table * aTable,
@@ -1510,7 +1514,7 @@ public:
private:
int getTupleIdFromNdb(const NdbTableImpl* table,
TupleIdRange & range, Uint64 & tupleId,
- Uint32 cacheSize);
+ Uint32 cacheSize, Uint64 step = 1, Uint64 start = 1);
int readTupleIdFromNdb(const NdbTableImpl* table,
TupleIdRange & range, Uint64 & tupleId);
int setTupleIdInNdb(const NdbTableImpl* table,
diff --git a/storage/ndb/include/ndbapi/NdbOperation.hpp b/storage/ndb/include/ndbapi/NdbOperation.hpp
index 0fa2cac0a32..06111941df4 100644
--- a/storage/ndb/include/ndbapi/NdbOperation.hpp
+++ b/storage/ndb/include/ndbapi/NdbOperation.hpp
@@ -1042,6 +1042,13 @@ protected:
*/
Int8 m_abortOption;
+ /*
+ * For blob impl, option to not propagate error to trans level.
+ * Could be AO_IgnoreError variant if we want it public.
+ * Ignored unless AO_IgnoreError is also set.
+ */
+ Int8 m_noErrorPropagation;
+
friend struct Ndb_free_list_t<NdbOperation>;
};
diff --git a/storage/ndb/include/portlib/NdbTick.h b/storage/ndb/include/portlib/NdbTick.h
index 59f580de38e..70c36fdfd1e 100644
--- a/storage/ndb/include/portlib/NdbTick.h
+++ b/storage/ndb/include/portlib/NdbTick.h
@@ -37,9 +37,6 @@ NDB_TICKS NdbTick_CurrentMillisecond(void);
*/
int NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros);
- /*#define TIME_MEASUREMENT*/
-#ifdef TIME_MEASUREMENT
-
struct MicroSecondTimer {
NDB_TICKS seconds;
NDB_TICKS micro_seconds;
@@ -54,7 +51,6 @@ struct MicroSecondTimer {
NDB_TICKS NdbTick_getMicrosPassed(struct MicroSecondTimer start,
struct MicroSecondTimer stop);
int NdbTick_getMicroTimer(struct MicroSecondTimer* time_now);
-#endif
#ifdef __cplusplus
}
diff --git a/storage/ndb/include/util/ndb_opts.h b/storage/ndb/include/util/ndb_opts.h
index 9cb65d4bc2e..f18bb9646cc 100644
--- a/storage/ndb/include/util/ndb_opts.h
+++ b/storage/ndb/include/util/ndb_opts.h
@@ -58,40 +58,40 @@ const char *opt_debug= 0;
"Set connect string for connecting to ndb_mgmd. " \
"Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \
"Overrides specifying entries in NDB_CONNECTSTRING and my.cnf", \
- (gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \
+ (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "ndb-mgmd-host", OPT_NDB_MGMD, \
"Set host and port for connecting to ndb_mgmd. " \
"Syntax: <hostname>[:<port>].", \
- (gptr*) &opt_ndb_mgmd, (gptr*) &opt_ndb_mgmd, 0, \
+ (uchar**) &opt_ndb_mgmd, (uchar**) &opt_ndb_mgmd, 0, \
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "ndb-nodeid", OPT_NDB_NODEID, \
"Set node id for this node.", \
- (gptr*) &opt_ndb_nodeid, (gptr*) &opt_ndb_nodeid, 0, \
+ (uchar**) &opt_ndb_nodeid, (uchar**) &opt_ndb_nodeid, 0, \
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "ndb-shm", OPT_NDB_SHM,\
"Allow optimizing using shared memory connections when available",\
- (gptr*) &opt_ndb_shm, (gptr*) &opt_ndb_shm, 0,\
+ (uchar**) &opt_ndb_shm, (uchar**) &opt_ndb_shm, 0,\
GET_BOOL, NO_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0 },\
{"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,\
"Select nodes for transactions in a more optimal way",\
- (gptr*) &opt_ndb_optimized_node_selection,\
- (gptr*) &opt_ndb_optimized_node_selection, 0,\
+ (uchar**) &opt_ndb_optimized_node_selection,\
+ (uchar**) &opt_ndb_optimized_node_selection, 0,\
GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\
{ "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\
- (gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \
+ (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "core-file", OPT_WANT_CORE, "Write core on errors.",\
- (gptr*) &opt_core, (gptr*) &opt_core, 0,\
+ (uchar**) &opt_core, (uchar**) &opt_core, 0,\
GET_BOOL, NO_ARG, OPT_WANT_CORE_DEFAULT, 0, 0, 0, 0, 0},\
{"character-sets-dir", OPT_CHARSETS_DIR,\
- "Directory where character sets are.", (gptr*) &charsets_dir,\
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\
+ "Directory where character sets are.", (uchar**) &charsets_dir,\
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\
#ifndef DBUG_OFF
#define NDB_STD_OPTS(prog_name) \
{ "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \
- (gptr*) &opt_debug, (gptr*) &opt_debug, \
+ (uchar**) &opt_debug, (uchar**) &opt_debug, \
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \
NDB_STD_OPTS_COMMON
#else
diff --git a/storage/ndb/ndbapi-examples/mgmapi_logevent/Makefile b/storage/ndb/ndbapi-examples/mgmapi_logevent/Makefile
index c9b4507c4a7..b67150b71fa 100644
--- a/storage/ndb/ndbapi-examples/mgmapi_logevent/Makefile
+++ b/storage/ndb/ndbapi-examples/mgmapi_logevent/Makefile
@@ -1,6 +1,6 @@
TARGET = mgmapi_logevent
-SRCS = $(TARGET).cpp
-OBJS = $(TARGET).o
+SRCS = main.cpp
+OBJS = main.o
CXX = g++
CFLAGS = -c -Wall -fno-rtti -fno-exceptions
CXXFLAGS =
@@ -17,7 +17,7 @@ SYS_LIB =
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(LFLAGS) $(LIB_DIR) $(OBJS) -lndbclient -lmysqlclient_r -lmysys -lmystrings -lz $(SYS_LIB) -o $(TARGET)
-$(TARGET).o: $(SRCS)
+$(OBJS): $(SRCS)
$(CXX) $(CFLAGS) -I$(TOP_SRCDIR)/include -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/mgmapi -I$(INCLUDE_DIR)/ndbapi $(SRCS)
clean:
diff --git a/storage/ndb/ndbapi-examples/mgmapi_logevent/mgmapi_logevent.cpp b/storage/ndb/ndbapi-examples/mgmapi_logevent/main.cpp
index fbe5397c5cf..fbe5397c5cf 100644
--- a/storage/ndb/ndbapi-examples/mgmapi_logevent/mgmapi_logevent.cpp
+++ b/storage/ndb/ndbapi-examples/mgmapi_logevent/main.cpp
diff --git a/storage/ndb/ndbapi-examples/mgmapi_logevent2/Makefile b/storage/ndb/ndbapi-examples/mgmapi_logevent2/Makefile
index 95b43b11f6b..fd9499c7a68 100644
--- a/storage/ndb/ndbapi-examples/mgmapi_logevent2/Makefile
+++ b/storage/ndb/ndbapi-examples/mgmapi_logevent2/Makefile
@@ -1,6 +1,6 @@
TARGET = mgmapi_logevent2
-SRCS = $(TARGET).cpp
-OBJS = $(TARGET).o
+SRCS = main.cpp
+OBJS = main.o
CXX = g++
CFLAGS = -c -Wall -fno-rtti -fno-exceptions
CXXFLAGS =
@@ -17,7 +17,7 @@ SYS_LIB =
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(LFLAGS) $(LIB_DIR) $(OBJS) -lndbclient -lmysqlclient_r -lmysys -lmystrings -lz $(SYS_LIB) -o $(TARGET)
-$(TARGET).o: $(SRCS)
+$(OBJS): $(SRCS)
$(CXX) $(CFLAGS) -I$(TOP_SRCDIR)/include -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/mgmapi -I$(INCLUDE_DIR)/ndbapi $(SRCS)
clean:
diff --git a/storage/ndb/ndbapi-examples/mgmapi_logevent2/mgmapi_logevent2.cpp b/storage/ndb/ndbapi-examples/mgmapi_logevent2/main.cpp
index 5a2241fc05f..5a2241fc05f 100644
--- a/storage/ndb/ndbapi-examples/mgmapi_logevent2/mgmapi_logevent2.cpp
+++ b/storage/ndb/ndbapi-examples/mgmapi_logevent2/main.cpp
diff --git a/storage/ndb/ndbapi-examples/ndbapi_simple_dual/Makefile b/storage/ndb/ndbapi-examples/ndbapi_simple_dual/Makefile
index 7f0ca52fcc3..9757df3ceab 100644
--- a/storage/ndb/ndbapi-examples/ndbapi_simple_dual/Makefile
+++ b/storage/ndb/ndbapi-examples/ndbapi_simple_dual/Makefile
@@ -1,6 +1,6 @@
TARGET = ndbapi_simple_dual
-SRCS = $(TARGET).cpp
-OBJS = $(TARGET).o
+SRCS = main.cpp
+OBJS = main.o
CXX = g++
CFLAGS = -c -Wall -fno-rtti -fno-exceptions
CXXFLAGS =
@@ -17,7 +17,7 @@ SYS_LIB =
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(LFLAGS) $(LIB_DIR) $(OBJS) -lndbclient -lmysqlclient_r -lmysys -lmystrings -lz $(SYS_LIB) -o $(TARGET)
-$(TARGET).o: $(SRCS)
+$(OBJS): $(SRCS)
$(CXX) $(CFLAGS) -I$(TOP_SRCDIR)/include -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/ndbapi $(SRCS)
clean:
diff --git a/storage/ndb/ndbapi-examples/ndbapi_simple_dual/ndbapi_simple_dual.cpp b/storage/ndb/ndbapi-examples/ndbapi_simple_dual/main.cpp
index 5943894a3ee..5943894a3ee 100644
--- a/storage/ndb/ndbapi-examples/ndbapi_simple_dual/ndbapi_simple_dual.cpp
+++ b/storage/ndb/ndbapi-examples/ndbapi_simple_dual/main.cpp
diff --git a/storage/ndb/ndbapi-examples/ndbapi_simple_index/Makefile b/storage/ndb/ndbapi-examples/ndbapi_simple_index/Makefile
index c38975381f5..975563b9508 100644
--- a/storage/ndb/ndbapi-examples/ndbapi_simple_index/Makefile
+++ b/storage/ndb/ndbapi-examples/ndbapi_simple_index/Makefile
@@ -1,6 +1,6 @@
TARGET = ndbapi_simple_index
-SRCS = $(TARGET).cpp
-OBJS = $(TARGET).o
+SRCS = main.cpp
+OBJS = main.o
CXX = g++
CFLAGS = -c -Wall -fno-rtti -fno-exceptions
CXXFLAGS =
@@ -17,7 +17,7 @@ SYS_LIB =
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(LFLAGS) $(LIB_DIR) $(OBJS) -lndbclient -lmysqlclient_r -lmysys -lmystrings -lz $(SYS_LIB) -o $(TARGET)
-$(TARGET).o: $(SRCS)
+$(OBJS): $(SRCS)
$(CXX) $(CFLAGS) -I$(INCLUDE_DIR)/include -I$(INCLUDE_DIR)/storage/ndb/include -I$(INCLUDE_DIR)/storage/ndb/include/ndbapi $(SRCS)
clean:
diff --git a/storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index.cpp b/storage/ndb/ndbapi-examples/ndbapi_simple_index/main.cpp
index 440face79ae..440face79ae 100644
--- a/storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index.cpp
+++ b/storage/ndb/ndbapi-examples/ndbapi_simple_index/main.cpp
diff --git a/storage/ndb/src/common/portlib/NdbTick.c b/storage/ndb/src/common/portlib/NdbTick.c
index 238e9b1956d..7e54984794f 100644
--- a/storage/ndb/src/common/portlib/NdbTick.c
+++ b/storage/ndb/src/common/portlib/NdbTick.c
@@ -15,7 +15,7 @@
#include <ndb_global.h>
-#include "NdbTick.h"
+#include <NdbTick.h>
#define NANOSEC_PER_SEC 1000000000
#define MICROSEC_PER_SEC 1000000
@@ -71,7 +71,6 @@ NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros){
}
#endif
-#ifdef TIME_MEASUREMENT
int
NdbTick_getMicroTimer(struct MicroSecondTimer* input_timer)
{
@@ -102,4 +101,3 @@ NdbTick_getMicrosPassed(struct MicroSecondTimer start,
}
return ret_value;
}
-#endif
diff --git a/storage/ndb/src/common/transporter/TransporterRegistry.cpp b/storage/ndb/src/common/transporter/TransporterRegistry.cpp
index 3e7589a54fe..5f5f3c17b2d 100644
--- a/storage/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/storage/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -818,6 +818,7 @@ TransporterRegistry::performReceive()
{
Uint32 * ptr;
Uint32 sz = t->getReceiveData(&ptr);
+ transporter_recv_from(callbackObj, nodeId);
Uint32 szUsed = unpack(ptr, sz, nodeId, ioStates[nodeId]);
t->updateReceiveDataPtr(szUsed);
}
diff --git a/storage/ndb/src/cw/cpcd/main.cpp b/storage/ndb/src/cw/cpcd/main.cpp
index f23a92b8010..d5c31d610cb 100644
--- a/storage/ndb/src/cw/cpcd/main.cpp
+++ b/storage/ndb/src/cw/cpcd/main.cpp
@@ -39,22 +39,22 @@ static const char *user = 0;
static struct my_option my_long_options[] =
{
{ "work-dir", 'w', "Work directory",
- (gptr*) &work_dir, (gptr*) &work_dir, 0,
+ (uchar**) &work_dir, (uchar**) &work_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "port", 'p', "TCP port to listen on",
- (gptr*) &port, (gptr*) &port, 0,
+ (uchar**) &port, (uchar**) &port, 0,
GET_INT, REQUIRED_ARG, CPCD_DEFAULT_TCP_PORT, 0, 0, 0, 0, 0 },
{ "syslog", 'S', "Log events to syslog",
- (gptr*) &use_syslog, (gptr*) &use_syslog, 0,
+ (uchar**) &use_syslog, (uchar**) &use_syslog, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "logfile", 'L', "File to log events to",
- (gptr*) &logfile, (gptr*) &logfile, 0,
+ (uchar**) &logfile, (uchar**) &logfile, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "debug", 'D', "Enable debug mode",
- (gptr*) &debug, (gptr*) &debug, 0,
+ (uchar**) &debug, (uchar**) &debug, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "user", 'u', "Run as user",
- (gptr*) &user, (gptr*) &user, 0,
+ (uchar**) &user, (uchar**) &user, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/src/kernel/blocks/ERROR_codes.txt b/storage/ndb/src/kernel/blocks/ERROR_codes.txt
index b3405679978..67eb89f850f 100644
--- a/storage/ndb/src/kernel/blocks/ERROR_codes.txt
+++ b/storage/ndb/src/kernel/blocks/ERROR_codes.txt
@@ -1,5 +1,5 @@
Next QMGR 1
-Next NDBCNTR 1001
+Next NDBCNTR 1002
Next NDBFS 2000
Next DBACC 3002
Next DBTUP 4029
@@ -523,3 +523,4 @@ Dbtup:
NDBCNTR:
1000: Crash insertion on SystemError::CopyFragRef
+1001: Delay sending NODE_FAILREP (to own node), until error is cleared
diff --git a/storage/ndb/src/kernel/blocks/backup/Backup.cpp b/storage/ndb/src/kernel/blocks/backup/Backup.cpp
index d86c22024cd..64e2c41aa69 100644
--- a/storage/ndb/src/kernel/blocks/backup/Backup.cpp
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.cpp
@@ -448,6 +448,41 @@ Backup::execDUMP_STATE_ORD(Signal* signal)
filePtr.p->m_flags);
}
}
+
+ ndbout_c("m_curr_disk_write_speed: %u m_words_written_this_period: %u m_overflow_disk_write: %u",
+ m_curr_disk_write_speed, m_words_written_this_period, m_overflow_disk_write);
+ ndbout_c("m_reset_delay_used: %u m_reset_disk_speed_time: %llu",
+ m_reset_delay_used, (Uint64)m_reset_disk_speed_time);
+ for(c_backups.first(ptr); ptr.i != RNIL; c_backups.next(ptr))
+ {
+ ndbout_c("BackupRecord %u: BackupId: %u MasterRef: %x ClientRef: %x",
+ ptr.i, ptr.p->backupId, ptr.p->masterRef, ptr.p->clientRef);
+ ndbout_c(" State: %u", ptr.p->slaveState.getState());
+ ndbout_c(" noOfByte: %llu noOfRecords: %llu",
+ ptr.p->noOfBytes, ptr.p->noOfRecords);
+ ndbout_c(" noOfLogBytes: %llu noOfLogRecords: %llu",
+ ptr.p->noOfLogBytes, ptr.p->noOfLogRecords);
+ ndbout_c(" errorCode: %u", ptr.p->errorCode);
+ BackupFilePtr filePtr;
+ for(ptr.p->files.first(filePtr); filePtr.i != RNIL;
+ ptr.p->files.next(filePtr))
+ {
+ ndbout_c(" file %u: type: %u flags: H'%x tableId: %u fragmentId: %u",
+ filePtr.i, filePtr.p->fileType, filePtr.p->m_flags,
+ filePtr.p->tableId, filePtr.p->fragmentNo);
+ }
+ if (ptr.p->slaveState.getState() == SCANNING && ptr.p->dataFilePtr != RNIL)
+ {
+ c_backupFilePool.getPtr(filePtr, ptr.p->dataFilePtr);
+ OperationRecord & op = filePtr.p->operation;
+ Uint32 *tmp = NULL;
+ Uint32 sz = 0;
+ bool eof = FALSE;
+ bool ready = op.dataBuffer.getReadPtr(&tmp, &sz, &eof);
+ ndbout_c("ready: %s eof: %s", ready ? "TRUE" : "FALSE", eof ? "TRUE" : "FALSE");
+ }
+ }
+ return;
}
if(signal->theData[0] == 24){
/**
@@ -2771,6 +2806,8 @@ Backup::openFiles(Signal* signal, BackupRecordPtr ptr)
c_backupFilePool.getPtr(filePtr, ptr.p->dataFilePtr);
filePtr.p->m_flags |= BackupFile::BF_OPENING;
+ if (c_defaults.m_o_direct)
+ req->fileFlags |= FsOpenReq::OM_DIRECT;
req->userPointer = filePtr.i;
FsOpenReq::setVersion(req->fileNumber, 2);
FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_DATA);
@@ -3745,12 +3782,31 @@ Backup::OperationRecord::newFragment(Uint32 tableId, Uint32 fragNo)
}
bool
-Backup::OperationRecord::fragComplete(Uint32 tableId, Uint32 fragNo)
+Backup::OperationRecord::fragComplete(Uint32 tableId, Uint32 fragNo, bool fill_record)
{
Uint32 * tmp;
const Uint32 footSz = sizeof(BackupFormat::DataFile::FragmentFooter) >> 2;
+ Uint32 sz = footSz + 1;
- if(dataBuffer.getWritePtr(&tmp, footSz + 1)) {
+ if (fill_record)
+ {
+ Uint32 * new_tmp;
+ if (!dataBuffer.getWritePtr(&tmp, sz))
+ return false;
+ new_tmp = tmp + sz;
+
+ if ((UintPtr)new_tmp & (sizeof(Page32)-1))
+ {
+ /* padding is needed to get full write */
+ new_tmp += 2 /* to fit empty header minimum 2 words*/;
+ new_tmp = (Uint32 *)(((UintPtr)new_tmp + sizeof(Page32)-1) &
+ ~(UintPtr)(sizeof(Page32)-1));
+ /* new write sz */
+ sz = new_tmp - tmp;
+ }
+ }
+
+ if(dataBuffer.getWritePtr(&tmp, sz)) {
jam();
* tmp = 0; // Finish record stream
tmp++;
@@ -3762,7 +3818,17 @@ Backup::OperationRecord::fragComplete(Uint32 tableId, Uint32 fragNo)
foot->FragmentNo = htonl(fragNo);
foot->NoOfRecords = htonl(noOfRecords);
foot->Checksum = htonl(0);
- dataBuffer.updateWritePtr(footSz + 1);
+
+ if (sz != footSz + 1)
+ {
+ tmp += footSz;
+ memset(tmp, 0, (sz - footSz - 1) * 4);
+ *tmp = htonl(BackupFormat::EMPTY_ENTRY);
+ tmp++;
+ *tmp = htonl(sz - footSz - 1);
+ }
+
+ dataBuffer.updateWritePtr(sz);
return true;
}//if
return false;
@@ -3864,8 +3930,13 @@ Backup::fragmentCompleted(Signal* signal, BackupFilePtr filePtr)
return;
}//if
+ BackupRecordPtr ptr LINT_SET_PTR;
+ c_backupPool.getPtr(ptr, filePtr.p->backupPtr);
+
OperationRecord & op = filePtr.p->operation;
- if(!op.fragComplete(filePtr.p->tableId, filePtr.p->fragmentNo)) {
+ if(!op.fragComplete(filePtr.p->tableId, filePtr.p->fragmentNo,
+ c_defaults.m_o_direct))
+ {
jam();
signal->theData[0] = BackupContinueB::BUFFER_FULL_FRAG_COMPLETE;
signal->theData[1] = filePtr.i;
@@ -3875,9 +3946,6 @@ Backup::fragmentCompleted(Signal* signal, BackupFilePtr filePtr)
filePtr.p->m_flags &= ~(Uint32)BackupFile::BF_SCAN_THREAD;
- BackupRecordPtr ptr LINT_SET_PTR;
- c_backupPool.getPtr(ptr, filePtr.p->backupPtr);
-
if (ptr.p->is_lcp())
{
ptr.p->slaveState.setState(STOPPING);
@@ -4914,6 +4982,8 @@ Backup::lcp_open_file(Signal* signal, BackupRecordPtr ptr)
FsOpenReq::OM_CREATE |
FsOpenReq::OM_APPEND |
FsOpenReq::OM_AUTOSYNC;
+ if (c_defaults.m_o_direct)
+ req->fileFlags |= FsOpenReq::OM_DIRECT;
FsOpenReq::v2_setCount(req->fileNumber, 0xFFFFFFFF);
req->auto_sync_size = c_defaults.m_disk_synch_size;
diff --git a/storage/ndb/src/kernel/blocks/backup/Backup.hpp b/storage/ndb/src/kernel/blocks/backup/Backup.hpp
index 32f2e14ac92..3fd9b2967fd 100644
--- a/storage/ndb/src/kernel/blocks/backup/Backup.hpp
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.hpp
@@ -240,7 +240,7 @@ public:
* Once per fragment
*/
bool newFragment(Uint32 tableId, Uint32 fragNo);
- bool fragComplete(Uint32 tableId, Uint32 fragNo);
+ bool fragComplete(Uint32 tableId, Uint32 fragNo, bool fill_record);
/**
* Once per scan frag (next) req/conf
@@ -534,6 +534,7 @@ public:
Uint32 m_disk_write_speed;
Uint32 m_disk_synch_size;
Uint32 m_diskless;
+ Uint32 m_o_direct;
};
/**
diff --git a/storage/ndb/src/kernel/blocks/backup/BackupFormat.hpp b/storage/ndb/src/kernel/blocks/backup/BackupFormat.hpp
index ace9dfe5c79..20f8f6650be 100644
--- a/storage/ndb/src/kernel/blocks/backup/BackupFormat.hpp
+++ b/storage/ndb/src/kernel/blocks/backup/BackupFormat.hpp
@@ -32,7 +32,8 @@ struct BackupFormat {
TABLE_LIST = 4,
TABLE_DESCRIPTION = 5,
GCP_ENTRY = 6,
- FRAGMENT_INFO = 7
+ FRAGMENT_INFO = 7,
+ EMPTY_ENTRY = 8
};
struct FileHeader {
@@ -93,6 +94,13 @@ struct BackupFormat {
Uint32 NoOfRecords;
Uint32 Checksum;
};
+
+ /* optional padding for O_DIRECT */
+ struct EmptyEntry {
+ Uint32 SectionType;
+ Uint32 SectionLength;
+ /* not used data */
+ };
};
/**
diff --git a/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp b/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp
index 4faa02e494f..2cd2a8a2bee 100644
--- a/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp
+++ b/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp
@@ -148,10 +148,13 @@ Backup::execREAD_CONFIG_REQ(Signal* signal)
c_defaults.m_disk_write_speed = 10 * (1024 * 1024);
c_defaults.m_disk_write_speed_sr = 100 * (1024 * 1024);
c_defaults.m_disk_synch_size = 4 * (1024 * 1024);
-
+ c_defaults.m_o_direct = true;
+
Uint32 noBackups = 0, noTables = 0, noAttribs = 0, noFrags = 0;
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS,
&c_defaults.m_diskless));
+ ndb_mgm_get_int_parameter(p, CFG_DB_O_DIRECT,
+ &c_defaults.m_o_direct);
ndb_mgm_get_int_parameter(p, CFG_DB_CHECKPOINT_SPEED_SR,
&c_defaults.m_disk_write_speed_sr);
ndb_mgm_get_int_parameter(p, CFG_DB_CHECKPOINT_SPEED,
@@ -204,7 +207,7 @@ Backup::execREAD_CONFIG_REQ(Signal* signal)
/ sizeof(Page32);
// We need to allocate an additional of 2 pages. 1 page because of a bug in
// ArrayPool and another one for DICTTAINFO.
- c_pagePool.setSize(noPages + NO_OF_PAGES_META_FILE + 2);
+ c_pagePool.setSize(noPages + NO_OF_PAGES_META_FILE + 2, true);
{ // Init all tables
SLList<Table> tables(c_tablePool);
diff --git a/storage/ndb/src/kernel/blocks/backup/FsBuffer.hpp b/storage/ndb/src/kernel/blocks/backup/FsBuffer.hpp
index d26f36ccf40..bb0bbd6d770 100644
--- a/storage/ndb/src/kernel/blocks/backup/FsBuffer.hpp
+++ b/storage/ndb/src/kernel/blocks/backup/FsBuffer.hpp
@@ -270,8 +270,8 @@ FsBuffer::getReadPtr(Uint32 ** ptr, Uint32 * sz, bool * _eof){
* ptr = &Tp[Tr];
- DEBUG(ndbout_c("getReadPtr() Tr: %d Tw: %d Ts: %d Tm: %d sz1: %d -> %d",
- Tr, Tw, Ts, Tm, sz1, * sz));
+ DEBUG(ndbout_c("getReadPtr() Tr: %d Tmw: %d Ts: %d Tm: %d sz1: %d -> %d",
+ Tr, Tmw, Ts, Tm, sz1, * sz));
return true;
}
@@ -279,8 +279,8 @@ FsBuffer::getReadPtr(Uint32 ** ptr, Uint32 * sz, bool * _eof){
if(!m_eof){
* _eof = false;
- DEBUG(ndbout_c("getReadPtr() Tr: %d Tw: %d Ts: %d Tm: %d sz1: %d -> false",
- Tr, Tw, Ts, Tm, sz1));
+ DEBUG(ndbout_c("getReadPtr() Tr: %d Tmw: %d Ts: %d Tm: %d sz1: %d -> false",
+ Tr, Tmw, Ts, Tm, sz1));
return false;
}
@@ -289,8 +289,8 @@ FsBuffer::getReadPtr(Uint32 ** ptr, Uint32 * sz, bool * _eof){
* _eof = true;
* ptr = &Tp[Tr];
- DEBUG(ndbout_c("getReadPtr() Tr: %d Tw: %d Ts: %d Tm: %d sz1: %d -> %d eof",
- Tr, Tw, Ts, Tm, sz1, * sz));
+ DEBUG(ndbout_c("getReadPtr() Tr: %d Tmw: %d Ts: %d Tm: %d sz1: %d -> %d eof",
+ Tr, Tmw, Ts, Tm, sz1, * sz));
return false;
}
@@ -316,13 +316,13 @@ FsBuffer::getWritePtr(Uint32 ** ptr, Uint32 sz){
if(sz1 > sz){ // Note at least 1 word of slack
* ptr = &Tp[Tw];
- DEBUG(ndbout_c("getWritePtr(%d) Tr: %d Tw: %d Ts: %d sz1: %d -> true",
- sz, Tr, Tw, Ts, sz1));
+ DEBUG(ndbout_c("getWritePtr(%d) Tw: %d sz1: %d -> true",
+ sz, Tw, sz1));
return true;
}
- DEBUG(ndbout_c("getWritePtr(%d) Tr: %d Tw: %d Ts: %d sz1: %d -> false",
- sz, Tr, Tw, Ts, sz1));
+ DEBUG(ndbout_c("getWritePtr(%d) Tw: %d sz1: %d -> false",
+ sz, Tw, sz1));
return false;
}
@@ -339,11 +339,15 @@ FsBuffer::updateWritePtr(Uint32 sz){
m_free -= sz;
if(Tnew < Ts){
m_writeIndex = Tnew;
+ DEBUG(ndbout_c("updateWritePtr(%d) m_writeIndex: %d",
+ sz, m_writeIndex));
return;
}
memcpy(Tp, &Tp[Ts], (Tnew - Ts) << 2);
m_writeIndex = Tnew - Ts;
+ DEBUG(ndbout_c("updateWritePtr(%d) m_writeIndex: %d",
+ sz, m_writeIndex));
}
inline
diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
index ac3acdc6778..edc8c0131db 100644
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
@@ -698,6 +698,9 @@ void Dbdict::execFSCLOSECONF(Signal* signal)
case FsConnectRecord::OPEN_READ_SCHEMA2:
openSchemaFile(signal, 1, fsPtr.i, false, false);
break;
+ case FsConnectRecord::OPEN_READ_TAB_FILE2:
+ openTableFile(signal, 1, fsPtr.i, c_readTableRecord.tableId, false);
+ break;
default:
jamLine((fsPtr.p->fsState & 0xFFF));
ndbrequire(false);
@@ -1073,8 +1076,11 @@ void Dbdict::readTableConf(Signal* signal,
void Dbdict::readTableRef(Signal* signal,
FsConnectRecordPtr fsPtr)
{
+ /**
+ * First close corrupt file
+ */
fsPtr.p->fsState = FsConnectRecord::OPEN_READ_TAB_FILE2;
- openTableFile(signal, 1, fsPtr.i, c_readTableRecord.tableId, false);
+ closeFile(signal, fsPtr.p->filePtr, fsPtr.i);
return;
}//Dbdict::readTableRef()
diff --git a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
index 1fe932aaae8..bc14eec1f98 100644
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
@@ -4741,12 +4741,18 @@ void Dbdih::failedNodeLcpHandling(Signal* signal, NodeRecordPtr failedNodePtr)
jam();
const Uint32 nodeId = failedNodePtr.i;
- if (c_lcpState.m_participatingLQH.get(failedNodePtr.i)){
+ if (isMaster() && c_lcpState.m_participatingLQH.get(failedNodePtr.i))
+ {
/*----------------------------------------------------*/
/* THE NODE WAS INVOLVED IN A LOCAL CHECKPOINT. WE */
/* MUST UPDATE THE ACTIVE STATUS TO INDICATE THAT */
/* THE NODE HAVE MISSED A LOCAL CHECKPOINT. */
/*----------------------------------------------------*/
+
+ /**
+ * Bug#28717, Only master should do this, as this status is copied
+ * to other nodes
+ */
switch (failedNodePtr.p->activeStatus) {
case Sysfile::NS_Active:
jam();
diff --git a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
index ba146fce005..64d214d472b 100644
--- a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
+++ b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
@@ -71,7 +71,6 @@ class Dbtup;
/* CONSTANTS OF THE LOG PAGES */
/* ------------------------------------------------------------------------- */
#define ZPAGE_HEADER_SIZE 32
-#define ZNO_MBYTES_IN_FILE 16
#define ZPAGE_SIZE 8192
#define ZPAGES_IN_MBYTE 32
#define ZTWOLOG_NO_PAGES_IN_MBYTE 5
@@ -115,9 +114,6 @@ class Dbtup;
/* ------------------------------------------------------------------------- */
/* VARIOUS CONSTANTS USED AS FLAGS TO THE FILE MANAGER. */
/* ------------------------------------------------------------------------- */
-#define ZOPEN_READ 0
-#define ZOPEN_WRITE 1
-#define ZOPEN_READ_WRITE 2
#define ZVAR_NO_LOG_PAGE_WORD 1
#define ZLIST_OF_PAIRS 0
#define ZLIST_OF_PAIRS_SYNCH 16
@@ -142,7 +138,7 @@ class Dbtup;
/* IN THE MBYTE. */
/* ------------------------------------------------------------------------- */
#define ZFD_HEADER_SIZE 3
-#define ZFD_PART_SIZE 48
+#define ZFD_MBYTE_SIZE 3
#define ZLOG_HEAD_SIZE 8
#define ZNEXT_LOG_SIZE 2
#define ZABORT_LOG_SIZE 3
@@ -169,7 +165,6 @@ class Dbtup;
#define ZPOS_LOG_TYPE 0
#define ZPOS_NO_FD 1
#define ZPOS_FILE_NO 2
-#define ZMAX_LOG_FILES_IN_PAGE_ZERO 40
/* ------------------------------------------------------------------------- */
/* THE POSITIONS WITHIN A PREPARE LOG RECORD AND A NEW PREPARE */
/* LOG RECORD. */
@@ -1437,17 +1432,17 @@ public:
* header of each log file. That information is used during
* system restart to find the tail of the log.
*/
- UintR logLastPrepRef[16];
+ UintR *logLastPrepRef;
/**
* The max global checkpoint completed before the mbyte in the
* log file was started. One variable per mbyte.
*/
- UintR logMaxGciCompleted[16];
+ UintR *logMaxGciCompleted;
/**
* The max global checkpoint started before the mbyte in the log
* file was started. One variable per mbyte.
*/
- UintR logMaxGciStarted[16];
+ UintR *logMaxGciStarted;
/**
* This variable contains the file name as needed by the file
* system when opening the file.
@@ -2163,6 +2158,7 @@ private:
void execSTART_RECREF(Signal* signal);
void execGCP_SAVEREQ(Signal* signal);
+ void execFSOPENREF(Signal* signal);
void execFSOPENCONF(Signal* signal);
void execFSCLOSECONF(Signal* signal);
void execFSWRITECONF(Signal* signal);
@@ -2671,6 +2667,8 @@ private:
LogPartRecord *logPartRecord;
LogPartRecordPtr logPartPtr;
UintR clogPartFileSize;
+ Uint32 clogFileSize; // In MBYTE
+ Uint32 cmaxLogFilesInPageZero; //
// Configurable
LogFileRecord *logFileRecord;
@@ -2678,13 +2676,15 @@ private:
UintR cfirstfreeLogFile;
UintR clogFileFileSize;
-#define ZLFO_FILE_SIZE 256 /* MAX 256 OUTSTANDING FILE OPERATIONS */
+#define ZLFO_MIN_FILE_SIZE 256
+// RedoBuffer/32K minimum ZLFO_MIN_FILE_SIZE
LogFileOperationRecord *logFileOperationRecord;
LogFileOperationRecordPtr lfoPtr;
UintR cfirstfreeLfo;
UintR clfoFileSize;
LogPageRecord *logPageRecord;
+ void *logPageRecordUnaligned;
LogPageRecordPtr logPagePtr;
UintR cfirstfreeLogPage;
UintR clogPageFileSize;
@@ -2695,7 +2695,7 @@ private:
UintR cfirstfreePageRef;
UintR cpageRefFileSize;
-#define ZSCANREC_FILE_SIZE 100
+// Configurable
ArrayPool<ScanRecord> c_scanRecordPool;
ScanRecordPtr scanptr;
UintR cscanNoFreeRec;
@@ -2888,6 +2888,7 @@ private:
UintR ctransidHash[1024];
Uint32 c_diskless;
+ Uint32 c_o_direct;
Uint32 c_error_insert_table_id;
public:
diff --git a/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp b/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp
index c054c227c8e..d6411ee1cb9 100644
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp
@@ -30,11 +30,11 @@ void Dblqh::initData()
cgcprecFileSize = ZGCPREC_FILE_SIZE;
chostFileSize = MAX_NDB_NODES;
clcpFileSize = ZNO_CONCURRENT_LCP;
- clfoFileSize = ZLFO_FILE_SIZE;
+ clfoFileSize = 0;
clogFileFileSize = 0;
clogPartFileSize = ZLOG_PART_FILE_SIZE;
cpageRefFileSize = ZPAGE_REF_FILE_SIZE;
- cscanrecFileSize = ZSCANREC_FILE_SIZE;
+ cscanrecFileSize = 0;
ctabrecFileSize = 0;
ctcConnectrecFileSize = 0;
ctcNodeFailrecFileSize = MAX_NDB_NODES;
@@ -49,6 +49,7 @@ void Dblqh::initData()
logFileRecord = 0;
logFileOperationRecord = 0;
logPageRecord = 0;
+ logPageRecordUnaligned= 0;
pageRefRecord = 0;
tablerec = 0;
tcConnectionrec = 0;
@@ -60,6 +61,8 @@ void Dblqh::initData()
cLqhTimeOutCheckCount = 0;
cbookedAccOps = 0;
m_backup_ptr = RNIL;
+ clogFileSize = 16;
+ cmaxLogFilesInPageZero = 40;
}//Dblqh::initData()
void Dblqh::initRecords()
@@ -105,10 +108,13 @@ void Dblqh::initRecords()
sizeof(LogFileOperationRecord),
clfoFileSize);
- logPageRecord = (LogPageRecord*)allocRecord("LogPageRecord",
- sizeof(LogPageRecord),
- clogPageFileSize,
- false);
+ logPageRecord =
+ (LogPageRecord*)allocRecordAligned("LogPageRecord",
+ sizeof(LogPageRecord),
+ clogPageFileSize,
+ &logPageRecordUnaligned,
+ NDB_O_DIRECT_WRITE_ALIGNMENT,
+ false);
pageRefRecord = (PageRefRecord*)allocRecord("PageRefRecord",
sizeof(PageRefRecord),
@@ -260,6 +266,7 @@ Dblqh::Dblqh(Block_context& ctx):
addRecSignal(GSN_START_FRAGREQ, &Dblqh::execSTART_FRAGREQ);
addRecSignal(GSN_START_RECREF, &Dblqh::execSTART_RECREF);
addRecSignal(GSN_GCP_SAVEREQ, &Dblqh::execGCP_SAVEREQ);
+ addRecSignal(GSN_FSOPENREF, &Dblqh::execFSOPENREF, true);
addRecSignal(GSN_FSOPENCONF, &Dblqh::execFSOPENCONF);
addRecSignal(GSN_FSCLOSECONF, &Dblqh::execFSCLOSECONF);
addRecSignal(GSN_FSWRITECONF, &Dblqh::execFSWRITECONF);
@@ -377,7 +384,7 @@ Dblqh::~Dblqh()
sizeof(LogFileOperationRecord),
clfoFileSize);
- deallocRecord((void**)&logPageRecord,
+ deallocRecord((void**)&logPageRecordUnaligned,
"LogPageRecord",
sizeof(LogPageRecord),
clogPageFileSize);
diff --git a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
index 2ffed9749b8..8f42a8039d8 100644
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
@@ -1023,6 +1023,11 @@ void Dblqh::execREAD_CONFIG_REQ(Signal* signal)
clogPageFileSize+= (16 - mega_byte_part);
}
+ /* maximum number of log file operations */
+ clfoFileSize = clogPageFileSize;
+ if (clfoFileSize < ZLFO_MIN_FILE_SIZE)
+ clfoFileSize = ZLFO_MIN_FILE_SIZE;
+
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_TABLE, &ctabrecFileSize));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_TC_CONNECT,
&ctcConnectrecFileSize));
@@ -1031,14 +1036,44 @@ void Dblqh::execREAD_CONFIG_REQ(Signal* signal)
cmaxAccOps = cscanrecFileSize * MAX_PARALLEL_OP_PER_SCAN;
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &c_diskless));
+ c_o_direct = true;
+ ndb_mgm_get_int_parameter(p, CFG_DB_O_DIRECT, &c_o_direct);
Uint32 tmp= 0;
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_FRAG, &tmp));
c_fragment_pool.setSize(tmp);
+ if (!ndb_mgm_get_int_parameter(p, CFG_DB_REDOLOG_FILE_SIZE,
+ &clogFileSize))
+ {
+ // convert to mbyte
+ clogFileSize = (clogFileSize + 1024*1024 - 1) / (1024 * 1024);
+ ndbrequire(clogFileSize >= 4 && clogFileSize <= 1024);
+ }
+
+ cmaxLogFilesInPageZero = (ZPAGE_SIZE - ZPAGE_HEADER_SIZE - 128) /
+ (ZFD_MBYTE_SIZE * clogFileSize);
+
+ /**
+ * "Old" cmaxLogFilesInPageZero was 40
+ * Each FD need 3 words per mb, require that they can fit into 1 page
+ * (atleast 1 FD)
+ * Is also checked in ConfigInfo.cpp (max FragmentLogFileSize = 1Gb)
+ * 1Gb = 1024Mb => 3(ZFD_MBYTE_SIZE) * 1024 < 8192 (ZPAGE_SIZE)
+ */
+ if (cmaxLogFilesInPageZero > 40)
+ {
+ jam();
+ cmaxLogFilesInPageZero = 40;
+ }
+ else
+ {
+ ndbrequire(cmaxLogFilesInPageZero);
+ }
+
initRecords();
initialiseRecordsLab(signal, 0, ref, senderData);
-
+
return;
}//Dblqh::execSIZEALT_REP()
@@ -11788,9 +11823,9 @@ void Dblqh::sendStartLcp(Signal* signal)
Uint32 Dblqh::remainingLogSize(const LogFileRecordPtr &sltCurrLogFilePtr,
const LogPartRecordPtr &sltLogPartPtr)
{
- Uint32 hf = sltCurrLogFilePtr.p->fileNo*ZNO_MBYTES_IN_FILE+sltCurrLogFilePtr.p->currentMbyte;
- Uint32 tf = sltLogPartPtr.p->logTailFileNo*ZNO_MBYTES_IN_FILE+sltLogPartPtr.p->logTailMbyte;
- Uint32 sz = sltLogPartPtr.p->noLogFiles*ZNO_MBYTES_IN_FILE;
+ Uint32 hf = sltCurrLogFilePtr.p->fileNo*clogFileSize+sltCurrLogFilePtr.p->currentMbyte;
+ Uint32 tf = sltLogPartPtr.p->logTailFileNo*clogFileSize+sltLogPartPtr.p->logTailMbyte;
+ Uint32 sz = sltLogPartPtr.p->noLogFiles*clogFileSize;
if (tf > hf) hf += sz;
return sz-(hf-tf);
}
@@ -11848,7 +11883,7 @@ void Dblqh::setLogTail(Signal* signal, Uint32 keepGci)
/* ------------------------------------------------------------------------- */
SLT_LOOP:
for (tsltIndex = tsltStartMbyte;
- tsltIndex <= ZNO_MBYTES_IN_FILE - 1;
+ tsltIndex <= clogFileSize - 1;
tsltIndex++) {
if (sltLogFilePtr.p->logMaxGciStarted[tsltIndex] >= keepGci) {
/* ------------------------------------------------------------------------- */
@@ -11864,7 +11899,7 @@ void Dblqh::setLogTail(Signal* signal, Uint32 keepGci)
/* ------------------------------------------------------------------------- */
/*STEPPING BACK INCLUDES ALSO STEPPING BACK TO THE PREVIOUS LOG FILE. */
/* ------------------------------------------------------------------------- */
- tsltMbyte = ZNO_MBYTES_IN_FILE - 1;
+ tsltMbyte = clogFileSize - 1;
sltLogFilePtr.i = sltLogFilePtr.p->prevLogFile;
ptrCheckGuard(sltLogFilePtr, clogFileFileSize, logFileRecord);
}//if
@@ -11902,7 +11937,7 @@ void Dblqh::setLogTail(Signal* signal, Uint32 keepGci)
UintR ToldTailFileNo = sltLogPartPtr.p->logTailFileNo;
UintR ToldTailMByte = sltLogPartPtr.p->logTailMbyte;
- arrGuard(tsltMbyte, 16);
+ arrGuard(tsltMbyte, clogFileSize);
sltLogPartPtr.p->logTailFileNo =
sltLogFilePtr.p->logLastPrepRef[tsltMbyte] >> 16;
/* ------------------------------------------------------------------------- */
@@ -12402,6 +12437,26 @@ void Dblqh::execFSOPENCONF(Signal* signal)
}//switch
}//Dblqh::execFSOPENCONF()
+void
+Dblqh::execFSOPENREF(Signal* signal)
+{
+ jamEntry();
+ FsRef* ref = (FsRef*)signal->getDataPtr();
+ Uint32 err = ref->errorCode;
+ if (err == FsRef::fsErrInvalidFileSize)
+ {
+ char buf[256];
+ BaseString::snprintf(buf, sizeof(buf),
+ "Invalid file size for redo logfile, "
+ " size only changable with --initial");
+ progError(__LINE__,
+ NDBD_EXIT_INVALID_CONFIG,
+ buf);
+ return;
+ }
+
+ SimulatedBlock::execFSOPENREF(signal);
+}
/* ************>> */
/* FSREADCONF > */
@@ -13047,7 +13102,7 @@ void Dblqh::openFileInitLab(Signal* signal)
{
logFilePtr.p->logFileStatus = LogFileRecord::OPEN_INIT;
seizeLogpage(signal);
- writeSinglePage(signal, (ZNO_MBYTES_IN_FILE * ZPAGES_IN_MBYTE) - 1,
+ writeSinglePage(signal, (clogFileSize * ZPAGES_IN_MBYTE) - 1,
ZPAGE_SIZE - 1, __LINE__);
lfoPtr.p->lfoState = LogFileOperationRecord::INIT_WRITE_AT_END;
return;
@@ -13110,7 +13165,7 @@ void Dblqh::writeInitMbyteLab(Signal* signal)
{
releaseLfo(signal);
logFilePtr.p->currentMbyte = logFilePtr.p->currentMbyte + 1;
- if (logFilePtr.p->currentMbyte == ZNO_MBYTES_IN_FILE) {
+ if (logFilePtr.p->currentMbyte == clogFileSize) {
jam();
releaseLogpage(signal);
logFilePtr.p->logFileStatus = LogFileRecord::CLOSING_INIT;
@@ -13230,7 +13285,7 @@ void Dblqh::initLogfile(Signal* signal, Uint32 fileNo)
logFilePtr.p->lastPageWritten = 0;
logFilePtr.p->logPageZero = RNIL;
logFilePtr.p->currentMbyte = 0;
- for (tilIndex = 0; tilIndex <= 15; tilIndex++) {
+ for (tilIndex = 0; tilIndex < clogFileSize; tilIndex++) {
logFilePtr.p->logMaxGciCompleted[tilIndex] = (UintR)-1;
logFilePtr.p->logMaxGciStarted[tilIndex] = (UintR)-1;
logFilePtr.p->logLastPrepRef[tilIndex] = 0;
@@ -13281,8 +13336,14 @@ void Dblqh::openFileRw(Signal* signal, LogFileRecordPtr olfLogFilePtr)
signal->theData[3] = olfLogFilePtr.p->fileName[1];
signal->theData[4] = olfLogFilePtr.p->fileName[2];
signal->theData[5] = olfLogFilePtr.p->fileName[3];
- signal->theData[6] = ZOPEN_READ_WRITE | FsOpenReq::OM_AUTOSYNC;
+ signal->theData[6] = FsOpenReq::OM_READWRITE | FsOpenReq::OM_AUTOSYNC | FsOpenReq::OM_CHECK_SIZE;
+ if (c_o_direct)
+ signal->theData[6] |= FsOpenReq::OM_DIRECT;
req->auto_sync_size = MAX_REDO_PAGES_WITHOUT_SYNCH * sizeof(LogPageRecord);
+ Uint64 sz = clogFileSize;
+ sz *= 1024; sz *= 1024;
+ req->file_size_hi = sz >> 32;
+ req->file_size_lo = sz & 0xFFFFFFFF;
sendSignal(NDBFS_REF, GSN_FSOPENREQ, signal, FsOpenReq::SignalLength, JBA);
}//Dblqh::openFileRw()
@@ -13301,7 +13362,9 @@ void Dblqh::openLogfileInit(Signal* signal)
signal->theData[3] = logFilePtr.p->fileName[1];
signal->theData[4] = logFilePtr.p->fileName[2];
signal->theData[5] = logFilePtr.p->fileName[3];
- signal->theData[6] = 0x302 | FsOpenReq::OM_AUTOSYNC;
+ signal->theData[6] = FsOpenReq::OM_READWRITE | FsOpenReq::OM_TRUNCATE | FsOpenReq::OM_CREATE | FsOpenReq::OM_AUTOSYNC;
+ if (c_o_direct)
+ signal->theData[6] |= FsOpenReq::OM_DIRECT;
req->auto_sync_size = MAX_REDO_PAGES_WITHOUT_SYNCH * sizeof(LogPageRecord);
sendSignal(NDBFS_REF, GSN_FSOPENREQ, signal, FsOpenReq::SignalLength, JBA);
}//Dblqh::openLogfileInit()
@@ -13337,8 +13400,14 @@ void Dblqh::openNextLogfile(Signal* signal)
signal->theData[3] = onlLogFilePtr.p->fileName[1];
signal->theData[4] = onlLogFilePtr.p->fileName[2];
signal->theData[5] = onlLogFilePtr.p->fileName[3];
- signal->theData[6] = 2 | FsOpenReq::OM_AUTOSYNC;
+ signal->theData[6] = FsOpenReq::OM_READWRITE | FsOpenReq::OM_AUTOSYNC | FsOpenReq::OM_CHECK_SIZE;
+ if (c_o_direct)
+ signal->theData[6] |= FsOpenReq::OM_DIRECT;
req->auto_sync_size = MAX_REDO_PAGES_WITHOUT_SYNCH * sizeof(LogPageRecord);
+ Uint64 sz = clogFileSize;
+ sz *= 1024; sz *= 1024;
+ req->file_size_hi = sz >> 32;
+ req->file_size_lo = sz & 0xFFFFFFFF;
sendSignal(NDBFS_REF, GSN_FSOPENREQ, signal, FsOpenReq::SignalLength, JBA);
}//if
}//Dblqh::openNextLogfile()
@@ -13469,7 +13538,7 @@ void Dblqh::writeFileDescriptor(Signal* signal)
/* -------------------------------------------------- */
/* START BY WRITING TO LOG FILE RECORD */
/* -------------------------------------------------- */
- arrGuard(logFilePtr.p->currentMbyte, 16);
+ arrGuard(logFilePtr.p->currentMbyte, clogFileSize);
logFilePtr.p->logMaxGciCompleted[logFilePtr.p->currentMbyte] =
logPartPtr.p->logPartNewestCompletedGCI;
logFilePtr.p->logMaxGciStarted[logFilePtr.p->currentMbyte] = cnewestGci;
@@ -13495,10 +13564,7 @@ void Dblqh::writeFileDescriptor(Signal* signal)
/* ------------------------------------------------------------------------- */
void Dblqh::writeFileHeaderOpen(Signal* signal, Uint32 wmoType)
{
- LogFileRecordPtr wmoLogFilePtr;
UintR twmoNoLogDescriptors;
- UintR twmoLoop;
- UintR twmoIndex;
/* -------------------------------------------------- */
/* WRITE HEADER INFORMATION IN THE NEW FILE. */
@@ -13506,52 +13572,44 @@ void Dblqh::writeFileHeaderOpen(Signal* signal, Uint32 wmoType)
logPagePtr.p->logPageWord[ZPAGE_HEADER_SIZE + ZPOS_LOG_TYPE] = ZFD_TYPE;
logPagePtr.p->logPageWord[ZPAGE_HEADER_SIZE + ZPOS_FILE_NO] =
logFilePtr.p->fileNo;
- if (logPartPtr.p->noLogFiles > ZMAX_LOG_FILES_IN_PAGE_ZERO) {
+ if (logPartPtr.p->noLogFiles > cmaxLogFilesInPageZero) {
jam();
- twmoNoLogDescriptors = ZMAX_LOG_FILES_IN_PAGE_ZERO;
+ twmoNoLogDescriptors = cmaxLogFilesInPageZero;
} else {
jam();
twmoNoLogDescriptors = logPartPtr.p->noLogFiles;
}//if
logPagePtr.p->logPageWord[ZPAGE_HEADER_SIZE + ZPOS_NO_FD] =
twmoNoLogDescriptors;
- wmoLogFilePtr.i = logFilePtr.i;
- twmoLoop = 0;
-WMO_LOOP:
- jam();
- if (twmoLoop < twmoNoLogDescriptors) {
- jam();
- ptrCheckGuard(wmoLogFilePtr, clogFileFileSize, logFileRecord);
- for (twmoIndex = 0; twmoIndex <= ZNO_MBYTES_IN_FILE - 1; twmoIndex++) {
- jam();
- arrGuard(((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (twmoLoop * ZFD_PART_SIZE)) + twmoIndex, ZPAGE_SIZE);
- logPagePtr.p->logPageWord[((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (twmoLoop * ZFD_PART_SIZE)) + twmoIndex] =
- wmoLogFilePtr.p->logMaxGciCompleted[twmoIndex];
- arrGuard((((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (twmoLoop * ZFD_PART_SIZE)) + ZNO_MBYTES_IN_FILE) +
- twmoIndex, ZPAGE_SIZE);
- logPagePtr.p->logPageWord[(((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (twmoLoop * ZFD_PART_SIZE)) + ZNO_MBYTES_IN_FILE) + twmoIndex] =
- wmoLogFilePtr.p->logMaxGciStarted[twmoIndex];
- arrGuard((((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (twmoLoop * ZFD_PART_SIZE)) + (2 * ZNO_MBYTES_IN_FILE)) +
- twmoIndex, ZPAGE_SIZE);
- logPagePtr.p->logPageWord[(((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (twmoLoop * ZFD_PART_SIZE)) + (2 * ZNO_MBYTES_IN_FILE)) + twmoIndex] =
- wmoLogFilePtr.p->logLastPrepRef[twmoIndex];
- }//for
- wmoLogFilePtr.i = wmoLogFilePtr.p->prevLogFile;
- twmoLoop = twmoLoop + 1;
- goto WMO_LOOP;
- }//if
- logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] =
- (ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (ZFD_PART_SIZE * twmoNoLogDescriptors);
- arrGuard(logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX], ZPAGE_SIZE);
- logPagePtr.p->logPageWord[logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX]] =
- ZNEXT_LOG_RECORD_TYPE;
+
+ {
+ Uint32 pos = ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE;
+ LogFileRecordPtr filePtr = logFilePtr;
+ for (Uint32 fd = 0; fd < twmoNoLogDescriptors; fd++)
+ {
+ jam();
+ ptrCheckGuard(filePtr, clogFileFileSize, logFileRecord);
+ for (Uint32 mb = 0; mb < clogFileSize; mb ++)
+ {
+ jam();
+ Uint32 pos0 = pos + fd * (ZFD_MBYTE_SIZE * clogFileSize) + mb;
+ Uint32 pos1 = pos0 + clogFileSize;
+ Uint32 pos2 = pos1 + clogFileSize;
+ arrGuard(pos0, ZPAGE_SIZE);
+ arrGuard(pos1, ZPAGE_SIZE);
+ arrGuard(pos2, ZPAGE_SIZE);
+ logPagePtr.p->logPageWord[pos0] = filePtr.p->logMaxGciCompleted[mb];
+ logPagePtr.p->logPageWord[pos1] = filePtr.p->logMaxGciStarted[mb];
+ logPagePtr.p->logPageWord[pos2] = filePtr.p->logLastPrepRef[mb];
+ }
+ filePtr.i = filePtr.p->prevLogFile;
+ }
+ pos += (twmoNoLogDescriptors * ZFD_MBYTE_SIZE * clogFileSize);
+ arrGuard(pos, ZPAGE_SIZE);
+ logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] = pos;
+ logPagePtr.p->logPageWord[pos] = ZNEXT_LOG_RECORD_TYPE;
+ }
+
/* ------------------------------------------------------- */
/* THIS IS A SPECIAL WRITE OF THE FIRST PAGE IN THE */
/* LOG FILE. THIS HAS SPECIAL SIGNIFANCE TO FIND */
@@ -13696,9 +13754,9 @@ void Dblqh::openSrLastFileLab(Signal* signal)
void Dblqh::readSrLastFileLab(Signal* signal)
{
logPartPtr.p->logLap = logPagePtr.p->logPageWord[ZPOS_LOG_LAP];
- if (logPartPtr.p->noLogFiles > ZMAX_LOG_FILES_IN_PAGE_ZERO) {
+ if (logPartPtr.p->noLogFiles > cmaxLogFilesInPageZero) {
jam();
- initGciInLogFileRec(signal, ZMAX_LOG_FILES_IN_PAGE_ZERO);
+ initGciInLogFileRec(signal, cmaxLogFilesInPageZero);
} else {
jam();
initGciInLogFileRec(signal, logPartPtr.p->noLogFiles);
@@ -13723,7 +13781,7 @@ void Dblqh::readSrLastMbyteLab(Signal* signal)
logPartPtr.p->lastMbyte = logFilePtr.p->currentMbyte - 1;
}//if
}//if
- arrGuard(logFilePtr.p->currentMbyte, 16);
+ arrGuard(logFilePtr.p->currentMbyte, clogFileSize);
logFilePtr.p->logMaxGciCompleted[logFilePtr.p->currentMbyte] =
logPagePtr.p->logPageWord[ZPOS_MAX_GCI_COMPLETED];
logFilePtr.p->logMaxGciStarted[logFilePtr.p->currentMbyte] =
@@ -13731,7 +13789,7 @@ void Dblqh::readSrLastMbyteLab(Signal* signal)
logFilePtr.p->logLastPrepRef[logFilePtr.p->currentMbyte] =
logPagePtr.p->logPageWord[ZLAST_LOG_PREP_REF];
releaseLogpage(signal);
- if (logFilePtr.p->currentMbyte < (ZNO_MBYTES_IN_FILE - 1)) {
+ if (logFilePtr.p->currentMbyte < (clogFileSize - 1)) {
jam();
logFilePtr.p->currentMbyte++;
readSinglePage(signal, ZPAGES_IN_MBYTE * logFilePtr.p->currentMbyte);
@@ -13745,21 +13803,21 @@ void Dblqh::readSrLastMbyteLab(Signal* signal)
* ---------------------------------------------------------------------- */
if (logPartPtr.p->lastMbyte == ZNIL) {
jam();
- logPartPtr.p->lastMbyte = ZNO_MBYTES_IN_FILE - 1;
+ logPartPtr.p->lastMbyte = clogFileSize - 1;
}//if
}//if
logFilePtr.p->logFileStatus = LogFileRecord::CLOSING_SR;
closeFile(signal, logFilePtr, __LINE__);
- if (logPartPtr.p->noLogFiles > ZMAX_LOG_FILES_IN_PAGE_ZERO) {
+ if (logPartPtr.p->noLogFiles > cmaxLogFilesInPageZero) {
Uint32 fileNo;
- if (logFilePtr.p->fileNo >= ZMAX_LOG_FILES_IN_PAGE_ZERO) {
+ if (logFilePtr.p->fileNo >= cmaxLogFilesInPageZero) {
jam();
- fileNo = logFilePtr.p->fileNo - ZMAX_LOG_FILES_IN_PAGE_ZERO;
+ fileNo = logFilePtr.p->fileNo - cmaxLogFilesInPageZero;
} else {
jam();
fileNo =
(logPartPtr.p->noLogFiles + logFilePtr.p->fileNo) -
- ZMAX_LOG_FILES_IN_PAGE_ZERO;
+ cmaxLogFilesInPageZero;
}//if
if (fileNo == 0) {
jam();
@@ -13769,11 +13827,11 @@ void Dblqh::readSrLastMbyteLab(Signal* signal)
* -------------------------------------------------------------------- */
fileNo = 1;
logPartPtr.p->srRemainingFiles =
- logPartPtr.p->noLogFiles - (ZMAX_LOG_FILES_IN_PAGE_ZERO - 1);
+ logPartPtr.p->noLogFiles - (cmaxLogFilesInPageZero - 1);
} else {
jam();
logPartPtr.p->srRemainingFiles =
- logPartPtr.p->noLogFiles - ZMAX_LOG_FILES_IN_PAGE_ZERO;
+ logPartPtr.p->noLogFiles - cmaxLogFilesInPageZero;
}//if
LogFileRecordPtr locLogFilePtr;
findLogfile(signal, fileNo, logPartPtr, &locLogFilePtr);
@@ -13798,9 +13856,9 @@ void Dblqh::openSrNextFileLab(Signal* signal)
void Dblqh::readSrNextFileLab(Signal* signal)
{
- if (logPartPtr.p->srRemainingFiles > ZMAX_LOG_FILES_IN_PAGE_ZERO) {
+ if (logPartPtr.p->srRemainingFiles > cmaxLogFilesInPageZero) {
jam();
- initGciInLogFileRec(signal, ZMAX_LOG_FILES_IN_PAGE_ZERO);
+ initGciInLogFileRec(signal, cmaxLogFilesInPageZero);
} else {
jam();
initGciInLogFileRec(signal, logPartPtr.p->srRemainingFiles);
@@ -13808,16 +13866,16 @@ void Dblqh::readSrNextFileLab(Signal* signal)
releaseLogpage(signal);
logFilePtr.p->logFileStatus = LogFileRecord::CLOSING_SR;
closeFile(signal, logFilePtr, __LINE__);
- if (logPartPtr.p->srRemainingFiles > ZMAX_LOG_FILES_IN_PAGE_ZERO) {
+ if (logPartPtr.p->srRemainingFiles > cmaxLogFilesInPageZero) {
Uint32 fileNo;
- if (logFilePtr.p->fileNo >= ZMAX_LOG_FILES_IN_PAGE_ZERO) {
+ if (logFilePtr.p->fileNo >= cmaxLogFilesInPageZero) {
jam();
- fileNo = logFilePtr.p->fileNo - ZMAX_LOG_FILES_IN_PAGE_ZERO;
+ fileNo = logFilePtr.p->fileNo - cmaxLogFilesInPageZero;
} else {
jam();
fileNo =
(logPartPtr.p->noLogFiles + logFilePtr.p->fileNo) -
- ZMAX_LOG_FILES_IN_PAGE_ZERO;
+ cmaxLogFilesInPageZero;
}//if
if (fileNo == 0) {
jam();
@@ -13826,11 +13884,11 @@ void Dblqh::readSrNextFileLab(Signal* signal)
* -------------------------------------------------------------------- */
fileNo = 1;
logPartPtr.p->srRemainingFiles =
- logPartPtr.p->srRemainingFiles - (ZMAX_LOG_FILES_IN_PAGE_ZERO - 1);
+ logPartPtr.p->srRemainingFiles - (cmaxLogFilesInPageZero - 1);
} else {
jam();
logPartPtr.p->srRemainingFiles =
- logPartPtr.p->srRemainingFiles - ZMAX_LOG_FILES_IN_PAGE_ZERO;
+ logPartPtr.p->srRemainingFiles - cmaxLogFilesInPageZero;
}//if
LogFileRecordPtr locLogFilePtr;
findLogfile(signal, fileNo, logPartPtr, &locLogFilePtr);
@@ -14701,7 +14759,7 @@ void Dblqh::srLogLimits(Signal* signal)
* EXECUTED.
* ----------------------------------------------------------------------- */
while(true) {
- ndbrequire(tmbyte < 16);
+ ndbrequire(tmbyte < clogFileSize);
if (logPartPtr.p->logExecState == LogPartRecord::LES_SEARCH_STOP) {
if (logFilePtr.p->logMaxGciCompleted[tmbyte] < logPartPtr.p->logLastGci) {
jam();
@@ -14742,7 +14800,7 @@ void Dblqh::srLogLimits(Signal* signal)
if (logPartPtr.p->logExecState != LogPartRecord::LES_EXEC_LOG) {
if (tmbyte == 0) {
jam();
- tmbyte = ZNO_MBYTES_IN_FILE - 1;
+ tmbyte = clogFileSize - 1;
logFilePtr.i = logFilePtr.p->prevLogFile;
ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord);
} else {
@@ -15136,7 +15194,7 @@ void Dblqh::execSr(Signal* signal)
logPagePtr.p->logPageWord[ZPAGE_HEADER_SIZE + ZPOS_NO_FD];
logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] =
(ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (noFdDescriptors * ZFD_PART_SIZE);
+ (noFdDescriptors * ZFD_MBYTE_SIZE * clogFileSize);
}
break;
/* ========================================================================= */
@@ -15176,11 +15234,11 @@ void Dblqh::execSr(Signal* signal)
/*---------------------------------------------------------------------------*/
/* START EXECUTION OF A NEW MBYTE IN THE LOG. */
/*---------------------------------------------------------------------------*/
- if (logFilePtr.p->currentMbyte < (ZNO_MBYTES_IN_FILE - 1)) {
+ if (logFilePtr.p->currentMbyte < (clogFileSize - 1)) {
jam();
logPartPtr.p->logExecState = LogPartRecord::LES_EXEC_LOG_NEW_MBYTE;
} else {
- ndbrequire(logFilePtr.p->currentMbyte == (ZNO_MBYTES_IN_FILE - 1));
+ ndbrequire(logFilePtr.p->currentMbyte == (clogFileSize - 1));
jam();
/*---------------------------------------------------------------------------*/
/* WE HAVE TO CHANGE FILE. CLOSE THIS ONE AND THEN OPEN THE NEXT. */
@@ -15375,7 +15433,7 @@ void Dblqh::invalidateLogAfterLastGCI(Signal* signal) {
jam();
releaseLfo(signal);
releaseLogpage(signal);
- if (logPartPtr.p->invalidatePageNo < (ZNO_MBYTES_IN_FILE * ZPAGES_IN_MBYTE - 1)) {
+ if (logPartPtr.p->invalidatePageNo < (clogFileSize * ZPAGES_IN_MBYTE - 1)) {
// We continue in this file.
logPartPtr.p->invalidatePageNo++;
} else {
@@ -16716,6 +16774,22 @@ void Dblqh::initialiseLogFile(Signal* signal)
ptrAss(logFilePtr, logFileRecord);
logFilePtr.p->nextLogFile = logFilePtr.i + 1;
logFilePtr.p->logFileStatus = LogFileRecord::LFS_IDLE;
+
+ logFilePtr.p->logLastPrepRef = new Uint32[clogFileSize];
+ logFilePtr.p->logMaxGciCompleted = new Uint32[clogFileSize];
+ logFilePtr.p->logMaxGciStarted = new Uint32[clogFileSize];
+
+ if (logFilePtr.p->logLastPrepRef == 0 ||
+ logFilePtr.p->logMaxGciCompleted == 0 ||
+ logFilePtr.p->logMaxGciStarted == 0)
+ {
+ char buf[256];
+ BaseString::snprintf(buf, sizeof(buf),
+ "Failed to alloc mbyte(%u) arrays for logfile %u",
+ clogFileSize, logFilePtr.i);
+ progError(__LINE__, NDBD_EXIT_MEMALLOC, buf);
+ }
+
}//for
logFilePtr.i = clogFileFileSize - 1;
ptrAss(logFilePtr, logFileRecord);
@@ -17044,41 +17118,31 @@ void Dblqh::initFragrec(Signal* signal,
* ========================================================================= */
void Dblqh::initGciInLogFileRec(Signal* signal, Uint32 noFdDescriptors)
{
- LogFileRecordPtr iglLogFilePtr;
- UintR tiglLoop;
- UintR tiglIndex;
-
- tiglLoop = 0;
- iglLogFilePtr.i = logFilePtr.i;
- iglLogFilePtr.p = logFilePtr.p;
-IGL_LOOP:
- for (tiglIndex = 0; tiglIndex <= ZNO_MBYTES_IN_FILE - 1; tiglIndex++) {
- arrGuard(((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (tiglLoop * ZFD_PART_SIZE)) + tiglIndex, ZPAGE_SIZE);
- iglLogFilePtr.p->logMaxGciCompleted[tiglIndex] =
- logPagePtr.p->logPageWord[((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (tiglLoop * ZFD_PART_SIZE)) + tiglIndex];
- arrGuard((((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) + ZNO_MBYTES_IN_FILE) +
- (tiglLoop * ZFD_PART_SIZE)) + tiglIndex, ZPAGE_SIZE);
- iglLogFilePtr.p->logMaxGciStarted[tiglIndex] =
- logPagePtr.p->logPageWord[(((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- ZNO_MBYTES_IN_FILE) +
- (tiglLoop * ZFD_PART_SIZE)) + tiglIndex];
- arrGuard((((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (2 * ZNO_MBYTES_IN_FILE)) + (tiglLoop * ZFD_PART_SIZE)) +
- tiglIndex, ZPAGE_SIZE);
- iglLogFilePtr.p->logLastPrepRef[tiglIndex] =
- logPagePtr.p->logPageWord[(((ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE) +
- (2 * ZNO_MBYTES_IN_FILE)) +
- (tiglLoop * ZFD_PART_SIZE)) + tiglIndex];
- }//for
- tiglLoop = tiglLoop + 1;
- if (tiglLoop < noFdDescriptors) {
+ LogFileRecordPtr filePtr = logFilePtr;
+ Uint32 pos = ZPAGE_HEADER_SIZE + ZFD_HEADER_SIZE;
+ for (Uint32 fd = 0; fd < noFdDescriptors; fd++)
+ {
jam();
- iglLogFilePtr.i = iglLogFilePtr.p->prevLogFile;
- ptrCheckGuard(iglLogFilePtr, clogFileFileSize, logFileRecord);
- goto IGL_LOOP;
- }//if
+ for (Uint32 mb = 0; mb < clogFileSize; mb++)
+ {
+ jam();
+ Uint32 pos0 = pos + fd * (ZFD_MBYTE_SIZE * clogFileSize) + mb;
+ Uint32 pos1 = pos0 + clogFileSize;
+ Uint32 pos2 = pos1 + clogFileSize;
+ arrGuard(pos0, ZPAGE_SIZE);
+ arrGuard(pos1, ZPAGE_SIZE);
+ arrGuard(pos2, ZPAGE_SIZE);
+ filePtr.p->logMaxGciCompleted[mb] = logPagePtr.p->logPageWord[pos0];
+ filePtr.p->logMaxGciStarted[mb] = logPagePtr.p->logPageWord[pos1];
+ filePtr.p->logLastPrepRef[mb] = logPagePtr.p->logPageWord[pos2];
+ }
+ if (fd + 1 < noFdDescriptors)
+ {
+ jam();
+ filePtr.i = filePtr.p->prevLogFile;
+ ptrCheckGuard(filePtr, clogFileFileSize, logFileRecord);
+ }
+ }
}//Dblqh::initGciInLogFileRec()
/* ==========================================================================
@@ -18331,7 +18395,7 @@ void Dblqh::writeNextLog(Signal* signal)
ndbrequire(logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] < ZPAGE_SIZE);
logPagePtr.p->logPageWord[logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX]] =
ZNEXT_MBYTE_TYPE;
- if (logFilePtr.p->currentMbyte == (ZNO_MBYTES_IN_FILE - 1)) {
+ if (logFilePtr.p->currentMbyte == (clogFileSize - 1)) {
jam();
/* -------------------------------------------------- */
/* CALCULATE THE NEW REMAINING WORDS WHEN */
@@ -18420,7 +18484,7 @@ void Dblqh::writeNextLog(Signal* signal)
systemError(signal, __LINE__);
}//if
}//if
- if (logFilePtr.p->currentMbyte == (ZNO_MBYTES_IN_FILE - 1)) {
+ if (logFilePtr.p->currentMbyte == (clogFileSize - 1)) {
jam();
twnlNextMbyte = 0;
if (logFilePtr.p->fileChangeState != LogFileRecord::NOT_ONGOING) {
diff --git a/storage/ndb/src/kernel/blocks/dblqh/Makefile.am b/storage/ndb/src/kernel/blocks/dblqh/Makefile.am
index c7c477a512c..b545096dc83 100644
--- a/storage/ndb/src/kernel/blocks/dblqh/Makefile.am
+++ b/storage/ndb/src/kernel/blocks/dblqh/Makefile.am
@@ -16,7 +16,7 @@
EXTRA_PROGRAMS = ndbd_redo_log_reader
ndbd_redo_log_reader_SOURCES = redoLogReader/records.cpp \
- redoLogReader/redoLogFileReader.cpp
+ redoLogReader/reader.cpp
include $(top_srcdir)/storage/ndb/config/common.mk.am
include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
diff --git a/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp b/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/reader.cpp
index e5df14aea9a..e5df14aea9a 100644
--- a/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp
+++ b/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/reader.cpp
diff --git a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
index 5c0972148dd..f28687dca0d 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
@@ -2700,6 +2700,10 @@ private:
ArrayPool<Page> c_page_pool;
Uint32 cnoOfAllocatedPages;
+ Uint32 m_max_allocate_pages;
+
+ /* read ahead in pages during disk order scan */
+ Uint32 m_max_page_read_ahead;
Tablerec *tablerec;
Uint32 cnoOfTablerec;
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp
index 1182ac4ee7d..8e532ae97b5 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp
@@ -74,6 +74,10 @@ Dbtup::reportMemoryUsage(Signal* signal, int incDec){
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 6, JBB);
}
+#ifdef VM_TRACE
+extern Uint32 fc_left, fc_right, fc_remove;
+#endif
+
void
Dbtup::execDUMP_STATE_ORD(Signal* signal)
{
@@ -155,12 +159,20 @@ Dbtup::execDUMP_STATE_ORD(Signal* signal)
return;
}//if
#endif
-#if defined VM_TRACE && 0
- if (type == 1211){
- ndbout_c("Startar modul test av Page Manager");
+#if defined VM_TRACE
+ if (type == 1211 || type == 1212 || type == 1213){
+ Uint32 seed = time(0);
+ if (signal->getLength() > 1)
+ seed = signal->theData[1];
+ ndbout_c("Startar modul test av Page Manager (seed: 0x%x)", seed);
+ srand(seed);
Vector<Chunk> chunks;
const Uint32 LOOPS = 1000;
+ Uint32 sum_req = 0;
+ Uint32 sum_conf = 0;
+ Uint32 sum_loop = 0;
+ Uint32 max_loop = 0;
for(Uint32 i = 0; i<LOOPS; i++){
// Case
@@ -177,8 +189,15 @@ Dbtup::execDUMP_STATE_ORD(Signal* signal)
if(chunks.size() == 0 && c == 0){
c = 1 + rand() % 2;
}
+
+ if (type == 1211)
+ ndbout_c("loop=%d case=%d free=%d alloc=%d", i, c, free, alloc);
- ndbout_c("loop=%d case=%d free=%d alloc=%d", i, c, free, alloc);
+ if (type == 1213)
+ {
+ c = 1;
+ alloc = 2 + (sum_conf >> 3) + (sum_conf >> 4);
+ }
switch(c){
case 0:{ // Release
const int ch = rand() % chunks.size();
@@ -190,23 +209,33 @@ Dbtup::execDUMP_STATE_ORD(Signal* signal)
case 2: { // Seize(n) - fail
alloc += free;
// Fall through
+ sum_req += free;
+ goto doalloc;
}
case 1: { // Seize(n) (success)
-
+ sum_req += alloc;
+ doalloc:
Chunk chunk;
allocConsPages(alloc, chunk.pageCount, chunk.pageId);
ndbrequire(chunk.pageCount <= alloc);
if(chunk.pageCount != 0){
chunks.push_back(chunk);
if(chunk.pageCount != alloc) {
- ndbout_c(" Tried to allocate %d - only allocated %d - free: %d",
- alloc, chunk.pageCount, free);
+ if (type == 1211)
+ ndbout_c(" Tried to allocate %d - only allocated %d - free: %d",
+ alloc, chunk.pageCount, free);
}
} else {
ndbout_c(" Failed to alloc %d pages with %d pages free",
alloc, free);
}
+ sum_conf += chunk.pageCount;
+ Uint32 tot = fc_left + fc_right + fc_remove;
+ sum_loop += tot;
+ if (tot > max_loop)
+ max_loop = tot;
+
for(Uint32 i = 0; i<chunk.pageCount; i++){
PagePtr pagePtr;
pagePtr.i = chunk.pageId + i;
@@ -225,6 +254,10 @@ Dbtup::execDUMP_STATE_ORD(Signal* signal)
returnCommonArea(chunk.pageId, chunk.pageCount);
chunks.erase(chunks.size() - 1);
}
+
+ ndbout_c("Got %u%% of requested allocs, loops : %u 100*avg: %u max: %u",
+ (100 * sum_conf) / sum_req, sum_loop, 100*sum_loop / LOOPS,
+ max_loop);
}
#endif
}//Dbtup::execDUMP_STATE_ORD()
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
index a9f0083a2b6..74c7d38bd64 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
@@ -305,6 +305,12 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal)
Uint32 noOfTriggers= 0;
Uint32 tmp= 0;
+
+ if (ndb_mgm_get_int_parameter(p, CFG_DB_MAX_ALLOCATE, &tmp))
+ tmp = 32 * 1024 * 1024;
+ m_max_allocate_pages = (tmp + GLOBAL_PAGE_SIZE - 1) / GLOBAL_PAGE_SIZE;
+
+ tmp = 0;
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE_RANGE, &tmp));
initPageRangeSize(tmp);
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_TABLE, &cnoOfTablerec));
@@ -338,6 +344,18 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal)
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_BATCH_SIZE, &nScanBatch));
c_scanLockPool.setSize(nScanOp * nScanBatch);
+
+ /* read ahead for disk scan can not be more that disk page buffer */
+ {
+ Uint64 tmp = 64*1024*1024;
+ ndb_mgm_get_int64_parameter(p, CFG_DB_DISK_PAGE_BUFFER_MEMORY, &tmp);
+ m_max_page_read_ahead = (tmp + GLOBAL_PAGE_SIZE - 1) / GLOBAL_PAGE_SIZE; // in pages
+ // never read ahead more than 32 pages
+ if (m_max_page_read_ahead > 32)
+ m_max_page_read_ahead = 32;
+ }
+
+
ScanOpPtr lcp;
ndbrequire(c_scanOpPool.seize(lcp));
new (lcp.p) ScanOp();
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp
index d10fabf42da..24806062fcf 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp
@@ -146,10 +146,17 @@ void Dbtup::initializePage()
cnoOfAllocatedPages = tmp; // Is updated by returnCommonArea
}//Dbtup::initializePage()
+#ifdef VM_TRACE
+Uint32 fc_left, fc_right, fc_remove;
+#endif
+
void Dbtup::allocConsPages(Uint32 noOfPagesToAllocate,
Uint32& noOfPagesAllocated,
Uint32& allocPageRef)
{
+#ifdef VM_TRACE
+ fc_left = fc_right = fc_remove = 0;
+#endif
if (noOfPagesToAllocate == 0){
jam();
noOfPagesAllocated = 0;
@@ -228,7 +235,10 @@ void Dbtup::findFreeLeftNeighbours(Uint32& allocPageRef,
{
PagePtr pageFirstPtr, pageLastPtr;
Uint32 remainAllocate = noOfPagesToAllocate - noPagesAllocated;
- while (allocPageRef > 0) {
+ Uint32 loop = 0;
+ while (allocPageRef > 0 &&
+ ++loop < 16)
+ {
jam();
pageLastPtr.i = allocPageRef - 1;
c_page_pool.getPtr(pageLastPtr);
@@ -256,6 +266,9 @@ void Dbtup::findFreeLeftNeighbours(Uint32& allocPageRef,
remainAllocate -= listSize;
}//if
}//if
+#ifdef VM_TRACE
+ fc_left++;
+#endif
}//while
}//Dbtup::findFreeLeftNeighbours()
@@ -269,7 +282,10 @@ void Dbtup::findFreeRightNeighbours(Uint32& allocPageRef,
jam();
return;
}//if
- while ((allocPageRef + noPagesAllocated) < c_page_pool.getSize()) {
+ Uint32 loop = 0;
+ while ((allocPageRef + noPagesAllocated) < c_page_pool.getSize() &&
+ ++loop < 16)
+ {
jam();
pageFirstPtr.i = allocPageRef + noPagesAllocated;
c_page_pool.getPtr(pageFirstPtr);
@@ -296,24 +312,37 @@ void Dbtup::findFreeRightNeighbours(Uint32& allocPageRef,
remainAllocate -= listSize;
}//if
}//if
+#ifdef VM_TRACE
+ fc_right++;
+#endif
}//while
}//Dbtup::findFreeRightNeighbours()
void Dbtup::insertCommonArea(Uint32 insPageRef, Uint32 insList)
{
cnoOfAllocatedPages -= (1 << insList);
- PagePtr pageLastPtr, pageInsPtr;
+ PagePtr pageLastPtr, pageInsPtr, pageHeadPtr;
+ pageHeadPtr.i = cfreepageList[insList];
c_page_pool.getPtr(pageInsPtr, insPageRef);
ndbrequire(insList < 16);
pageLastPtr.i = (pageInsPtr.i + (1 << insList)) - 1;
- pageInsPtr.p->next_cluster_page = cfreepageList[insList];
+ pageInsPtr.p->page_state = ZFREE_COMMON;
+ pageInsPtr.p->next_cluster_page = pageHeadPtr.i;
pageInsPtr.p->prev_cluster_page = RNIL;
pageInsPtr.p->last_cluster_page = pageLastPtr.i;
cfreepageList[insList] = pageInsPtr.i;
+ if (pageHeadPtr.i != RNIL)
+ {
+ jam();
+ c_page_pool.getPtr(pageHeadPtr);
+ pageHeadPtr.p->prev_cluster_page = pageInsPtr.i;
+ }
+
c_page_pool.getPtr(pageLastPtr);
+ pageLastPtr.p->page_state = ZFREE_COMMON;
pageLastPtr.p->first_cluster_page = pageInsPtr.i;
pageLastPtr.p->next_page = RNIL;
}//Dbtup::insertCommonArea()
@@ -321,12 +350,13 @@ void Dbtup::insertCommonArea(Uint32 insPageRef, Uint32 insList)
void Dbtup::removeCommonArea(Uint32 remPageRef, Uint32 list)
{
cnoOfAllocatedPages += (1 << list);
- PagePtr pagePrevPtr, pageNextPtr, pageLastPtr, pageSearchPtr, remPagePtr;
+ PagePtr pagePrevPtr, pageNextPtr, pageLastPtr, remPagePtr;
c_page_pool.getPtr(remPagePtr, remPageRef);
ndbrequire(list < 16);
if (cfreepageList[list] == remPagePtr.i) {
jam();
+ ndbassert(remPagePtr.p->prev_cluster_page == RNIL);
cfreepageList[list] = remPagePtr.p->next_cluster_page;
pageNextPtr.i = cfreepageList[list];
if (pageNextPtr.i != RNIL) {
@@ -335,30 +365,25 @@ void Dbtup::removeCommonArea(Uint32 remPageRef, Uint32 list)
pageNextPtr.p->prev_cluster_page = RNIL;
}//if
} else {
- pageSearchPtr.i = cfreepageList[list];
- while (true) {
- jam();
- c_page_pool.getPtr(pageSearchPtr);
- pagePrevPtr = pageSearchPtr;
- pageSearchPtr.i = pageSearchPtr.p->next_cluster_page;
- if (pageSearchPtr.i == remPagePtr.i) {
- jam();
- break;
- }//if
- }//while
+ pagePrevPtr.i = remPagePtr.p->prev_cluster_page;
pageNextPtr.i = remPagePtr.p->next_cluster_page;
+ c_page_pool.getPtr(pagePrevPtr);
pagePrevPtr.p->next_cluster_page = pageNextPtr.i;
- if (pageNextPtr.i != RNIL) {
+ if (pageNextPtr.i != RNIL)
+ {
jam();
c_page_pool.getPtr(pageNextPtr);
pageNextPtr.p->prev_cluster_page = pagePrevPtr.i;
- }//if
+ }
}//if
remPagePtr.p->next_cluster_page= RNIL;
remPagePtr.p->last_cluster_page= RNIL;
remPagePtr.p->prev_cluster_page= RNIL;
+ remPagePtr.p->page_state = ~ZFREE_COMMON;
pageLastPtr.i = (remPagePtr.i + (1 << list)) - 1;
c_page_pool.getPtr(pageLastPtr);
pageLastPtr.p->first_cluster_page= RNIL;
+ pageLastPtr.p->page_state = ~ZFREE_COMMON;
+
}//Dbtup::removeCommonArea()
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp
index 6ef8d3585e9..cde63091cfb 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp
@@ -432,6 +432,11 @@ void Dbtup::allocMoreFragPages(Fragrecord* const regFragPtr)
// We will grow by 18.75% plus two more additional pages to grow
// a little bit quicker in the beginning.
/* -----------------------------------------------------------------*/
+
+ if (noAllocPages > m_max_allocate_pages)
+ {
+ noAllocPages = m_max_allocate_pages;
+ }
Uint32 allocated = allocFragPages(regFragPtr, noAllocPages);
regFragPtr->noOfPagesToGrow += allocated;
}//Dbtup::allocMoreFragPages()
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp
index 948cd77b437..6e53531e118 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp
@@ -687,13 +687,74 @@ Dbtup::scanNext(Signal* signal, ScanOpPtr scanPtr)
// move to next extent
jam();
pos.m_extent_info_ptr_i = ext_ptr.i;
- Extent_info* ext = c_extent_pool.getPtr(pos.m_extent_info_ptr_i);
+ ext = c_extent_pool.getPtr(pos.m_extent_info_ptr_i);
key.m_file_no = ext->m_key.m_file_no;
key.m_page_no = ext->m_first_page_no;
}
}
key.m_page_idx = 0;
pos.m_get = ScanPos::Get_page_dd;
+ /*
+ read ahead for scan in disk order
+ do read ahead every 8:th page
+ */
+ if ((bits & ScanOp::SCAN_DD) &&
+ (((key.m_page_no - ext->m_first_page_no) & 7) == 0))
+ {
+ jam();
+ // initialize PGMAN request
+ Page_cache_client::Request preq;
+ preq.m_page = pos.m_key;
+ preq.m_callback = TheNULLCallback;
+
+ // set maximum read ahead
+ Uint32 read_ahead = m_max_page_read_ahead;
+
+ while (true)
+ {
+ // prepare page read ahead in current extent
+ Uint32 page_no = preq.m_page.m_page_no;
+ Uint32 page_no_limit = page_no + read_ahead;
+ Uint32 limit = ext->m_first_page_no + alloc.m_extent_size;
+ if (page_no_limit > limit)
+ {
+ jam();
+ // read ahead crosses extent, set limit for this extent
+ read_ahead = page_no_limit - limit;
+ page_no_limit = limit;
+ // and make sure we only read one extra extent next time around
+ if (read_ahead > alloc.m_extent_size)
+ read_ahead = alloc.m_extent_size;
+ }
+ else
+ {
+ jam();
+ read_ahead = 0; // no more to read ahead after this
+ }
+ // do read ahead pages for this extent
+ while (page_no < page_no_limit)
+ {
+ // page request to PGMAN
+ jam();
+ preq.m_page.m_page_no = page_no;
+ int flags = 0;
+ // ignore result
+ m_pgman.get_page(signal, preq, flags);
+ jamEntry();
+ page_no++;
+ }
+ if (!read_ahead || !list.next(ext_ptr))
+ {
+ // no more extents after this or read ahead done
+ jam();
+ break;
+ }
+ // move to next extent and initialize PGMAN request accordingly
+ Extent_info* ext = c_extent_pool.getPtr(ext_ptr.i);
+ preq.m_page.m_file_no = ext->m_key.m_file_no;
+ preq.m_page.m_page_no = ext->m_first_page_no;
+ }
+ } // if ScanOp::SCAN_DD read ahead
}
/*FALLTHRU*/
case ScanPos::Get_page_dd:
@@ -726,6 +787,7 @@ Dbtup::scanNext(Signal* signal, ScanOpPtr scanPtr)
safe_cast(&Dbtup::disk_page_tup_scan_callback);
int flags = 0;
int res = m_pgman.get_page(signal, preq, flags);
+ jamEntry();
if (res == 0) {
jam();
// request queued
diff --git a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
index adc6d1e3ed4..56ecc8ddc39 100644
--- a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
@@ -277,6 +277,14 @@ void Ndbcntr::execSTTOR(Signal* signal)
break;
case ZSTART_PHASE_1:
jam();
+ {
+ Uint32 db_watchdog_interval = 0;
+ const ndb_mgm_configuration_iterator * p =
+ m_ctx.m_config.getOwnConfigIterator();
+ ndb_mgm_get_int_parameter(p, CFG_DB_WATCHDOG_INTERVAL, &db_watchdog_interval);
+ ndbrequire(db_watchdog_interval);
+ update_watch_dog_timer(db_watchdog_interval);
+ }
startPhase1Lab(signal);
break;
case ZSTART_PHASE_2:
@@ -1410,6 +1418,13 @@ void Ndbcntr::execNODE_FAILREP(Signal* signal)
{
jamEntry();
+ if (ERROR_INSERTED(1001))
+ {
+ sendSignalWithDelay(reference(), GSN_NODE_FAILREP, signal, 100,
+ signal->getLength());
+ return;
+ }
+
const NodeFailRep * nodeFail = (NodeFailRep *)&signal->theData[0];
NdbNodeBitmask allFailed;
allFailed.assign(NdbNodeBitmask::Size, nodeFail->theNodes);
@@ -2734,16 +2749,34 @@ void Ndbcntr::execSTART_ORD(Signal* signal){
c_missra.execSTART_ORD(signal);
}
+#define CLEAR_DX 13
+#define CLEAR_LCP 3
+
void
-Ndbcntr::clearFilesystem(Signal* signal){
+Ndbcntr::clearFilesystem(Signal* signal)
+{
+ const Uint32 lcp = c_fsRemoveCount >= CLEAR_DX;
+
FsRemoveReq * req = (FsRemoveReq *)signal->getDataPtrSend();
req->userReference = reference();
req->userPointer = 0;
req->directory = 1;
req->ownDirectory = 1;
- FsOpenReq::setVersion(req->fileNumber, 3);
- FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_CTL); // Can by any...
- FsOpenReq::v1_setDisk(req->fileNumber, c_fsRemoveCount);
+
+ if (lcp == 0)
+ {
+ FsOpenReq::setVersion(req->fileNumber, 3);
+ FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_CTL); // Can by any...
+ FsOpenReq::v1_setDisk(req->fileNumber, c_fsRemoveCount);
+ }
+ else
+ {
+ FsOpenReq::setVersion(req->fileNumber, 5);
+ FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_DATA);
+ FsOpenReq::v5_setLcpNo(req->fileNumber, c_fsRemoveCount - CLEAR_DX);
+ FsOpenReq::v5_setTableId(req->fileNumber, 0);
+ FsOpenReq::v5_setFragmentId(req->fileNumber, 0);
+ }
sendSignal(NDBFS_REF, GSN_FSREMOVEREQ, signal,
FsRemoveReq::SignalLength, JBA);
c_fsRemoveCount++;
@@ -2752,12 +2785,12 @@ Ndbcntr::clearFilesystem(Signal* signal){
void
Ndbcntr::execFSREMOVECONF(Signal* signal){
jamEntry();
- if(c_fsRemoveCount == 13){
+ if(c_fsRemoveCount == CLEAR_DX + CLEAR_LCP){
jam();
sendSttorry(signal);
} else {
jam();
- ndbrequire(c_fsRemoveCount < 13);
+ ndbrequire(c_fsRemoveCount < CLEAR_DX + CLEAR_LCP);
clearFilesystem(signal);
}//if
}
diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
index 5f93ee31bc7..cf18bf34040 100644
--- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
@@ -163,7 +163,12 @@ AsyncFile::run()
theStartFlag = true;
// Create write buffer for bigger writes
theWriteBufferSize = WRITEBUFFERSIZE;
- theWriteBuffer = (char *) ndbd_malloc(theWriteBufferSize);
+ theWriteBufferUnaligned = (char *) ndbd_malloc(theWriteBufferSize +
+ NDB_O_DIRECT_WRITE_ALIGNMENT-1);
+ theWriteBuffer = (char *)
+ (((UintPtr)theWriteBufferUnaligned + NDB_O_DIRECT_WRITE_ALIGNMENT - 1) &
+ ~(UintPtr)(NDB_O_DIRECT_WRITE_ALIGNMENT - 1));
+
NdbMutex_Unlock(theStartMutexPtr);
NdbCondition_Signal(theStartConditionPtr);
@@ -247,6 +252,78 @@ AsyncFile::run()
static char g_odirect_readbuf[2*GLOBAL_PAGE_SIZE -1];
#endif
+int
+AsyncFile::check_odirect_write(Uint32 flags, int& new_flags, int mode)
+{
+ assert(new_flags & (O_CREAT | O_TRUNC));
+#ifdef O_DIRECT
+ int ret;
+ char * bufptr = (char*)((UintPtr(g_odirect_readbuf)+(GLOBAL_PAGE_SIZE - 1)) & ~(GLOBAL_PAGE_SIZE - 1));
+ while (((ret = ::write(theFd, bufptr, GLOBAL_PAGE_SIZE)) == -1) &&
+ (errno == EINTR));
+ if (ret == -1)
+ {
+ new_flags &= ~O_DIRECT;
+ ndbout_c("%s Failed to write using O_DIRECT, disabling",
+ theFileName.c_str());
+ }
+
+ close(theFd);
+ theFd = ::open(theFileName.c_str(), new_flags, mode);
+ if (theFd == -1)
+ return errno;
+#endif
+
+ return 0;
+}
+
+int
+AsyncFile::check_odirect_read(Uint32 flags, int &new_flags, int mode)
+{
+#ifdef O_DIRECT
+ int ret;
+ char * bufptr = (char*)((UintPtr(g_odirect_readbuf)+(GLOBAL_PAGE_SIZE - 1)) & ~(GLOBAL_PAGE_SIZE - 1));
+ while (((ret = ::read(theFd, bufptr, GLOBAL_PAGE_SIZE)) == -1) &&
+ (errno == EINTR));
+ if (ret == -1)
+ {
+ ndbout_c("%s Failed to read using O_DIRECT, disabling",
+ theFileName.c_str());
+ goto reopen;
+ }
+
+ if(lseek(theFd, 0, SEEK_SET) != 0)
+ {
+ return errno;
+ }
+
+ if ((flags & FsOpenReq::OM_CHECK_SIZE) == 0)
+ {
+ struct stat buf;
+ if ((fstat(theFd, &buf) == -1))
+ {
+ return errno;
+ }
+ else if ((buf.st_size % GLOBAL_PAGE_SIZE) != 0)
+ {
+ ndbout_c("%s filesize not a multiple of %d, disabling O_DIRECT",
+ theFileName.c_str(), GLOBAL_PAGE_SIZE);
+ goto reopen;
+ }
+ }
+
+ return 0;
+
+reopen:
+ close(theFd);
+ new_flags &= ~O_DIRECT;
+ theFd = ::open(theFileName.c_str(), new_flags, mode);
+ if (theFd == -1)
+ return errno;
+#endif
+ return 0;
+}
+
void AsyncFile::openReq(Request* request)
{
m_auto_sync_freq = 0;
@@ -312,7 +389,7 @@ void AsyncFile::openReq(Request* request)
}
#else
Uint32 flags = request->par.open.flags;
- Uint32 new_flags = 0;
+ int new_flags = 0;
// Convert file open flags from Solaris to Liux
if (flags & FsOpenReq::OM_CREATE)
@@ -343,10 +420,6 @@ void AsyncFile::openReq(Request* request)
{
new_flags |= O_DIRECT;
}
-#elif defined O_SYNC
- {
- flags |= FsOpenReq::OM_SYNC;
- }
#endif
if ((flags & FsOpenReq::OM_SYNC) && ! (flags & FsOpenReq::OM_INIT))
@@ -355,15 +428,19 @@ void AsyncFile::openReq(Request* request)
new_flags |= O_SYNC;
#endif
}
-
+
+ const char * rw = "";
switch(flags & 0x3){
case FsOpenReq::OM_READONLY:
+ rw = "r";
new_flags |= O_RDONLY;
break;
case FsOpenReq::OM_WRITEONLY:
+ rw = "w";
new_flags |= O_WRONLY;
break;
case FsOpenReq::OM_READWRITE:
+ rw = "rw";
new_flags |= O_RDWR;
break;
default:
@@ -404,11 +481,6 @@ no_odirect:
if (new_flags & O_DIRECT)
{
new_flags &= ~O_DIRECT;
- flags |= FsOpenReq::OM_SYNC;
-#ifdef O_SYNC
- if (! (flags & FsOpenReq::OM_INIT))
- new_flags |= O_SYNC;
-#endif
goto no_odirect;
}
#endif
@@ -421,11 +493,6 @@ no_odirect:
else if (new_flags & O_DIRECT)
{
new_flags &= ~O_DIRECT;
- flags |= FsOpenReq::OM_SYNC;
-#ifdef O_SYNC
- if (! (flags & FsOpenReq::OM_INIT))
- new_flags |= O_SYNC;
-#endif
goto no_odirect;
}
#endif
@@ -512,7 +579,6 @@ no_odirect:
{
ndbout_c("error on first write(%d), disable O_DIRECT", err);
new_flags &= ~O_DIRECT;
- flags |= FsOpenReq::OM_SYNC;
close(theFd);
theFd = ::open(theFileName.c_str(), new_flags, mode);
if (theFd != -1)
@@ -532,26 +598,32 @@ no_odirect:
else if (flags & FsOpenReq::OM_DIRECT)
{
#ifdef O_DIRECT
- do {
- int ret;
- char * bufptr = (char*)((UintPtr(g_odirect_readbuf)+(GLOBAL_PAGE_SIZE - 1)) & ~(GLOBAL_PAGE_SIZE - 1));
- while (((ret = ::read(theFd, bufptr, GLOBAL_PAGE_SIZE)) == -1) && (errno == EINTR));
- if (ret == -1)
- {
- ndbout_c("%s Failed to read using O_DIRECT, disabling", theFileName.c_str());
- flags |= FsOpenReq::OM_SYNC;
- flags |= FsOpenReq::OM_INIT;
- break;
- }
- if(lseek(theFd, 0, SEEK_SET) != 0)
- {
- request->error = errno;
- return;
- }
- } while (0);
+ if (flags & (FsOpenReq::OM_TRUNCATE | FsOpenReq::OM_CREATE))
+ {
+ request->error = check_odirect_write(flags, new_flags, mode);
+ }
+ else
+ {
+ request->error = check_odirect_read(flags, new_flags, mode);
+ }
+
+ if (request->error)
+ return;
#endif
}
-
+#ifdef VM_TRACE
+ if (flags & FsOpenReq::OM_DIRECT)
+ {
+#ifdef O_DIRECT
+ ndbout_c("%s %s O_DIRECT: %d",
+ theFileName.c_str(), rw,
+ !!(new_flags & O_DIRECT));
+#else
+ ndbout_c("%s %s O_DIRECT: 0",
+ theFileName.c_str(), rw);
+#endif
+ }
+#endif
if ((flags & FsOpenReq::OM_SYNC) && (flags & FsOpenReq::OM_INIT))
{
#ifdef O_SYNC
@@ -562,6 +634,10 @@ no_odirect:
new_flags &= ~(O_CREAT | O_TRUNC);
new_flags |= O_SYNC;
theFd = ::open(theFileName.c_str(), new_flags, mode);
+ if (theFd == -1)
+ {
+ request->error = errno;
+ }
#endif
}
#endif
@@ -1079,7 +1155,8 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){
void AsyncFile::endReq()
{
// Thread is ended with return
- if (theWriteBuffer) ndbd_free(theWriteBuffer, theWriteBufferSize);
+ if (theWriteBufferUnaligned)
+ ndbd_free(theWriteBufferUnaligned, theWriteBufferSize);
}
diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
index cc667225ce2..d8d585c47f7 100644
--- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
+++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
@@ -234,9 +234,13 @@ private:
bool theStartFlag;
int theWriteBufferSize;
char* theWriteBuffer;
+ void* theWriteBufferUnaligned;
size_t m_write_wo_sync; // Writes wo/ sync
size_t m_auto_sync_freq; // Auto sync freq in bytes
+
+ int check_odirect_read(Uint32 flags, int&new_flags, int mode);
+ int check_odirect_write(Uint32 flags, int&new_flags, int mode);
public:
SimulatedBlock& m_fs;
Ptr<GlobalPage> m_page_ptr;
diff --git a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
index 44f8a8ab05b..26bf8878852 100644
--- a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
@@ -652,7 +652,7 @@ AsyncFile*
Ndbfs::createAsyncFile(){
// Check limit of open files
- if (m_maxFiles !=0 && theFiles.size()+1 == m_maxFiles) {
+ if (m_maxFiles !=0 && theFiles.size() == m_maxFiles) {
// Print info about all open files
for (unsigned i = 0; i < theFiles.size(); i++){
AsyncFile* file = theFiles[i];
diff --git a/storage/ndb/src/kernel/blocks/pgman.cpp b/storage/ndb/src/kernel/blocks/pgman.cpp
index 57563d3c6d4..006673cf011 100644
--- a/storage/ndb/src/kernel/blocks/pgman.cpp
+++ b/storage/ndb/src/kernel/blocks/pgman.cpp
@@ -122,9 +122,9 @@ Pgman::execREAD_CONFIG_REQ(Signal* signal)
if (page_buffer > 0)
{
- page_buffer /= GLOBAL_PAGE_SIZE; // in pages
- m_page_entry_pool.setSize(100*page_buffer);
+ page_buffer = (page_buffer + GLOBAL_PAGE_SIZE - 1) / GLOBAL_PAGE_SIZE; // in pages
m_param.m_max_pages = page_buffer;
+ m_page_entry_pool.setSize(m_param.m_lirs_stack_mult * page_buffer);
m_param.m_max_hot_pages = (page_buffer * 9) / 10;
}
@@ -141,9 +141,10 @@ Pgman::execREAD_CONFIG_REQ(Signal* signal)
Pgman::Param::Param() :
m_max_pages(64), // smallish for testing
+ m_lirs_stack_mult(10),
m_max_hot_pages(56),
m_max_loop_count(256),
- m_max_io_waits(64),
+ m_max_io_waits(256),
m_stats_loop_delay(1000),
m_cleanup_loop_delay(200),
m_lcp_loop_delay(0)
@@ -301,6 +302,9 @@ Pgman::get_sublist_no(Page_state state)
{
return Page_entry::SL_LOCKED;
}
+ if (state == Page_entry::ONSTACK) {
+ return Page_entry::SL_IDLE;
+ }
return Page_entry::SL_OTHER;
}
@@ -415,15 +419,55 @@ Pgman::get_page_entry(Ptr<Page_entry>& ptr, Uint32 file_no, Uint32 page_no)
{
if (find_page_entry(ptr, file_no, page_no))
{
+ jam();
ndbrequire(ptr.p->m_state != 0);
m_stats.m_page_hits++;
+
+#ifdef VM_TRACE
+ debugOut << "PGMAN: get_page_entry: found" << endl;
+ debugOut << "PGMAN: " << ptr << endl;
+#endif
return true;
}
+ if (m_page_entry_pool.getNoOfFree() == 0)
+ {
+ jam();
+ Page_sublist& pl_idle = *m_page_sublist[Page_entry::SL_IDLE];
+ Ptr<Page_entry> idle_ptr;
+ if (pl_idle.first(idle_ptr))
+ {
+ jam();
+
+#ifdef VM_TRACE
+ debugOut << "PGMAN: get_page_entry: re-use idle entry" << endl;
+ debugOut << "PGMAN: " << idle_ptr << endl;
+#endif
+
+ Page_state state = idle_ptr.p->m_state;
+ ndbrequire(state == Page_entry::ONSTACK);
+
+ Page_stack& pl_stack = m_page_stack;
+ ndbrequire(pl_stack.hasPrev(idle_ptr));
+ pl_stack.remove(idle_ptr);
+ state &= ~ Page_entry::ONSTACK;
+ set_page_state(idle_ptr, state);
+ ndbrequire(idle_ptr.p->m_state == 0);
+
+ release_page_entry(idle_ptr);
+ }
+ }
+
if (seize_page_entry(ptr, file_no, page_no))
{
+ jam();
ndbrequire(ptr.p->m_state == 0);
m_stats.m_page_faults++;
+
+#ifdef VM_TRACE
+ debugOut << "PGMAN: get_page_entry: seize" << endl;
+ debugOut << "PGMAN: " << ptr << endl;
+#endif
return true;
}
@@ -624,6 +668,7 @@ Pgman::lirs_reference(Ptr<Page_entry> ptr)
jam();
move_cleanup_ptr(ptr);
pl_queue.remove(ptr);
+ state &= ~ Page_entry::ONQUEUE;
}
if (state & Page_entry::BOUND)
{
@@ -654,6 +699,12 @@ Pgman::lirs_reference(Ptr<Page_entry> ptr)
pl_stack.add(ptr);
state |= Page_entry::ONSTACK;
state |= Page_entry::HOT;
+ // it could be on queue already
+ if (state & Page_entry::ONQUEUE) {
+ jam();
+ pl_queue.remove(ptr);
+ state &= ~Page_entry::ONQUEUE;
+ }
}
set_page_state(ptr, state);
@@ -902,9 +953,11 @@ Pgman::process_map(Signal* signal)
#ifdef VM_TRACE
debugOut << "PGMAN: >process_map" << endl;
#endif
- int max_count = m_param.m_max_io_waits - m_stats.m_current_io_waits;
- if (max_count > 0)
+ int max_count = 0;
+ if (m_param.m_max_io_waits > m_stats.m_current_io_waits) {
+ max_count = m_param.m_max_io_waits - m_stats.m_current_io_waits;
max_count = max_count / 2 + 1;
+ }
Page_sublist& pl_map = *m_page_sublist[Page_entry::SL_MAP];
while (! pl_map.isEmpty() && --max_count >= 0)
@@ -1056,15 +1109,10 @@ Pgman::process_cleanup(Signal* signal)
}
int max_loop_count = m_param.m_max_loop_count;
- int max_count = m_param.m_max_io_waits - m_stats.m_current_io_waits;
-
- if (max_count > 0)
- {
+ int max_count = 0;
+ if (m_param.m_max_io_waits > m_stats.m_current_io_waits) {
+ max_count = m_param.m_max_io_waits - m_stats.m_current_io_waits;
max_count = max_count / 2 + 1;
- /*
- * Possibly add code here to avoid writing too rapidly. May be
- * unnecessary since only cold pages are cleaned.
- */
}
Ptr<Page_entry> ptr = m_cleanup_ptr;
@@ -1166,9 +1214,12 @@ bool
Pgman::process_lcp(Signal* signal)
{
Page_hashlist& pl_hash = m_page_hashlist;
- int max_count = m_param.m_max_io_waits - m_stats.m_current_io_waits;
- if (max_count > 0)
+
+ int max_count = 0;
+ if (m_param.m_max_io_waits > m_stats.m_current_io_waits) {
+ max_count = m_param.m_max_io_waits - m_stats.m_current_io_waits;
max_count = max_count / 2 + 1;
+ }
#ifdef VM_TRACE
debugOut
@@ -1927,6 +1978,8 @@ Pgman::verify_page_entry(Ptr<Page_entry> ptr)
break;
case Page_entry::SL_LOCKED:
break;
+ case Page_entry::SL_IDLE:
+ break;
case Page_entry::SL_OTHER:
break;
default:
@@ -1973,8 +2026,11 @@ Pgman::verify_page_lists()
ndbrequire(stack_count == pl_stack.count() || dump_page_lists());
ndbrequire(queue_count == pl_queue.count() || dump_page_lists());
+ Uint32 hot_count = 0;
Uint32 hot_bound_count = 0;
Uint32 cold_bound_count = 0;
+ Uint32 stack_request_count = 0;
+ Uint32 queue_request_count = 0;
Uint32 i1 = RNIL;
for (pl_stack.first(ptr); ptr.i != RNIL; pl_stack.next(ptr))
@@ -1985,9 +2041,13 @@ Pgman::verify_page_lists()
ndbrequire(state & Page_entry::ONSTACK || dump_page_lists());
if (! pl_stack.hasPrev(ptr))
ndbrequire(state & Page_entry::HOT || dump_page_lists());
- if (state & Page_entry::HOT &&
- state & Page_entry::BOUND)
- hot_bound_count++;
+ if (state & Page_entry::HOT) {
+ hot_count++;
+ if (state & Page_entry::BOUND)
+ hot_bound_count++;
+ }
+ if (state & Page_entry::REQUEST)
+ stack_request_count++;
}
Uint32 i2 = RNIL;
@@ -1999,6 +2059,8 @@ Pgman::verify_page_lists()
ndbrequire(state & Page_entry::ONQUEUE || dump_page_lists());
ndbrequire(state & Page_entry::BOUND || dump_page_lists());
cold_bound_count++;
+ if (state & Page_entry::REQUEST)
+ queue_request_count++;
}
Uint32 tot_bound_count =
@@ -2031,7 +2093,11 @@ Pgman::verify_page_lists()
<< " cache:" << m_stats.m_num_pages
<< "(" << locked_bound_count << "L)"
<< " stack:" << pl_stack.count()
+ << " hot:" << hot_count
+ << " hot_bound:" << hot_bound_count
+ << " stack_request:" << stack_request_count
<< " queue:" << pl_queue.count()
+ << " queue_request:" << queue_request_count
<< " queuewait:" << queuewait_count << endl;
debugOut << "PGMAN:";
@@ -2139,6 +2205,8 @@ Pgman::get_sublist_name(Uint32 list_no)
return "busy";
case Page_entry::SL_LOCKED:
return "locked";
+ case Page_entry::SL_IDLE:
+ return "idle";
case Page_entry::SL_OTHER:
return "other";
}
diff --git a/storage/ndb/src/kernel/blocks/pgman.hpp b/storage/ndb/src/kernel/blocks/pgman.hpp
index 07029d1c3e5..e3bf0fa5780 100644
--- a/storage/ndb/src/kernel/blocks/pgman.hpp
+++ b/storage/ndb/src/kernel/blocks/pgman.hpp
@@ -325,8 +325,9 @@ private:
,SL_CALLBACK_IO = 4
,SL_BUSY = 5
,SL_LOCKED = 6
- ,SL_OTHER = 7
- ,SUBLIST_COUNT = 8
+ ,SL_IDLE = 7
+ ,SL_OTHER = 8
+ ,SUBLIST_COUNT = 9
};
Uint16 m_file_no; // disk page address set at seize
@@ -401,6 +402,7 @@ private:
struct Param {
Param();
Uint32 m_max_pages; // max number of cache pages
+ Uint32 m_lirs_stack_mult; // in m_max_pages (around 3-10)
Uint32 m_max_hot_pages; // max hot cache pages (up to 99%)
Uint32 m_max_loop_count; // limit purely local loops
Uint32 m_max_io_waits;
diff --git a/storage/ndb/src/kernel/blocks/restore.cpp b/storage/ndb/src/kernel/blocks/restore.cpp
index d4a2414ef2f..2d40cd79daa 100644
--- a/storage/ndb/src/kernel/blocks/restore.cpp
+++ b/storage/ndb/src/kernel/blocks/restore.cpp
@@ -557,6 +557,9 @@ Restore::restore_next(Signal* signal, FilePtr file_ptr)
case BackupFormat::GCP_ENTRY:
parse_gcp_entry(signal, file_ptr, data, len);
break;
+ case BackupFormat::EMPTY_ENTRY:
+ // skip
+ break;
case 0x4e444242: // 'NDBB'
if (check_file_version(signal, ntohl(* (data+2))) == 0)
{
diff --git a/storage/ndb/src/kernel/vm/Configuration.cpp b/storage/ndb/src/kernel/vm/Configuration.cpp
index e0b485eda59..72770d35cde 100644
--- a/storage/ndb/src/kernel/vm/Configuration.cpp
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp
@@ -74,35 +74,35 @@ static struct my_option my_long_options[] =
{ "initial", OPT_INITIAL,
"Perform initial start of ndbd, including cleaning the file system. "
"Consult documentation before using this",
- (gptr*) &_initial, (gptr*) &_initial, 0,
+ (uchar**) &_initial, (uchar**) &_initial, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "nostart", 'n',
"Don't start ndbd immediately. Ndbd will await command from ndb_mgmd",
- (gptr*) &_no_start, (gptr*) &_no_start, 0,
+ (uchar**) &_no_start, (uchar**) &_no_start, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "daemon", 'd', "Start ndbd as daemon (default)",
- (gptr*) &_daemon, (gptr*) &_daemon, 0,
+ (uchar**) &_daemon, (uchar**) &_daemon, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
{ "nodaemon", OPT_NODAEMON,
"Do not start ndbd as daemon, provided for testing purposes",
- (gptr*) &_no_daemon, (gptr*) &_no_daemon, 0,
+ (uchar**) &_no_daemon, (uchar**) &_no_daemon, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "foreground", OPT_FOREGROUND,
"Run real ndbd in foreground, provided for debugging purposes"
" (implies --nodaemon)",
- (gptr*) &_foreground, (gptr*) &_foreground, 0,
+ (uchar**) &_foreground, (uchar**) &_foreground, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "nowait-nodes", OPT_NOWAIT_NODES,
"Nodes that will not be waited for during start",
- (gptr*) &_nowait_nodes, (gptr*) &_nowait_nodes, 0,
+ (uchar**) &_nowait_nodes, (uchar**) &_nowait_nodes, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "initial-start", OPT_INITIAL_START,
"Perform initial start",
- (gptr*) &_initialstart, (gptr*) &_initialstart, 0,
+ (uchar**) &_initialstart, (uchar**) &_initialstart, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "bind-address", OPT_NOWAIT_NODES,
"Local bind address",
- (gptr*) &_bind_address, (gptr*) &_bind_address, 0,
+ (uchar**) &_bind_address, (uchar**) &_bind_address, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -443,6 +443,11 @@ Configuration::setupConfiguration(){
"TimeBetweenWatchDogCheck missing");
}
+ if(iter.get(CFG_DB_WATCHDOG_INTERVAL_INITIAL, &_timeBetweenWatchDogCheckInitial)){
+ ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
+ "TimeBetweenWatchDogCheckInitial missing");
+ }
+
/**
* Get paths
*/
@@ -462,9 +467,12 @@ Configuration::setupConfiguration(){
* Create the watch dog thread
*/
{
- Uint32 t = _timeBetweenWatchDogCheck;
+ if (_timeBetweenWatchDogCheckInitial < _timeBetweenWatchDogCheck)
+ _timeBetweenWatchDogCheckInitial = _timeBetweenWatchDogCheck;
+
+ Uint32 t = _timeBetweenWatchDogCheckInitial;
t = globalEmulatorData.theWatchDog ->setCheckInterval(t);
- _timeBetweenWatchDogCheck = t;
+ _timeBetweenWatchDogCheckInitial = t;
}
ConfigValues* cf = ConfigValuesFactory::extractCurrentSection(iter.m_config);
diff --git a/storage/ndb/src/kernel/vm/Configuration.hpp b/storage/ndb/src/kernel/vm/Configuration.hpp
index 934261e40af..918a889a171 100644
--- a/storage/ndb/src/kernel/vm/Configuration.hpp
+++ b/storage/ndb/src/kernel/vm/Configuration.hpp
@@ -84,6 +84,7 @@ private:
Uint32 _maxErrorLogs;
Uint32 _lockPagesInMainMemory;
Uint32 _timeBetweenWatchDogCheck;
+ Uint32 _timeBetweenWatchDogCheckInitial;
ndb_mgm_configuration * m_ownConfig;
ndb_mgm_configuration * m_clusterConfig;
diff --git a/storage/ndb/src/kernel/vm/SimulatedBlock.cpp b/storage/ndb/src/kernel/vm/SimulatedBlock.cpp
index 3125fc33258..bc16b9f364e 100644
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.cpp
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.cpp
@@ -19,6 +19,7 @@
#include <NdbOut.hpp>
#include <GlobalData.hpp>
#include <Emulator.hpp>
+#include <WatchDog.hpp>
#include <ErrorHandlingMacros.hpp>
#include <TimeQueue.hpp>
#include <TransporterRegistry.hpp>
@@ -38,6 +39,9 @@
#include <AttributeDescriptor.hpp>
#include <NdbSqlUtil.hpp>
+#include <EventLogger.hpp>
+extern EventLogger g_eventLogger;
+
#define ljamEntry() jamEntryLine(30000 + __LINE__)
#define ljam() jamLine(30000 + __LINE__)
@@ -655,14 +659,20 @@ SimulatedBlock::getBatSize(Uint16 blockNo){
return sb->theBATSize;
}
+void* SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear, Uint32 paramId)
+{
+ return allocRecordAligned(type, s, n, 0, 0, clear, paramId);
+}
+
void*
-SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear, Uint32 paramId)
+SimulatedBlock::allocRecordAligned(const char * type, size_t s, size_t n, void **unaligned_buffer, Uint32 align, bool clear, Uint32 paramId)
{
void * p = NULL;
- size_t size = n*s;
- Uint64 real_size = (Uint64)((Uint64)n)*((Uint64)s);
- refresh_watch_dog();
+ Uint32 over_alloc = unaligned_buffer ? (align - 1) : 0;
+ size_t size = n*s + over_alloc;
+ Uint64 real_size = (Uint64)((Uint64)n)*((Uint64)s) + over_alloc;
+ refresh_watch_dog(9);
if (real_size > 0){
#ifdef VM_TRACE_MEM
ndbout_c("%s::allocRecord(%s, %u, %u) = %llu bytes",
@@ -696,14 +706,24 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear, U
char * ptr = (char*)p;
const Uint32 chunk = 128 * 1024;
while(size > chunk){
- refresh_watch_dog();
+ refresh_watch_dog(9);
memset(ptr, 0, chunk);
ptr += chunk;
size -= chunk;
}
- refresh_watch_dog();
+ refresh_watch_dog(9);
memset(ptr, 0, size);
}
+ if (unaligned_buffer)
+ {
+ *unaligned_buffer = p;
+ p = (void *)(((UintPtr)p + over_alloc) & ~(UintPtr)(over_alloc));
+#ifdef VM_TRACE
+ g_eventLogger.info("'%s' (%u) %llu %llu, alignment correction %u bytes",
+ type, align, (Uint64)p, (Uint64)p+n*s,
+ (Uint32)((UintPtr)p - (UintPtr)*unaligned_buffer));
+#endif
+ }
}
return p;
}
@@ -720,9 +740,16 @@ SimulatedBlock::deallocRecord(void ** ptr,
}
void
-SimulatedBlock::refresh_watch_dog()
+SimulatedBlock::refresh_watch_dog(Uint32 place)
+{
+ globalData.incrementWatchDogCounter(place);
+}
+
+void
+SimulatedBlock::update_watch_dog_timer(Uint32 interval)
{
- globalData.incrementWatchDogCounter(1);
+ extern EmulatorData globalEmulatorData;
+ globalEmulatorData.theWatchDog->setCheckInterval(interval);
}
void
@@ -1631,6 +1658,11 @@ SimulatedBlock::sendFragmentedSignal(NodeReceiverGroup rg,
}
SimulatedBlock::Callback SimulatedBlock::TheEmptyCallback = {0, 0};
+void
+SimulatedBlock::TheNULLCallbackFunction(class Signal*, Uint32, Uint32)
+{ abort(); /* should never be called */ }
+SimulatedBlock::Callback SimulatedBlock::TheNULLCallback =
+{ &SimulatedBlock::TheNULLCallbackFunction, 0 };
void
SimulatedBlock::sendFragmentedSignal(BlockReference ref,
diff --git a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp
index 37a8dde5956..a78ee21fb8f 100644
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp
@@ -131,6 +131,8 @@ public:
virtual const char* get_filename(Uint32 fd) const { return "";}
protected:
static Callback TheEmptyCallback;
+ void TheNULLCallbackFunction(class Signal*, Uint32, Uint32);
+ static Callback TheNULLCallback;
void execute(Signal* signal, Callback & c, Uint32 returnCode);
@@ -334,7 +336,8 @@ protected:
* Refresh Watch Dog in initialising code
*
*/
- void refresh_watch_dog();
+ void refresh_watch_dog(Uint32 place = 1);
+ void update_watch_dog_timer(Uint32 interval);
/**
* Prog error
@@ -377,6 +380,7 @@ protected:
*
*/
void* allocRecord(const char * type, size_t s, size_t n, bool clear = true, Uint32 paramId = 0);
+ void* allocRecordAligned(const char * type, size_t s, size_t n, void **unaligned_buffer, Uint32 align = NDB_O_DIRECT_WRITE_ALIGNMENT, bool clear = true, Uint32 paramId = 0);
/**
* Deallocate record
@@ -597,6 +601,8 @@ inline
void
SimulatedBlock::execute(Signal* signal, Callback & c, Uint32 returnCode){
CallbackFunction fun = c.m_callbackFunction;
+ if (fun == TheNULLCallback.m_callbackFunction)
+ return;
ndbrequire(fun != 0);
c.m_callbackFunction = NULL;
(this->*fun)(signal, c.m_callbackData, returnCode);
diff --git a/storage/ndb/src/kernel/vm/WatchDog.cpp b/storage/ndb/src/kernel/vm/WatchDog.cpp
index d1abb709b1e..a7f5e8f5c2b 100644
--- a/storage/ndb/src/kernel/vm/WatchDog.cpp
+++ b/storage/ndb/src/kernel/vm/WatchDog.cpp
@@ -16,6 +16,7 @@
#include <ndb_global.h>
#include <my_pthread.h>
+#include <sys/times.h>
#include "WatchDog.hpp"
#include "GlobalData.hpp"
@@ -24,6 +25,8 @@
#include <ErrorHandlingMacros.hpp>
#include <EventLogger.hpp>
+#include <NdbTick.h>
+
extern EventLogger g_eventLogger;
extern "C"
@@ -71,66 +74,115 @@ WatchDog::doStop(){
}
}
+const char *get_action(Uint32 IPValue)
+{
+ const char *action;
+ switch (IPValue) {
+ case 1:
+ action = "Job Handling";
+ break;
+ case 2:
+ action = "Scanning Timers";
+ break;
+ case 3:
+ action = "External I/O";
+ break;
+ case 4:
+ action = "Print Job Buffers at crash";
+ break;
+ case 5:
+ action = "Checking connections";
+ break;
+ case 6:
+ action = "Performing Send";
+ break;
+ case 7:
+ action = "Polling for Receive";
+ break;
+ case 8:
+ action = "Performing Receive";
+ break;
+ case 9:
+ action = "Allocating memory";
+ break;
+ default:
+ action = "Unknown place";
+ break;
+ }//switch
+ return action;
+}
+
void
-WatchDog::run(){
- unsigned int anIPValue;
- unsigned int alerts = 0;
+WatchDog::run()
+{
+ unsigned int anIPValue, sleep_time;
unsigned int oldIPValue = 0;
-
+ unsigned int theIntervalCheck = theInterval;
+ struct MicroSecondTimer start_time, last_time, now;
+ NdbTick_getMicroTimer(&start_time);
+ last_time = start_time;
+
// WatchDog for the single threaded NDB
- while(!theStop){
- Uint32 tmp = theInterval / 500;
- tmp= (tmp ? tmp : 1);
-
- while(!theStop && tmp > 0){
- NdbSleep_MilliSleep(500);
- tmp--;
- }
-
+ while (!theStop)
+ {
+ sleep_time= 100;
+
+ NdbSleep_MilliSleep(sleep_time);
if(theStop)
break;
+ NdbTick_getMicroTimer(&now);
+ if (NdbTick_getMicrosPassed(last_time, now)/1000 > sleep_time*2)
+ {
+ struct tms my_tms;
+ times(&my_tms);
+ g_eventLogger.info("Watchdog: User time: %llu System time: %llu",
+ (Uint64)my_tms.tms_utime,
+ (Uint64)my_tms.tms_stime);
+ g_eventLogger.warning("Watchdog: Warning overslept %u ms, expected %u ms.",
+ NdbTick_getMicrosPassed(last_time, now)/1000,
+ sleep_time);
+ }
+ last_time = now;
+
// Verify that the IP thread is not stuck in a loop
anIPValue = *theIPValue;
- if(anIPValue != 0) {
+ if (anIPValue != 0)
+ {
oldIPValue = anIPValue;
globalData.incrementWatchDogCounter(0);
- alerts = 0;
- } else {
- const char *last_stuck_action;
- alerts++;
- switch (oldIPValue) {
- case 1:
- last_stuck_action = "Job Handling";
- break;
- case 2:
- last_stuck_action = "Scanning Timers";
- break;
- case 3:
- last_stuck_action = "External I/O";
- break;
- case 4:
- last_stuck_action = "Print Job Buffers at crash";
- break;
- case 5:
- last_stuck_action = "Checking connections";
- break;
- case 6:
- last_stuck_action = "Performing Send";
- break;
- case 7:
- last_stuck_action = "Polling for Receive";
- break;
- case 8:
- last_stuck_action = "Performing Receive";
- break;
- default:
- last_stuck_action = "Unknown place";
- break;
- }//switch
- g_eventLogger.warning("Ndb kernel is stuck in: %s", last_stuck_action);
- if(alerts == 3){
- shutdownSystem(last_stuck_action);
+ NdbTick_getMicroTimer(&start_time);
+ theIntervalCheck = theInterval;
+ }
+ else
+ {
+ int warn = 1;
+ Uint32 elapsed = NdbTick_getMicrosPassed(start_time, now)/1000;
+ /*
+ oldIPValue == 9 indicates malloc going on, this can take some time
+ so only warn if we pass the watchdog interval
+ */
+ if (oldIPValue == 9)
+ if (elapsed < theIntervalCheck)
+ warn = 0;
+ else
+ theIntervalCheck += theInterval;
+
+ if (warn)
+ {
+ const char *last_stuck_action = get_action(oldIPValue);
+ g_eventLogger.warning("Ndb kernel is stuck in: %s", last_stuck_action);
+ {
+ struct tms my_tms;
+ times(&my_tms);
+ g_eventLogger.info("Watchdog: User time: %llu System time: %llu",
+ (Uint64)my_tms.tms_utime,
+ (Uint64)my_tms.tms_stime);
+ }
+ if (elapsed > 3 * theInterval)
+ {
+ shutdownSystem(last_stuck_action);
+ }
}
}
}
diff --git a/storage/ndb/src/mgmapi/mgmapi.cpp b/storage/ndb/src/mgmapi/mgmapi.cpp
index e7dc1d1d503..5f975da8c73 100644
--- a/storage/ndb/src/mgmapi/mgmapi.cpp
+++ b/storage/ndb/src/mgmapi/mgmapi.cpp
@@ -524,7 +524,7 @@ ndb_mgm_connect(NdbMgmHandle handle, int no_retries,
NDB_SOCKET_TYPE sockfd= NDB_INVALID_SOCKET;
Uint32 i;
SocketClient s(0, 0);
- s.set_connect_timeout(handle->timeout);
+ s.set_connect_timeout((handle->timeout+999)/1000);
if (!s.init())
{
fprintf(handle->errstream,
diff --git a/storage/ndb/src/mgmclient/CommandInterpreter.cpp b/storage/ndb/src/mgmclient/CommandInterpreter.cpp
index 93fc3d46e43..00ea882a49d 100644
--- a/storage/ndb/src/mgmclient/CommandInterpreter.cpp
+++ b/storage/ndb/src/mgmclient/CommandInterpreter.cpp
@@ -18,6 +18,7 @@
#include <Vector.hpp>
#include <mgmapi.h>
#include <util/BaseString.hpp>
+#include <ndbd_exit_codes.h>
class MgmtSrvr;
@@ -704,6 +705,133 @@ CommandInterpreter::printError()
}
}
+/*
+ * print log event from mgmsrv to console screen
+ */
+#define make_uint64(a,b) (((Uint64)(a)) + (((Uint64)(b)) << 32))
+#define Q64(a) make_uint64(event->EVENT.a ## _lo, event->EVENT.a ## _hi)
+#define R event->source_nodeid
+#define Q(a) event->EVENT.a
+#define QVERSION getMajor(Q(version)), getMinor(Q(version)), getBuild(Q(version))
+#define NDB_LE_(a) NDB_LE_ ## a
+static void
+printLogEvent(struct ndb_logevent* event)
+{
+ switch (event->type) {
+ /**
+ * NDB_MGM_EVENT_CATEGORY_BACKUP
+ */
+#undef EVENT
+#define EVENT BackupStarted
+ case NDB_LE_BackupStarted:
+ ndbout_c("Node %u: Backup %d started from node %d",
+ R, Q(backup_id), Q(starting_node));
+ break;
+#undef EVENT
+#define EVENT BackupFailedToStart
+ case NDB_LE_BackupFailedToStart:
+ ndbout_c("Node %u: Backup request from %d failed to start. Error: %d",
+ R, Q(starting_node), Q(error));
+ break;
+#undef EVENT
+#define EVENT BackupCompleted
+ case NDB_LE_BackupCompleted:
+ ndbout_c("Node %u: Backup %u started from node %u completed\n"
+ " StartGCP: %u StopGCP: %u\n"
+ " #Records: %u #LogRecords: %u\n"
+ " Data: %u bytes Log: %u bytes", R,
+ Q(backup_id), Q(starting_node),
+ Q(start_gci), Q(stop_gci),
+ Q(n_records), Q(n_log_records),
+ Q(n_bytes), Q(n_log_bytes));
+ break;
+#undef EVENT
+#define EVENT BackupAborted
+ case NDB_LE_BackupAborted:
+ ndbout_c("Node %u: Backup %d started from %d has been aborted. Error: %d",
+ R, Q(backup_id), Q(starting_node), Q(error));
+ break;
+ /**
+ * NDB_MGM_EVENT_CATEGORY_STARTUP
+ */
+#undef EVENT
+#define EVENT NDBStartStarted
+ case NDB_LE_NDBStartStarted:
+ ndbout_c("Node %u: Start initiated (version %d.%d.%d)",
+ R, QVERSION);
+ break;
+#undef EVENT
+#define EVENT NDBStartCompleted
+ case NDB_LE_NDBStartCompleted:
+ ndbout_c("Node %u: Started (version %d.%d.%d)",
+ R, QVERSION);
+ break;
+#undef EVENT
+#define EVENT NDBStopStarted
+ case NDB_LE_NDBStopStarted:
+ ndbout_c("Node %u: %s shutdown initiated", R,
+ (Q(stoptype) == 1 ? "Cluster" : "Node"));
+ break;
+#undef EVENT
+#define EVENT NDBStopCompleted
+ case NDB_LE_NDBStopCompleted:
+ {
+ BaseString action_str("");
+ BaseString signum_str("");
+ getRestartAction(Q(action), action_str);
+ if (Q(signum))
+ signum_str.appfmt(" Initiated by signal %d.",
+ Q(signum));
+ ndbout_c("Node %u: Node shutdown completed%s.%s",
+ R, action_str.c_str(), signum_str.c_str());
+ }
+ break;
+#undef EVENT
+#define EVENT NDBStopForced
+ case NDB_LE_NDBStopForced:
+ {
+ BaseString action_str("");
+ BaseString reason_str("");
+ BaseString sphase_str("");
+ int signum = Q(signum);
+ int error = Q(error);
+ int sphase = Q(sphase);
+ int extra = Q(extra);
+ getRestartAction(Q(action), action_str);
+ if (signum)
+ reason_str.appfmt(" Initiated by signal %d.", signum);
+ if (error)
+ {
+ ndbd_exit_classification cl;
+ ndbd_exit_status st;
+ const char *msg = ndbd_exit_message(error, &cl);
+ const char *cl_msg = ndbd_exit_classification_message(cl, &st);
+ const char *st_msg = ndbd_exit_status_message(st);
+ reason_str.appfmt(" Caused by error %d: \'%s(%s). %s\'.",
+ error, msg, cl_msg, st_msg);
+ if (extra != 0)
+ reason_str.appfmt(" (extra info %d)", extra);
+ }
+ if (sphase < 255)
+ sphase_str.appfmt(" Occured during startphase %u.", sphase);
+ ndbout_c("Node %u: Forced node shutdown completed%s.%s%s",
+ R, action_str.c_str(), sphase_str.c_str(),
+ reason_str.c_str());
+ }
+ break;
+#undef EVENT
+#define EVENT StopAborted
+ case NDB_LE_NDBStopAborted:
+ ndbout_c("Node %u: Node shutdown aborted", R);
+ break;
+ /**
+ * default nothing to print
+ */
+ default:
+ break;
+ }
+}
+
//*****************************************************************************
//*****************************************************************************
@@ -720,30 +848,21 @@ event_thread_run(void* p)
int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP,
1, NDB_MGM_EVENT_CATEGORY_STARTUP,
0 };
- int fd = ndb_mgm_listen_event(handle, filter);
- if (fd != NDB_INVALID_SOCKET)
+
+ NdbLogEventHandle log_handle= NULL;
+ struct ndb_logevent log_event;
+
+ log_handle= ndb_mgm_create_logevent_handle(handle, filter);
+ if (log_handle)
{
do_event_thread= 1;
- char *tmp= 0;
- char buf[1024];
do {
- SocketInputStream in(fd,2000);
- if((tmp = in.gets(buf, sizeof(buf))))
- {
- const char ping_token[]= "<PING>";
- if (memcmp(ping_token,tmp,sizeof(ping_token)-1))
- if(tmp && strlen(tmp))
- {
- Guard g(printmutex);
- ndbout << tmp;
- }
- }
- else if(in.timedout() && ndb_mgm_check_connection(handle)<0)
- {
- break;
- }
+ if (ndb_logevent_get_next(log_handle, &log_event, 2000) <= 0)
+ continue;
+ Guard g(printmutex);
+ printLogEvent(&log_event);
} while(do_event_thread);
- NDB_CLOSE_SOCKET(fd);
+ ndb_mgm_destroy_logevent_handle(&log_handle);
}
else
{
@@ -1008,6 +1127,7 @@ CommandInterpreter::execute_impl(const char *_line, bool interactive)
}
else if(strcasecmp(firstToken, "ENTER") == 0 &&
allAfterFirstToken != NULL &&
+ allAfterFirstToken != NULL &&
strncasecmp(allAfterFirstToken, "SINGLE USER MODE ",
sizeof("SINGLE USER MODE") - 1) == 0){
m_error = executeEnterSingleUser(allAfterFirstToken);
@@ -2476,8 +2596,7 @@ CommandInterpreter::executeStartBackup(char* parameters, bool interactive)
{
struct ndb_mgm_reply reply;
unsigned int backupId;
- int fd = -1;
-
+
Vector<BaseString> args;
{
BaseString(parameters).split(args);
@@ -2494,8 +2613,6 @@ CommandInterpreter::executeStartBackup(char* parameters, bool interactive)
if (sz == 2 && args[1] == "NOWAIT")
{
flags = 0;
- result = ndb_mgm_start_backup(m_mgmsrv, 0, &backupId, &reply);
- goto END_BACKUP;
}
else if (sz == 1 || (sz == 3 && args[1] == "WAIT" && args[2] == "COMPLETED"))
{
@@ -2513,62 +2630,74 @@ CommandInterpreter::executeStartBackup(char* parameters, bool interactive)
return -1;
}
- /**
- * If interactive...event listner is already running
- */
+ NdbLogEventHandle log_handle= NULL;
+ struct ndb_logevent log_event;
if (flags == 2 && !interactive)
{
int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0, 0 };
- fd = ndb_mgm_listen_event(m_mgmsrv, filter);
- if (fd < 0)
+ log_handle = ndb_mgm_create_logevent_handle(m_mgmsrv, filter);
+ if (!log_handle)
{
ndbout << "Initializing start of backup failed" << endl;
printError();
- return fd;
+ return -1;
}
}
result = ndb_mgm_start_backup(m_mgmsrv, flags, &backupId, &reply);
-END_BACKUP:
if (result != 0) {
ndbout << "Backup failed" << endl;
printError();
- if (fd >= 0)
- close(fd);
+ if (log_handle)
+ ndb_mgm_destroy_logevent_handle(&log_handle);
return result;
}
- if (fd >= 0)
+ /**
+ * If interactive, event listner thread is already running
+ */
+ if (log_handle && !interactive)
{
- char *tmp;
- char buf[1024];
- {
- SocketInputStream in(fd);
- int count = 0;
- do {
- tmp = in.gets(buf, 1024);
- if(tmp)
- {
- ndbout << tmp;
- unsigned int id;
- if(sscanf(tmp, "%*[^:]: Backup %d ", &id) == 1 && id == backupId){
- count++;
- }
- }
- } while(count < 2);
- }
-
- SocketInputStream in(fd, 10);
+ int count = 0;
+ int retry = 0;
do {
- tmp = in.gets(buf, 1024);
- if(tmp && tmp[0] != 0)
+ if (ndb_logevent_get_next(log_handle, &log_event, 60000) > 0)
+ {
+ int print = 0;
+ switch (log_event.type) {
+ case NDB_LE_BackupStarted:
+ if (log_event.BackupStarted.backup_id == backupId)
+ print = 1;
+ break;
+ case NDB_LE_BackupCompleted:
+ if (log_event.BackupCompleted.backup_id == backupId)
+ print = 1;
+ break;
+ case NDB_LE_BackupAborted:
+ if (log_event.BackupAborted.backup_id == backupId)
+ print = 1;
+ break;
+ default:
+ break;
+ }
+ if (print)
+ {
+ Guard g(m_print_mutex);
+ printLogEvent(&log_event);
+ count++;
+ }
+ }
+ else
{
- ndbout << tmp;
+ retry++;
}
- } while(tmp && tmp[0] != 0);
-
- close(fd);
+ } while(count < 2 && retry < 3);
+
+ if (retry >= 3)
+ ndbout << "get backup event failed for " << retry << " times" << endl;
+
+ ndb_mgm_destroy_logevent_handle(&log_handle);
}
return 0;
diff --git a/storage/ndb/src/mgmclient/Makefile.am b/storage/ndb/src/mgmclient/Makefile.am
index 5b2009240c3..8e05354919b 100644
--- a/storage/ndb/src/mgmclient/Makefile.am
+++ b/storage/ndb/src/mgmclient/Makefile.am
@@ -21,7 +21,8 @@ libndbmgmclient_la_LIBADD = ../mgmapi/libmgmapi.la \
../common/logger/liblogger.la \
../common/portlib/libportlib.la \
../common/util/libgeneral.la \
- ../common/portlib/libportlib.la
+ ../common/portlib/libportlib.la \
+ ../common/debugger/libtrace.la
ndb_mgm_SOURCES = main.cpp
diff --git a/storage/ndb/src/mgmclient/main.cpp b/storage/ndb/src/mgmclient/main.cpp
index 44408362f09..fbd81c71700 100644
--- a/storage/ndb/src/mgmclient/main.cpp
+++ b/storage/ndb/src/mgmclient/main.cpp
@@ -23,6 +23,8 @@ extern "C" {
#elif !defined(__NETWARE__)
#include <readline/readline.h>
extern "C" int add_history(const char *command); /* From readline directory */
+extern "C" int read_history(const char *command);
+extern "C" int write_history(const char *command);
#define HAVE_READLINE
#endif
}
@@ -71,11 +73,11 @@ static struct my_option my_long_options[] =
NDB_STD_OPTS("ndb_mgm"),
{ "execute", 'e',
"execute command and exit",
- (gptr*) &opt_execute_str, (gptr*) &opt_execute_str, 0,
+ (uchar**) &opt_execute_str, (uchar**) &opt_execute_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "try-reconnect", 't',
"Specify number of tries for connecting to ndb_mgmd (0 = infinite)",
- (gptr*) &_try_reconnect, (gptr*) &_try_reconnect, 0,
+ (uchar**) &_try_reconnect, (uchar**) &_try_reconnect, 0,
GET_UINT, REQUIRED_ARG, 3, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -155,10 +157,35 @@ int main(int argc, char** argv){
signal(SIGPIPE, handler);
com = new Ndb_mgmclient(opt_connect_str,1);
int ret= 0;
+ BaseString histfile;
if (!opt_execute_str)
{
+#ifdef HAVE_READLINE
+ char *histfile_env= getenv("NDB_MGM_HISTFILE");
+ if (histfile_env)
+ histfile.assign(histfile_env,strlen(histfile_env));
+ else if(getenv("HOME"))
+ {
+ histfile.assign(getenv("HOME"),strlen(getenv("HOME")));
+ histfile.append("/.ndb_mgm_history");
+ }
+ if (histfile.length())
+ read_history(histfile.c_str());
+#endif
+
ndbout << "-- NDB Cluster -- Management Client --" << endl;
while(read_and_execute(_try_reconnect));
+
+#ifdef HAVE_READLINE
+ if (histfile.length())
+ {
+ BaseString histfile_tmp;
+ histfile_tmp.assign(histfile);
+ histfile_tmp.append(".TMP");
+ if(!write_history(histfile_tmp.c_str()))
+ my_rename(histfile_tmp.c_str(), histfile.c_str(), MYF(MY_WME));
+ }
+#endif
}
else
{
diff --git a/storage/ndb/src/mgmsrv/ConfigInfo.cpp b/storage/ndb/src/mgmsrv/ConfigInfo.cpp
index e27e55d2a13..69907224b7f 100644
--- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp
@@ -580,6 +580,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
STR_VALUE(MAX_INT_RNIL) },
{
+ CFG_DB_WATCHDOG_INTERVAL_INITIAL,
+ "TimeBetweenWatchDogCheckInitial",
+ DB_TOKEN,
+ "Time between execution checks inside a database node in the early start phases when memory is allocated",
+ ConfigInfo::CI_USED,
+ true,
+ ConfigInfo::CI_INT,
+ "6000",
+ "70",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
CFG_DB_STOP_ON_ERROR,
"StopOnError",
DB_TOKEN,
@@ -880,6 +892,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
STR_VALUE(MAX_INT_RNIL) },
{
+ CFG_DB_REDOLOG_FILE_SIZE,
+ "FragmentLogFileSize",
+ DB_TOKEN,
+ "Size of each Redo log file",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "16M",
+ "4M",
+ "1G" },
+
+ {
CFG_DB_MAX_OPEN_FILES,
"MaxNoOfOpenFiles",
DB_TOKEN,
@@ -1298,6 +1322,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
STR_VALUE(MAX_INT_RNIL) },
{
+ CFG_DB_MAX_ALLOCATE,
+ "MaxAllocate",
+ DB_TOKEN,
+ "Maximum size of allocation to use when allocating memory for tables",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "32M",
+ "1M",
+ "1G" },
+
+ {
CFG_DB_MEMREPORT_FREQUENCY,
"MemReportFrequency",
DB_TOKEN,
@@ -1309,6 +1345,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
"0",
STR_VALUE(MAX_INT_RNIL) },
+ {
+ CFG_DB_O_DIRECT,
+ "ODirect",
+ DB_TOKEN,
+ "Use O_DIRECT file write/read when possible",
+ ConfigInfo::CI_USED,
+ true,
+ ConfigInfo::CI_BOOL,
+ "false",
+ "false",
+ "true"},
+
/***************************************************************************
* API
***************************************************************************/
diff --git a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
index c1bfdee9342..569cb1eb654 100644
--- a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
+++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
@@ -781,19 +781,19 @@ InitConfigFileParser::parse_mycnf()
const ConfigInfo::ParamInfo& param = ConfigInfo::m_ParamInfo[i];
switch(param._type){
case ConfigInfo::CI_BOOL:
- opt.value = (gptr*)malloc(sizeof(int));
+ opt.value = (uchar **)malloc(sizeof(int));
opt.var_type = GET_INT;
break;
case ConfigInfo::CI_INT:
- opt.value = (gptr*)malloc(sizeof(int));
+ opt.value = (uchar**)malloc(sizeof(int));
opt.var_type = GET_INT;
break;
case ConfigInfo::CI_INT64:
- opt.value = (gptr*)malloc(sizeof(Int64));
+ opt.value = (uchar**)malloc(sizeof(Int64));
opt.var_type = GET_LL;
break;
case ConfigInfo::CI_STRING:
- opt.value = (gptr*)malloc(sizeof(char *));
+ opt.value = (uchar**)malloc(sizeof(char *));
opt.var_type = GET_STR;
break;
default:
@@ -819,28 +819,28 @@ InitConfigFileParser::parse_mycnf()
bzero(&opt, sizeof(opt));
opt.name = "ndbd";
opt.id = 256;
- opt.value = (gptr*)malloc(sizeof(char*));
+ opt.value = (uchar**)malloc(sizeof(char*));
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
opt.name = "ndb_mgmd";
opt.id = 256;
- opt.value = (gptr*)malloc(sizeof(char*));
+ opt.value = (uchar**)malloc(sizeof(char*));
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
opt.name = "mysqld";
opt.id = 256;
- opt.value = (gptr*)malloc(sizeof(char*));
+ opt.value = (uchar**)malloc(sizeof(char*));
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
opt.name = "ndbapi";
opt.id = 256;
- opt.value = (gptr*)malloc(sizeof(char*));
+ opt.value = (uchar**)malloc(sizeof(char*));
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
diff --git a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp
index f84c79b704f..af708664a69 100644
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -18,6 +18,7 @@
#include "MgmtSrvr.hpp"
#include "MgmtErrorReporter.hpp"
+#include "ndb_mgmd_error.h"
#include <ConfigRetriever.hpp>
#include <NdbOut.hpp>
@@ -239,13 +240,6 @@ MgmtSrvr::stopEventLog()
// Nothing yet
}
-class ErrorItem
-{
-public:
- int _errorCode;
- const char * _errorText;
-};
-
bool
MgmtSrvr::setEventLogFilter(int severity, int enable)
{
@@ -268,62 +262,6 @@ MgmtSrvr::isEventLogFilterEnabled(int severity)
return g_eventLogger.isEnable((Logger::LoggerLevel)severity);
}
-static ErrorItem errorTable[] =
-{
- {MgmtSrvr::NO_CONTACT_WITH_PROCESS, "No contact with the process (dead ?)."},
- {MgmtSrvr::PROCESS_NOT_CONFIGURED, "The process is not configured."},
- {MgmtSrvr::WRONG_PROCESS_TYPE,
- "The process has wrong type. Expected a DB process."},
- {MgmtSrvr::COULD_NOT_ALLOCATE_MEMORY, "Could not allocate memory."},
- {MgmtSrvr::SEND_OR_RECEIVE_FAILED, "Send to process or receive failed."},
- {MgmtSrvr::INVALID_LEVEL, "Invalid level. Should be between 1 and 30."},
- {MgmtSrvr::INVALID_ERROR_NUMBER, "Invalid error number. Should be >= 0."},
- {MgmtSrvr::INVALID_TRACE_NUMBER, "Invalid trace number."},
- {MgmtSrvr::NOT_IMPLEMENTED, "Not implemented."},
- {MgmtSrvr::INVALID_BLOCK_NAME, "Invalid block name"},
-
- {MgmtSrvr::CONFIG_PARAM_NOT_EXIST,
- "The configuration parameter does not exist for the process type."},
- {MgmtSrvr::CONFIG_PARAM_NOT_UPDATEABLE,
- "The configuration parameter is not possible to update."},
- {MgmtSrvr::VALUE_WRONG_FORMAT_INT_EXPECTED,
- "Incorrect value. Expected integer."},
- {MgmtSrvr::VALUE_TOO_LOW, "Value is too low."},
- {MgmtSrvr::VALUE_TOO_HIGH, "Value is too high."},
- {MgmtSrvr::VALUE_WRONG_FORMAT_BOOL_EXPECTED,
- "Incorrect value. Expected TRUE or FALSE."},
-
- {MgmtSrvr::CONFIG_FILE_OPEN_WRITE_ERROR,
- "Could not open configuration file for writing."},
- {MgmtSrvr::CONFIG_FILE_OPEN_READ_ERROR,
- "Could not open configuration file for reading."},
- {MgmtSrvr::CONFIG_FILE_WRITE_ERROR,
- "Write error when writing configuration file."},
- {MgmtSrvr::CONFIG_FILE_READ_ERROR,
- "Read error when reading configuration file."},
- {MgmtSrvr::CONFIG_FILE_CLOSE_ERROR, "Could not close configuration file."},
-
- {MgmtSrvr::CONFIG_CHANGE_REFUSED_BY_RECEIVER,
- "The change was refused by the receiving process."},
- {MgmtSrvr::COULD_NOT_SYNC_CONFIG_CHANGE_AGAINST_PHYSICAL_MEDIUM,
- "The change could not be synced against physical medium."},
- {MgmtSrvr::CONFIG_FILE_CHECKSUM_ERROR,
- "The config file is corrupt. Checksum error."},
- {MgmtSrvr::NOT_POSSIBLE_TO_SEND_CONFIG_UPDATE_TO_PROCESS_TYPE,
- "It is not possible to send an update of a configuration variable "
- "to this kind of process."},
- {MgmtSrvr::NODE_SHUTDOWN_IN_PROGESS, "Node shutdown in progress" },
- {MgmtSrvr::SYSTEM_SHUTDOWN_IN_PROGRESS, "System shutdown in progress" },
- {MgmtSrvr::NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH,
- "Node shutdown would cause system crash" },
- {MgmtSrvr::UNSUPPORTED_NODE_SHUTDOWN,
- "Unsupported multi node shutdown. Abort option required." },
- {MgmtSrvr::NODE_NOT_API_NODE, "The specified node is not an API node." },
- {MgmtSrvr::OPERATION_NOT_ALLOWED_START_STOP,
- "Operation not allowed while nodes are starting or stopping."},
- {MgmtSrvr::NO_CONTACT_WITH_DB_NODES, "No contact with database nodes" }
-};
-
int MgmtSrvr::translateStopRef(Uint32 errCode)
{
switch(errCode){
@@ -343,8 +281,6 @@ int MgmtSrvr::translateStopRef(Uint32 errCode)
return 4999;
}
-static int noOfErrorCodes = sizeof(errorTable) / sizeof(ErrorItem);
-
int
MgmtSrvr::getNodeCount(enum ndb_mgm_node_type type) const
{
@@ -1969,18 +1905,8 @@ MgmtSrvr::dumpState(int nodeId, const Uint32 args[], Uint32 no)
const char* MgmtSrvr::getErrorText(int errorCode, char *buf, int buf_sz)
{
-
- for (int i = 0; i < noOfErrorCodes; ++i) {
- if (errorCode == errorTable[i]._errorCode) {
- BaseString::snprintf(buf, buf_sz, errorTable[i]._errorText);
- buf[buf_sz-1]= 0;
- return buf;
- }
- }
-
ndb_error_string(errorCode, buf, buf_sz);
buf[buf_sz-1]= 0;
-
return buf;
}
diff --git a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp
index a54b7866091..90287554ef8 100644
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp
@@ -148,45 +148,6 @@ public:
*/
bool isEventLogFilterEnabled(int severity);
- STATIC_CONST( NO_CONTACT_WITH_PROCESS = 5000 );
- STATIC_CONST( PROCESS_NOT_CONFIGURED = 5001 );
- STATIC_CONST( WRONG_PROCESS_TYPE = 5002 );
- STATIC_CONST( COULD_NOT_ALLOCATE_MEMORY = 5003 );
- STATIC_CONST( SEND_OR_RECEIVE_FAILED = 5005 );
- STATIC_CONST( INVALID_LEVEL = 5006 );
- STATIC_CONST( INVALID_ERROR_NUMBER = 5007 );
- STATIC_CONST( INVALID_TRACE_NUMBER = 5008 );
- STATIC_CONST( NOT_IMPLEMENTED = 5009 );
- STATIC_CONST( INVALID_BLOCK_NAME = 5010 );
-
- STATIC_CONST( CONFIG_PARAM_NOT_EXIST = 5011 );
- STATIC_CONST( CONFIG_PARAM_NOT_UPDATEABLE = 5012 );
- STATIC_CONST( VALUE_WRONG_FORMAT_INT_EXPECTED = 5013 );
- STATIC_CONST( VALUE_TOO_LOW = 5014 );
- STATIC_CONST( VALUE_TOO_HIGH = 5015 );
- STATIC_CONST( VALUE_WRONG_FORMAT_BOOL_EXPECTED = 5016 );
-
- STATIC_CONST( CONFIG_FILE_OPEN_WRITE_ERROR = 5017 );
- STATIC_CONST( CONFIG_FILE_OPEN_READ_ERROR = 5018 );
- STATIC_CONST( CONFIG_FILE_WRITE_ERROR = 5019 );
- STATIC_CONST( CONFIG_FILE_READ_ERROR = 5020 );
- STATIC_CONST( CONFIG_FILE_CLOSE_ERROR = 5021 );
-
- STATIC_CONST( CONFIG_CHANGE_REFUSED_BY_RECEIVER = 5022 );
- STATIC_CONST( COULD_NOT_SYNC_CONFIG_CHANGE_AGAINST_PHYSICAL_MEDIUM = 5023 );
- STATIC_CONST( CONFIG_FILE_CHECKSUM_ERROR = 5024 );
- STATIC_CONST( NOT_POSSIBLE_TO_SEND_CONFIG_UPDATE_TO_PROCESS_TYPE = 5025 );
-
- STATIC_CONST( NODE_SHUTDOWN_IN_PROGESS = 5026 );
- STATIC_CONST( SYSTEM_SHUTDOWN_IN_PROGRESS = 5027 );
- STATIC_CONST( NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH = 5028 );
-
- STATIC_CONST( NO_CONTACT_WITH_DB_NODES = 5030 );
- STATIC_CONST( UNSUPPORTED_NODE_SHUTDOWN = 5031 );
-
- STATIC_CONST( NODE_NOT_API_NODE = 5062 );
- STATIC_CONST( OPERATION_NOT_ALLOWED_START_STOP = 5063 );
-
/**
* This enum specifies the different signal loggig modes possible to set
* with the setSignalLoggingMode method.
diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp
index b880657d89b..16c560868ef 100644
--- a/storage/ndb/src/mgmsrv/main.cpp
+++ b/storage/ndb/src/mgmsrv/main.cpp
@@ -142,29 +142,29 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_mgmd"),
{ "config-file", 'f', "Specify cluster configuration file",
- (gptr*) &opt_config_filename, (gptr*) &opt_config_filename, 0,
+ (uchar**) &opt_config_filename, (uchar**) &opt_config_filename, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "print-full-config", 'P', "Print full config and exit",
- (gptr*) &g_print_full_config, (gptr*) &g_print_full_config, 0,
+ (uchar**) &g_print_full_config, (uchar**) &g_print_full_config, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "daemon", 'd', "Run ndb_mgmd in daemon mode (default)",
- (gptr*) &opt_daemon, (gptr*) &opt_daemon, 0,
+ (uchar**) &opt_daemon, (uchar**) &opt_daemon, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
{ "interactive", OPT_INTERACTIVE,
"Run interactive. Not supported but provided for testing purposes",
- (gptr*) &opt_interactive, (gptr*) &opt_interactive, 0,
+ (uchar**) &opt_interactive, (uchar**) &opt_interactive, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "no-nodeid-checks", OPT_NO_NODEID_CHECKS,
"Do not provide any node id checks",
- (gptr*) &g_no_nodeid_checks, (gptr*) &g_no_nodeid_checks, 0,
+ (uchar**) &g_no_nodeid_checks, (uchar**) &g_no_nodeid_checks, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "nodaemon", OPT_NO_DAEMON,
"Don't run as daemon, but don't read from stdin",
- (gptr*) &opt_non_interactive, (gptr*) &opt_non_interactive, 0,
+ (uchar**) &opt_non_interactive, (uchar**) &opt_non_interactive, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "mycnf", 256,
"Read cluster config from my.cnf",
- (gptr*) &opt_mycnf, (gptr*) &opt_mycnf, 0,
+ (uchar**) &opt_mycnf, (uchar**) &opt_mycnf, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/src/mgmsrv/ndb_mgmd_error.h b/storage/ndb/src/mgmsrv/ndb_mgmd_error.h
new file mode 100644
index 00000000000..2438f15c808
--- /dev/null
+++ b/storage/ndb/src/mgmsrv/ndb_mgmd_error.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 2007 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef NDB_MGMD_ERROR_H
+#define NDB_MGMD_ERROR_H
+
+#define NO_CONTACT_WITH_PROCESS 5000
+#define WRONG_PROCESS_TYPE 5002
+#define SEND_OR_RECEIVE_FAILED 5005
+#define INVALID_ERROR_NUMBER 5007
+#define INVALID_TRACE_NUMBER 5008
+#define INVALID_BLOCK_NAME 5010
+#define NODE_SHUTDOWN_IN_PROGESS 5026
+#define SYSTEM_SHUTDOWN_IN_PROGRESS 5027
+#define NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH 5028
+#define NO_CONTACT_WITH_DB_NODES 5030
+#define UNSUPPORTED_NODE_SHUTDOWN 5031
+#define NODE_NOT_API_NODE 5062
+#define OPERATION_NOT_ALLOWED_START_STOP 5063
+
+#endif
diff --git a/storage/ndb/src/ndbapi/Ndb.cpp b/storage/ndb/src/ndbapi/Ndb.cpp
index 78b7af5522b..9b8e4e86d30 100644
--- a/storage/ndb/src/ndbapi/Ndb.cpp
+++ b/storage/ndb/src/ndbapi/Ndb.cpp
@@ -754,17 +754,27 @@ Ndb::getNodeId()
}
/****************************************************************************
-Uint64 getTupleIdFromNdb( Uint32 aTableId, Uint32 cacheSize );
-
-Parameters: aTableId : The TableId.
- cacheSize: Prefetch this many values
-Remark: Returns a new TupleId to the application.
- The TupleId comes from SYSTAB_0 where SYSKEY_0 = TableId.
- It is initialized to (TableId << 48) + 1 in NdbcntrMain.cpp.
+Uint64 getAutoIncrementValue( const char* aTableName,
+ Uint64 & autoValue,
+ Uint32 cacheSize,
+ Uint64 step,
+ Uint64 start);
+
+Parameters: aTableName (IN) : The table name.
+ autoValue (OUT) : Returns new autoincrement value
+ cacheSize (IN) : Prefetch this many values
+ step (IN) : Specifies the step between the
+ autoincrement values.
+ start (IN) : Start value for first value
+Remark: Returns a new autoincrement value to the application.
+ The autoincrement values can be increased by steps
+ (default 1) and a number of values can be prefetched
+ by specifying cacheSize (default 10).
****************************************************************************/
int
Ndb::getAutoIncrementValue(const char* aTableName,
- Uint64 & tupleId, Uint32 cacheSize)
+ Uint64 & autoValue, Uint32 cacheSize,
+ Uint64 step, Uint64 start)
{
DBUG_ENTER("Ndb::getAutoIncrementValue");
ASSERT_NOT_MYSQLD;
@@ -778,15 +788,16 @@ Ndb::getAutoIncrementValue(const char* aTableName,
}
const NdbTableImpl* table = info->m_table_impl;
TupleIdRange & range = info->m_tuple_id_range;
- if (getTupleIdFromNdb(table, range, tupleId, cacheSize) == -1)
+ if (getTupleIdFromNdb(table, range, autoValue, cacheSize, step, start) == -1)
DBUG_RETURN(-1);
- DBUG_PRINT("info", ("value %lu", (ulong) tupleId));
+ DBUG_PRINT("info", ("value %lu", (ulong) autoValue));
DBUG_RETURN(0);
}
int
Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable,
- Uint64 & tupleId, Uint32 cacheSize)
+ Uint64 & autoValue, Uint32 cacheSize,
+ Uint64 step, Uint64 start)
{
DBUG_ENTER("Ndb::getAutoIncrementValue");
ASSERT_NOT_MYSQLD;
@@ -801,51 +812,86 @@ Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable,
DBUG_RETURN(-1);
}
TupleIdRange & range = info->m_tuple_id_range;
- if (getTupleIdFromNdb(table, range, tupleId, cacheSize) == -1)
+ if (getTupleIdFromNdb(table, range, autoValue, cacheSize, step, start) == -1)
DBUG_RETURN(-1);
- DBUG_PRINT("info", ("value %lu", (ulong)tupleId));
+ DBUG_PRINT("info", ("value %lu", (ulong)autoValue));
DBUG_RETURN(0);
}
int
Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable,
- TupleIdRange & range, Uint64 & tupleId,
- Uint32 cacheSize)
+ TupleIdRange & range, Uint64 & autoValue,
+ Uint32 cacheSize, Uint64 step, Uint64 start)
{
DBUG_ENTER("Ndb::getAutoIncrementValue");
assert(aTable != 0);
const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable);
- if (getTupleIdFromNdb(table, range, tupleId, cacheSize) == -1)
+ if (getTupleIdFromNdb(table, range, autoValue, cacheSize, step, start) == -1)
DBUG_RETURN(-1);
- DBUG_PRINT("info", ("value %lu", (ulong)tupleId));
+ DBUG_PRINT("info", ("value %lu", (ulong)autoValue));
DBUG_RETURN(0);
}
int
Ndb::getTupleIdFromNdb(const NdbTableImpl* table,
- TupleIdRange & range, Uint64 & tupleId, Uint32 cacheSize)
+ TupleIdRange & range, Uint64 & tupleId,
+ Uint32 cacheSize, Uint64 step, Uint64 start)
{
+/*
+ Returns a new TupleId to the application.
+ The TupleId comes from SYSTAB_0 where SYSKEY_0 = TableId.
+ It is initialized to (TableId << 48) + 1 in NdbcntrMain.cpp.
+ In most cases step= start= 1, in which case we get:
+ 1,2,3,4,5,...
+ If step=10 and start=5 and first number is 1, we get:
+ 5,15,25,35,...
+*/
DBUG_ENTER("Ndb::getTupleIdFromNdb");
- if (range.m_first_tuple_id != range.m_last_tuple_id)
+ /*
+ Check if the next value can be taken from the pre-fetched
+ sequence.
+ */
+ if (range.m_first_tuple_id != range.m_last_tuple_id &&
+ range.m_first_tuple_id + step <= range.m_last_tuple_id)
{
assert(range.m_first_tuple_id < range.m_last_tuple_id);
- tupleId = ++range.m_first_tuple_id;
- DBUG_PRINT("info", ("next cached value %lu", (ulong)tupleId));
+ range.m_first_tuple_id += step;
+ tupleId = range.m_first_tuple_id;
+ DBUG_PRINT("info", ("Next cached value %lu", (ulong) tupleId));
}
else
{
+ /*
+ If start value is greater than step it is ignored
+ */
+ Uint64 offset = (start > step) ? 1 : start;
+
+ /*
+ Pre-fetch a number of values depending on cacheSize
+ */
if (cacheSize == 0)
cacheSize = 1;
+
DBUG_PRINT("info", ("reading %u values from database", (uint)cacheSize));
/*
* reserve next cacheSize entries in db. adds cacheSize to NEXTID
- * and returns first tupleId in the new range.
+ * and returns first tupleId in the new range. If tupleId's are
+ * incremented in steps then multiply the cacheSize with step size.
*/
- Uint64 opValue = cacheSize;
+ Uint64 opValue = cacheSize * step;
+
if (opTupleIdOnNdb(table, range, opValue, 0) == -1)
DBUG_RETURN(-1);
- tupleId = opValue;
+ DBUG_PRINT("info", ("Next value fetched from database %lu", (ulong) opValue));
+ DBUG_PRINT("info", ("Increasing %lu by offset %lu, increment is %lu", (ulong) (ulong) opValue, (ulong) offset, (ulong) step));
+ Uint64 current, next;
+ Uint64 div = ((Uint64) (opValue + step - offset)) / step;
+ next = div * step + offset;
+ current = (next < step) ? next : next - step;
+ tupleId = (opValue <= current) ? current : next;
+ DBUG_PRINT("info", ("Returning %lu", (ulong) tupleId));
+ range.m_first_tuple_id = tupleId;
}
DBUG_RETURN(0);
}
diff --git a/storage/ndb/src/ndbapi/NdbBlob.cpp b/storage/ndb/src/ndbapi/NdbBlob.cpp
index 25dcafdef53..a0244bde95b 100644
--- a/storage/ndb/src/ndbapi/NdbBlob.cpp
+++ b/storage/ndb/src/ndbapi/NdbBlob.cpp
@@ -536,7 +536,7 @@ int
NdbBlob::setTableKeyValue(NdbOperation* anOp)
{
DBUG_ENTER("NdbBlob::setTableKeyValue");
- DBUG_DUMP("info", theKeyBuf.data, 4 * theTable->m_keyLenInWords);
+ DBUG_DUMP("info", (uchar*) theKeyBuf.data, 4 * theTable->m_keyLenInWords);
const Uint32* data = (const Uint32*)theKeyBuf.data;
const unsigned columns = theTable->m_columns.size();
unsigned pos = 0;
@@ -562,7 +562,8 @@ int
NdbBlob::setAccessKeyValue(NdbOperation* anOp)
{
DBUG_ENTER("NdbBlob::setAccessKeyValue");
- DBUG_DUMP("info", theAccessKeyBuf.data, 4 * theAccessTable->m_keyLenInWords);
+ DBUG_DUMP("info", (uchar*) theAccessKeyBuf.data,
+ 4 * theAccessTable->m_keyLenInWords);
const Uint32* data = (const Uint32*)theAccessKeyBuf.data;
const unsigned columns = theAccessTable->m_columns.size();
unsigned pos = 0;
@@ -587,7 +588,7 @@ NdbBlob::setPartKeyValue(NdbOperation* anOp, Uint32 part)
{
DBUG_ENTER("NdbBlob::setPartKeyValue");
DBUG_PRINT("info", ("dist=%u part=%u packkey=", getDistKey(part), part));
- DBUG_DUMP("info", thePackKeyBuf.data, 4 * thePackKeyBuf.size);
+ DBUG_DUMP("info", (uchar*) thePackKeyBuf.data, 4 * thePackKeyBuf.size);
// TODO use attr ids after compatibility with 4.1.7 not needed
if (anOp->equal("PK", thePackKeyBuf.data) == -1 ||
anOp->equal("DIST", getDistKey(part)) == -1 ||
@@ -1261,6 +1262,7 @@ NdbBlob::deletePartsUnknown(Uint32 part)
DBUG_RETURN(-1);
}
tOp->m_abortOption= NdbOperation::AO_IgnoreError;
+ tOp->m_noErrorPropagation = true;
n++;
}
DBUG_PRINT("info", ("bat=%u", bat));
@@ -1597,6 +1599,7 @@ NdbBlob::preExecute(NdbTransaction::ExecType anExecType, bool& batch)
}
if (isWriteOp()) {
tOp->m_abortOption = NdbOperation::AO_IgnoreError;
+ tOp->m_noErrorPropagation = true;
}
theHeadInlineReadOp = tOp;
// execute immediately
@@ -1643,6 +1646,7 @@ NdbBlob::preExecute(NdbTransaction::ExecType anExecType, bool& batch)
}
if (isWriteOp()) {
tOp->m_abortOption = NdbOperation::AO_IgnoreError;
+ tOp->m_noErrorPropagation = true;
}
theHeadInlineReadOp = tOp;
// execute immediately
diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
index 00acfe62ad9..a82983fca8c 100644
--- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
+++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
@@ -41,6 +41,7 @@
#include <NdbEventOperation.hpp>
#include "NdbEventOperationImpl.hpp"
#include <signaldata/AlterTable.hpp>
+#include "ndb_internal.hpp"
#include <EventLogger.hpp>
extern EventLogger g_eventLogger;
@@ -2838,7 +2839,7 @@ send_report:
data[5]= apply_gci >> 32;
data[6]= latest_gci & ~(Uint32)0;
data[7]= latest_gci >> 32;
- m_ndb->theImpl->send_event_report(data,8);
+ Ndb_internal::send_event_report(m_ndb, data,8);
#ifdef VM_TRACE
assert(m_total_alloc >= m_free_data_sz);
#endif
diff --git a/storage/ndb/src/ndbapi/NdbOperation.cpp b/storage/ndb/src/ndbapi/NdbOperation.cpp
index 903372ddb9d..50531292e40 100644
--- a/storage/ndb/src/ndbapi/NdbOperation.cpp
+++ b/storage/ndb/src/ndbapi/NdbOperation.cpp
@@ -76,7 +76,8 @@ NdbOperation::NdbOperation(Ndb* aNdb, NdbOperation::Type aType) :
m_keyInfoGSN(GSN_KEYINFO),
m_attrInfoGSN(GSN_ATTRINFO),
theBlobList(NULL),
- m_abortOption(-1)
+ m_abortOption(-1),
+ m_noErrorPropagation(false)
{
theReceiver.init(NdbReceiver::NDB_OPERATION, this);
theError.code = 0;
@@ -101,7 +102,8 @@ NdbOperation::setErrorCode(int anErrorCode)
theError.code = anErrorCode;
theNdbCon->theErrorLine = theErrorLine;
theNdbCon->theErrorOperation = this;
- theNdbCon->setOperationErrorCode(anErrorCode);
+ if (!(m_abortOption == AO_IgnoreError && m_noErrorPropagation))
+ theNdbCon->setOperationErrorCode(anErrorCode);
}
/******************************************************************************
@@ -116,6 +118,7 @@ NdbOperation::setErrorCodeAbort(int anErrorCode)
theError.code = anErrorCode;
theNdbCon->theErrorLine = theErrorLine;
theNdbCon->theErrorOperation = this;
+ // ignore m_noErrorPropagation
theNdbCon->setOperationErrorCodeAbort(anErrorCode);
}
@@ -161,6 +164,7 @@ NdbOperation::init(const NdbTableImpl* tab, NdbTransaction* myConnection){
theMagicNumber = 0xABCDEF01;
theBlobList = NULL;
m_abortOption = -1;
+ m_noErrorPropagation = false;
m_no_disk_flag = 1;
tSignal = theNdb->getSignal();
diff --git a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp
index ced9b18bd55..c9459ff911c 100644
--- a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp
+++ b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp
@@ -608,7 +608,6 @@ NdbOperation::setAnyValue(Uint32 any_value)
const NdbColumnImpl* impl =
&NdbColumnImpl::getImpl(* NdbDictionary::Column::ANY_VALUE);
OperationType tOpType = theOperationType;
- OperationStatus tStatus = theStatus;
switch(tOpType){
case DeleteRequest:{
diff --git a/storage/ndb/src/ndbapi/NdbOperationInt.cpp b/storage/ndb/src/ndbapi/NdbOperationInt.cpp
index 0df1dbfe2c8..f69211cb78b 100644
--- a/storage/ndb/src/ndbapi/NdbOperationInt.cpp
+++ b/storage/ndb/src/ndbapi/NdbOperationInt.cpp
@@ -1023,7 +1023,7 @@ NdbOperation::branch_col(Uint32 type,
DBUG_PRINT("enter", ("type: %u col:%u val: 0x%lx len: %u label: %u",
type, ColId, (long) val, len, Label));
if (val != NULL)
- DBUG_DUMP("value", (char*)val, len);
+ DBUG_DUMP("value", (uchar*)val, len);
if (initial_interpreterCheck() == -1)
DBUG_RETURN(-1);
diff --git a/storage/ndb/src/ndbapi/NdbScanOperation.cpp b/storage/ndb/src/ndbapi/NdbScanOperation.cpp
index dc9a74ae11c..fa94bf8d836 100644
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp
@@ -1311,7 +1311,7 @@ NdbIndexScanOperation::getKeyFromSCANTABREQ(Uint32* data, Uint32 size)
}
pos += rem;
}
- DBUG_DUMP("key", (char*)data, size << 2);
+ DBUG_DUMP("key", (uchar*) data, size << 2);
DBUG_RETURN(size);
}
diff --git a/storage/ndb/src/ndbapi/ndb_internal.hpp b/storage/ndb/src/ndbapi/ndb_internal.hpp
new file mode 100644
index 00000000000..f5f37f95a04
--- /dev/null
+++ b/storage/ndb/src/ndbapi/ndb_internal.hpp
@@ -0,0 +1,26 @@
+/* Copyright (C) 2007 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "NdbImpl.hpp"
+
+class Ndb_internal
+{
+private:
+ friend class NdbEventBuffer;
+ Ndb_internal() {}
+ virtual ~Ndb_internal() {}
+ static int send_event_report(Ndb *ndb, Uint32 *data, Uint32 length)
+ { return ndb->theImpl->send_event_report(data, length); }
+};
diff --git a/storage/ndb/src/ndbapi/ndberror.c b/storage/ndb/src/ndbapi/ndberror.c
index 8c40ddf2116..914acd17c08 100644
--- a/storage/ndb/src/ndbapi/ndberror.c
+++ b/storage/ndb/src/ndbapi/ndberror.c
@@ -19,6 +19,9 @@
#include <ndberror.h>
#include <m_string.h>
+#include "../mgmsrv/ndb_mgmd_error.h"
+
+
typedef struct ErrorBundle {
int code;
int mysql_code;
@@ -179,7 +182,7 @@ ErrorBundle ErrorCodes[] = {
{ 873, DMEC, TR, "Out of attrinfo records for scan in tuple manager" },
{ 899, DMEC, TR, "Rowid already allocated" },
{ 1217, DMEC, TR, "Out of operation records in local data manager (increase MaxNoOfLocalOperations)" },
- { 1220, DMEC, TR, "REDO log files overloaded, consult online manual (decrease TimeBetweenLocalCheckpoints, and|or increase NoOfFragmentLogFiles)" },
+ { 1220, DMEC, TR, "REDO log files overloaded, consult online manual (increase FragmentLogFileSize)" },
{ 1222, DMEC, TR, "Out of transaction markers in LQH" },
{ 4021, DMEC, TR, "Out of Send Buffer space in NDB API" },
{ 4022, DMEC, TR, "Out of Send Buffer space in NDB API" },
@@ -619,6 +622,33 @@ ErrorBundle ErrorCodes[] = {
{ 4273, DMEC, IE, "No blob table in dict cache" },
{ 4274, DMEC, IE, "Corrupted main table PK in blob operation" },
{ 4275, DMEC, AE, "The blob method is incompatible with operation type or lock mode" },
+
+ { NO_CONTACT_WITH_PROCESS, DMEC, AE,
+ "No contact with the process (dead ?)."},
+ { WRONG_PROCESS_TYPE, DMEC, AE,
+ "The process has wrong type. Expected a DB process."},
+ { SEND_OR_RECEIVE_FAILED, DMEC, AE,
+ "Send to process or receive failed."},
+ { INVALID_ERROR_NUMBER, DMEC, AE,
+ "Invalid error number. Should be >= 0."},
+ { INVALID_TRACE_NUMBER, DMEC, AE,
+ "Invalid trace number."},
+ { INVALID_BLOCK_NAME, DMEC, AE,
+ "Invalid block name"},
+ { NODE_SHUTDOWN_IN_PROGESS, DMEC, AE,
+ "Node shutdown in progress" },
+ { SYSTEM_SHUTDOWN_IN_PROGRESS, DMEC, AE,
+ "System shutdown in progress" },
+ { NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH, DMEC, AE,
+ "Node shutdown would cause system crash" },
+ { UNSUPPORTED_NODE_SHUTDOWN, DMEC, AE,
+ "Unsupported multi node shutdown. Abort option required." },
+ { NODE_NOT_API_NODE, DMEC, AE,
+ "The specified node is not an API node." },
+ { OPERATION_NOT_ALLOWED_START_STOP, DMEC, AE,
+ "Operation not allowed while nodes are starting or stopping."},
+ { NO_CONTACT_WITH_DB_NODES, DMEC, AE,
+ "No contact with database nodes" }
};
static
diff --git a/storage/ndb/test/ndbapi/testMgm.cpp b/storage/ndb/test/ndbapi/testMgm.cpp
index cc074087bdb..e43972c8c29 100644
--- a/storage/ndb/test/ndbapi/testMgm.cpp
+++ b/storage/ndb/test/ndbapi/testMgm.cpp
@@ -212,6 +212,76 @@ int runTestApiSession(NDBT_Context* ctx, NDBT_Step* step)
}
}
+int runTestApiConnectTimeout(NDBT_Context* ctx, NDBT_Step* step)
+{
+ char *mgm= ctx->getRemoteMgm();
+ int result= NDBT_FAILED;
+ int cc= 0;
+ int mgmd_nodeid= 0;
+ ndb_mgm_reply reply;
+
+ NdbMgmHandle h;
+ h= ndb_mgm_create_handle();
+ ndb_mgm_set_connectstring(h, mgm);
+
+ ndbout << "TEST connect timeout" << endl;
+
+ ndb_mgm_set_timeout(h, 3000);
+
+ struct timeval tstart, tend;
+ int secs;
+ timerclear(&tstart);
+ timerclear(&tend);
+ gettimeofday(&tstart,NULL);
+
+ ndb_mgm_connect(h,0,0,0);
+
+ gettimeofday(&tend,NULL);
+
+ secs= tend.tv_sec - tstart.tv_sec;
+ ndbout << "Took about: " << secs <<" seconds"<<endl;
+
+ if(secs < 4)
+ result= NDBT_OK;
+ else
+ goto done;
+
+ ndb_mgm_set_connectstring(h, mgm);
+
+ ndbout << "TEST connect timeout" << endl;
+
+ ndb_mgm_destroy_handle(&h);
+
+ h= ndb_mgm_create_handle();
+ ndb_mgm_set_connectstring(h, "1.1.1.1");
+
+ ndbout << "TEST connect timeout (invalid host)" << endl;
+
+ ndb_mgm_set_timeout(h, 3000);
+
+ timerclear(&tstart);
+ timerclear(&tend);
+ gettimeofday(&tstart,NULL);
+
+ ndb_mgm_connect(h,0,0,0);
+
+ gettimeofday(&tend,NULL);
+
+ secs= tend.tv_sec - tstart.tv_sec;
+ ndbout << "Took about: " << secs <<" seconds"<<endl;
+
+ if(secs < 4)
+ result= NDBT_OK;
+ else
+ result= NDBT_FAILED;
+
+done:
+ ndb_mgm_disconnect(h);
+ ndb_mgm_destroy_handle(&h);
+
+ return result;
+}
+
int runTestApiTimeoutBasic(NDBT_Context* ctx, NDBT_Step* step)
{
char *mgm= ctx->getRemoteMgm();
@@ -728,6 +798,11 @@ TESTCASE("ApiSessionFailure",
INITIALIZER(runTestApiSession);
}
+TESTCASE("ApiConnectTimeout",
+ "Connect timeout tests for MGMAPI"){
+ INITIALIZER(runTestApiConnectTimeout);
+
+}
TESTCASE("ApiTimeoutBasic",
"Basic timeout tests for MGMAPI"){
INITIALIZER(runTestApiTimeoutBasic);
diff --git a/storage/ndb/test/ndbapi/testNodeRestart.cpp b/storage/ndb/test/ndbapi/testNodeRestart.cpp
index 85dbc2aab2a..97b831963fc 100644
--- a/storage/ndb/test/ndbapi/testNodeRestart.cpp
+++ b/storage/ndb/test/ndbapi/testNodeRestart.cpp
@@ -1629,6 +1629,85 @@ runBug28023(NDBT_Context* ctx, NDBT_Step* step)
return NDBT_FAILED;
}
}
+
+ return NDBT_OK;
+}
+
+
+int
+runBug28717(NDBT_Context* ctx, NDBT_Step* step)
+{
+ int result = NDBT_OK;
+ int loops = ctx->getNumLoops();
+ int records = ctx->getNumRecords();
+ Ndb* pNdb = GETNDB(step);
+ NdbRestarter res;
+
+ if (res.getNumDbNodes() < 4)
+ {
+ return NDBT_OK;
+ }
+
+ int master = res.getMasterNodeId();
+ int node0 = res.getRandomNodeOtherNodeGroup(master, rand());
+ int node1 = res.getRandomNodeSameNodeGroup(node0, rand());
+
+ ndbout_c("master: %d node0: %d node1: %d", master, node0, node1);
+
+ if (res.restartOneDbNode(node0, false, true, true))
+ {
+ return NDBT_FAILED;
+ }
+
+ {
+ int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_CHECKPOINT, 0 };
+ NdbLogEventHandle handle =
+ ndb_mgm_create_logevent_handle(res.handle, filter);
+
+
+ int dump[] = { DumpStateOrd::DihStartLcpImmediately };
+ struct ndb_logevent event;
+
+ for (Uint32 i = 0; i<3; i++)
+ {
+ res.dumpStateOneNode(master, dump, 1);
+ while(ndb_logevent_get_next(handle, &event, 0) >= 0 &&
+ event.type != NDB_LE_LocalCheckpointStarted);
+ while(ndb_logevent_get_next(handle, &event, 0) >= 0 &&
+ event.type != NDB_LE_LocalCheckpointCompleted);
+ }
+ }
+
+ if (res.waitNodesNoStart(&node0, 1))
+ return NDBT_FAILED;
+
+ int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
+
+ if (res.dumpStateOneNode(node0, val2, 2))
+ return NDBT_FAILED;
+
+ if (res.insertErrorInNode(node0, 5010))
+ return NDBT_FAILED;
+
+ if (res.insertErrorInNode(node1, 1001))
+ return NDBT_FAILED;
+
+ if (res.startNodes(&node0, 1))
+ return NDBT_FAILED;
+
+ NdbSleep_SecSleep(3);
+
+ if (res.insertErrorInNode(node1, 0))
+ return NDBT_FAILED;
+
+ if (res.waitNodesNoStart(&node0, 1))
+ return NDBT_FAILED;
+
+ if (res.startNodes(&node0, 1))
+ return NDBT_FAILED;
+
+ if (res.waitClusterStarted())
+ return NDBT_FAILED;
return NDBT_OK;
}
@@ -1993,6 +2072,9 @@ TESTCASE("Bug27466", ""){
TESTCASE("Bug28023", ""){
INITIALIZER(runBug28023);
}
+TESTCASE("Bug28717", ""){
+ INITIALIZER(runBug28717);
+}
NDBT_TESTSUITE_END(testNodeRestart);
int main(int argc, const char** argv){
diff --git a/storage/ndb/test/run-test/conf-dl145a.cnf b/storage/ndb/test/run-test/conf-dl145a.cnf
index ea344f1a62a..5f61bee755d 100644
--- a/storage/ndb/test/run-test/conf-dl145a.cnf
+++ b/storage/ndb/test/run-test/conf-dl145a.cnf
@@ -21,3 +21,6 @@ BackupMemory = 64M
MaxNoOfConcurrentScans = 100
MaxNoOfSavedMessages= 1000
SendBufferMemory = 2M
+NoOfFragmentLogFiles = 4
+FragmentLogFileSize = 64M
+
diff --git a/storage/ndb/test/run-test/daily-basic-tests.txt b/storage/ndb/test/run-test/daily-basic-tests.txt
index 2cd3942bf07..0e1cdfc647e 100644
--- a/storage/ndb/test/run-test/daily-basic-tests.txt
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt
@@ -567,6 +567,10 @@ max-time: 1500
cmd: testDict
args: -n CreateAndDrop
+max-time: 1000
+cmd: testNodeRestart
+args: -n Bug28717 T1
+
max-time: 1500
cmd: testDict
args: -n CreateAndDropAtRandom -l 200 T1
@@ -706,7 +710,7 @@ args: -n ExecuteAsynch T1
max-time: 1000
cmd: testNdbApi
-args: -n BugBug28443
+args: -n Bug28443
#max-time: 500
#cmd: testInterpreter
@@ -894,6 +898,10 @@ max-time: 120
cmd: testMgm
args: -n ApiSessionFailure T1
+max-time: 15
+cmd: testMgm
+args: -n ApiConnectTimeout T1
+
max-time: 120
cmd: testMgm
args: -n ApiTimeoutBasic T1
diff --git a/storage/ndb/test/tools/hugoFill.cpp b/storage/ndb/test/tools/hugoFill.cpp
index 713c2ca5152..20ceb61b066 100644
--- a/storage/ndb/test/tools/hugoFill.cpp
+++ b/storage/ndb/test/tools/hugoFill.cpp
@@ -30,9 +30,11 @@ int main(int argc, const char** argv){
const char* _tabname = NULL;
int _help = 0;
int _batch = 512;
+ const char* db = "TEST_DB";
struct getargs args[] = {
{ "batch", 'b', arg_integer, &_batch, "Number of operations in each transaction", "batch" },
+ { "database", 'd', arg_string, &db, "Database", "" },
{ "usage", '?', arg_flag, &_help, "Print help", "" }
};
int num_args = sizeof(args) / sizeof(args[0]);
@@ -55,7 +57,7 @@ int main(int argc, const char** argv){
{
return NDBT_ProgramExit(NDBT_FAILED);
}
- Ndb MyNdb(&con, "TEST_DB" );
+ Ndb MyNdb(&con, db);
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
diff --git a/storage/ndb/tools/delete_all.cpp b/storage/ndb/tools/delete_all.cpp
index 4e3037f1941..1bf89f5a32f 100644
--- a/storage/ndb/tools/delete_all.cpp
+++ b/storage/ndb/tools/delete_all.cpp
@@ -36,16 +36,16 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "transactional", 't', "Single transaction (may run out of operations)",
- (gptr*) &_transactional, (gptr*) &_transactional, 0,
+ (uchar**) &_transactional, (uchar**) &_transactional, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "tupscan", 999, "Run tupscan",
- (gptr*) &_tupscan, (gptr*) &_tupscan, 0,
+ (uchar**) &_tupscan, (uchar**) &_tupscan, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "diskscan", 999, "Run diskcan",
- (gptr*) &_diskscan, (gptr*) &_diskscan, 0,
+ (uchar**) &_diskscan, (uchar**) &_diskscan, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/desc.cpp b/storage/ndb/tools/desc.cpp
index 9eb0cf67ceb..831005139de 100644
--- a/storage/ndb/tools/desc.cpp
+++ b/storage/ndb/tools/desc.cpp
@@ -39,16 +39,16 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "unqualified", 'u', "Use unqualified table names",
- (gptr*) &_unqualified, (gptr*) &_unqualified, 0,
+ (uchar**) &_unqualified, (uchar**) &_unqualified, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "extra-partition-info", 'p', "Print more info per partition",
- (gptr*) &_partinfo, (gptr*) &_partinfo, 0,
+ (uchar**) &_partinfo, (uchar**) &_partinfo, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "retries", 'r', "Retry every second for # retries",
- (gptr*) &_retries, (gptr*) &_retries, 0,
+ (uchar**) &_retries, (uchar**) &_retries, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/drop_index.cpp b/storage/ndb/tools/drop_index.cpp
index 256c40e1924..ec88f331a80 100644
--- a/storage/ndb/tools/drop_index.cpp
+++ b/storage/ndb/tools/drop_index.cpp
@@ -30,7 +30,7 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/drop_tab.cpp b/storage/ndb/tools/drop_tab.cpp
index a7accb904a4..8d07afbbf50 100644
--- a/storage/ndb/tools/drop_tab.cpp
+++ b/storage/ndb/tools/drop_tab.cpp
@@ -30,7 +30,7 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/listTables.cpp b/storage/ndb/tools/listTables.cpp
index 6a73bcc54f5..45129cb34af 100644
--- a/storage/ndb/tools/listTables.cpp
+++ b/storage/ndb/tools/listTables.cpp
@@ -256,22 +256,22 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_show_tables"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "loops", 'l', "loops",
- (gptr*) &_loops, (gptr*) &_loops, 0,
+ (uchar**) &_loops, (uchar**) &_loops, 0,
GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 },
{ "type", 't', "type",
- (gptr*) &_type, (gptr*) &_type, 0,
+ (uchar**) &_type, (uchar**) &_type, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "unqualified", 'u', "Use unqualified table names",
- (gptr*) &_unqualified, (gptr*) &_unqualified, 0,
+ (uchar**) &_unqualified, (uchar**) &_unqualified, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "parsable", 'p', "Return output suitable for mysql LOAD DATA INFILE",
- (gptr*) &_parsable, (gptr*) &_parsable, 0,
+ (uchar**) &_parsable, (uchar**) &_parsable, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "show-temp-status", OPT_SHOW_TMP_STATUS, "Show table temporary flag",
- (gptr*) &show_temp_status, (gptr*) &show_temp_status, 0,
+ (uchar**) &show_temp_status, (uchar**) &show_temp_status, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/ndb_config.cpp b/storage/ndb/tools/ndb_config.cpp
index 31fc59a8b83..af36103f947 100644
--- a/storage/ndb/tools/ndb_config.cpp
+++ b/storage/ndb/tools/ndb_config.cpp
@@ -58,37 +58,37 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_config"),
{ "nodes", 256, "Print nodes",
- (gptr*) &g_nodes, (gptr*) &g_nodes,
+ (uchar**) &g_nodes, (uchar**) &g_nodes,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "connections", 256, "Print connections",
- (gptr*) &g_connections, (gptr*) &g_connections,
+ (uchar**) &g_connections, (uchar**) &g_connections,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "query", 'q', "Query option(s)",
- (gptr*) &g_query, (gptr*) &g_query,
+ (uchar**) &g_query, (uchar**) &g_query,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "host", 256, "Host",
- (gptr*) &g_host, (gptr*) &g_host,
+ (uchar**) &g_host, (uchar**) &g_host,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "type", 258, "Type of node/connection",
- (gptr*) &g_type, (gptr*) &g_type,
+ (uchar**) &g_type, (uchar**) &g_type,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "id", 258, "Nodeid",
- (gptr*) &g_nodeid, (gptr*) &g_nodeid,
+ (uchar**) &g_nodeid, (uchar**) &g_nodeid,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "nodeid", 258, "Nodeid",
- (gptr*) &g_nodeid, (gptr*) &g_nodeid,
+ (uchar**) &g_nodeid, (uchar**) &g_nodeid,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "fields", 'f', "Field separator",
- (gptr*) &g_field_delimiter, (gptr*) &g_field_delimiter,
+ (uchar**) &g_field_delimiter, (uchar**) &g_field_delimiter,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "rows", 'r', "Row separator",
- (gptr*) &g_row_delimiter, (gptr*) &g_row_delimiter,
+ (uchar**) &g_row_delimiter, (uchar**) &g_row_delimiter,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "config-file", 256, "Path to config.ini",
- (gptr*) &g_config_file, (gptr*) &g_config_file,
+ (uchar**) &g_config_file, (uchar**) &g_config_file,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "mycnf", 256, "Read config from my.cnf",
- (gptr*) &g_mycnf, (gptr*) &g_mycnf,
+ (uchar**) &g_mycnf, (uchar**) &g_mycnf,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/ndb_error_reporter b/storage/ndb/tools/ndb_error_reporter
index 2b5aadb6171..7ad7a2f478a 100644
--- a/storage/ndb/tools/ndb_error_reporter
+++ b/storage/ndb/tools/ndb_error_reporter
@@ -62,13 +62,13 @@ foreach my $node (@nodes)
(($config_get_fs)?" with filesystem":"").
"\n\n";
my $recurse= ($config_get_fs)?'-r ':'';
- system 'scp '.$recurse.$config_username.config($node,'host').
+ system 'scp -p '.$recurse.$config_username.config($node,'host').
':'.config($node,'datadir')."/ndb_".$node."* ".
"$reportdir/\n";
}
print "\n\n Copying configuration file...\n\n\t$config_file\n\n";
-system "cp $config_file $reportdir/";
+system "cp -p $config_file $reportdir/";
my $r = system 'bzip2 2>&1 > /dev/null < /dev/null';
my $outfile;
diff --git a/storage/ndb/tools/restore/Restore.cpp b/storage/ndb/tools/restore/Restore.cpp
index f99cacfc613..516dfe24855 100644
--- a/storage/ndb/tools/restore/Restore.cpp
+++ b/storage/ndb/tools/restore/Restore.cpp
@@ -873,13 +873,32 @@ bool RestoreDataIterator::readFragmentHeader(int & ret, Uint32 *fragmentId)
debug << "RestoreDataIterator::getNextFragment" << endl;
- if (buffer_read(&Header, sizeof(Header), 1) != 1){
+ while (1)
+ {
+ /* read first part of header */
+ if (buffer_read(&Header, 8, 1) != 1)
+ {
+ ret = 0;
+ return false;
+ } // if
+
+ /* skip if EMPTY_ENTRY */
+ Header.SectionType = ntohl(Header.SectionType);
+ Header.SectionLength = ntohl(Header.SectionLength);
+ if (Header.SectionType == BackupFormat::EMPTY_ENTRY)
+ {
+ void *tmp;
+ buffer_get_ptr(&tmp, Header.SectionLength*4-8, 1);
+ continue;
+ }
+ break;
+ }
+ /* read rest of header */
+ if (buffer_read(((char*)&Header)+8, sizeof(Header)-8, 1) != 1)
+ {
ret = 0;
return false;
- } // if
-
- Header.SectionType = ntohl(Header.SectionType);
- Header.SectionLength = ntohl(Header.SectionLength);
+ }
Header.TableId = ntohl(Header.TableId);
Header.FragmentNo = ntohl(Header.FragmentNo);
Header.ChecksumType = ntohl(Header.ChecksumType);
diff --git a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp
index b7db8145c56..89f680a80e4 100644
--- a/storage/ndb/tools/restore/consumer_restore.cpp
+++ b/storage/ndb/tools/restore/consumer_restore.cpp
@@ -424,13 +424,14 @@ error:
bool BackupRestore::translate_frm(NdbDictionary::Table *table)
{
- const void *pack_data, *data, *new_pack_data;
+ uchar *pack_data, *data, *new_pack_data;
char *new_data;
- uint data_len, new_data_len, new_pack_len;
+ uint new_data_len;
+ size_t data_len, new_pack_len;
uint no_parts, extra_growth;
DBUG_ENTER("translate_frm");
- pack_data = table->getFrmData();
+ pack_data = (uchar*) table->getFrmData();
no_parts = table->getFragmentCount();
/*
Add max 4 characters per partition to handle worst case
@@ -442,7 +443,7 @@ bool BackupRestore::translate_frm(NdbDictionary::Table *table)
{
DBUG_RETURN(TRUE);
}
- if ((new_data = my_malloc(data_len + extra_growth, MYF(0))))
+ if ((new_data = (char*) my_malloc(data_len + extra_growth, MYF(0))))
{
DBUG_RETURN(TRUE);
}
@@ -451,7 +452,7 @@ bool BackupRestore::translate_frm(NdbDictionary::Table *table)
my_free(new_data, MYF(0));
DBUG_RETURN(TRUE);
}
- if (packfrm((const void*)new_data, new_data_len,
+ if (packfrm((uchar*) new_data, new_data_len,
&new_pack_data, &new_pack_len))
{
my_free(new_data, MYF(0));
@@ -1158,19 +1159,22 @@ void BackupRestore::tuple_a(restore_callback_t *cb)
char * dataPtr = attr_data->string_value;
Uint32 length = 0;
- const unsigned char * src = (const unsigned char *)dataPtr;
- switch(attr_desc->m_column->getType()){
- case NdbDictionary::Column::Varchar:
- case NdbDictionary::Column::Varbinary:
- length = src[0] + 1;
- break;
- case NdbDictionary::Column::Longvarchar:
- case NdbDictionary::Column::Longvarbinary:
- length = src[0] + (src[1] << 8) + 2;
- break;
- default:
- length = attr_data->size;
- break;
+ if (!attr_data->null)
+ {
+ const unsigned char * src = (const unsigned char *)dataPtr;
+ switch(attr_desc->m_column->getType()){
+ case NdbDictionary::Column::Varchar:
+ case NdbDictionary::Column::Varbinary:
+ length = src[0] + 1;
+ break;
+ case NdbDictionary::Column::Longvarchar:
+ case NdbDictionary::Column::Longvarbinary:
+ length = src[0] + (src[1] << 8) + 2;
+ break;
+ default:
+ length = attr_data->size;
+ break;
+ }
}
if (j == 0 && tup.getTable()->have_auto_inc(i))
tup.getTable()->update_max_auto_val(dataPtr,size*arraySize);
diff --git a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp
index 79aebbaac45..ec2550118d3 100644
--- a/storage/ndb/tools/restore/restore_main.cpp
+++ b/storage/ndb/tools/restore/restore_main.cpp
@@ -100,99 +100,99 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_restore"),
{ "connect", 'c', "same as --connect-string",
- (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,
+ (uchar**) &opt_connect_str, (uchar**) &opt_connect_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "nodeid", 'n', "Backup files from node with id",
- (gptr*) &ga_nodeId, (gptr*) &ga_nodeId, 0,
+ (uchar**) &ga_nodeId, (uchar**) &ga_nodeId, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "backupid", 'b', "Backup id",
- (gptr*) &ga_backupId, (gptr*) &ga_backupId, 0,
+ (uchar**) &ga_backupId, (uchar**) &ga_backupId, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "restore_data", 'r',
"Restore table data/logs into NDB Cluster using NDBAPI",
- (gptr*) &_restore_data, (gptr*) &_restore_data, 0,
+ (uchar**) &_restore_data, (uchar**) &_restore_data, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "restore_meta", 'm',
"Restore meta data into NDB Cluster using NDBAPI",
- (gptr*) &_restore_meta, (gptr*) &_restore_meta, 0,
+ (uchar**) &_restore_meta, (uchar**) &_restore_meta, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "no-upgrade", 'u',
"Don't upgrade array type for var attributes, which don't resize VAR data and don't change column attributes",
- (gptr*) &ga_no_upgrade, (gptr*) &ga_no_upgrade, 0,
+ (uchar**) &ga_no_upgrade, (uchar**) &ga_no_upgrade, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "no-restore-disk-objects", 'd',
"Dont restore disk objects (tablespace/logfilegroups etc)",
- (gptr*) &_no_restore_disk, (gptr*) &_no_restore_disk, 0,
+ (uchar**) &_no_restore_disk, (uchar**) &_no_restore_disk, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "restore_epoch", 'e',
"Restore epoch info into the status table. Convenient on a MySQL Cluster "
"replication slave, for starting replication. The row in "
NDB_REP_DB "." NDB_APPLY_TABLE " with id 0 will be updated/inserted.",
- (gptr*) &ga_restore_epoch, (gptr*) &ga_restore_epoch, 0,
+ (uchar**) &ga_restore_epoch, (uchar**) &ga_restore_epoch, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "skip-table-check", 's', "Skip table structure check during restore of data",
- (gptr*) &ga_skip_table_check, (gptr*) &ga_skip_table_check, 0,
+ (uchar**) &ga_skip_table_check, (uchar**) &ga_skip_table_check, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "parallelism", 'p',
"No of parallel transactions during restore of data."
"(parallelism can be 1 to 1024)",
- (gptr*) &ga_nParallelism, (gptr*) &ga_nParallelism, 0,
+ (uchar**) &ga_nParallelism, (uchar**) &ga_nParallelism, 0,
GET_INT, REQUIRED_ARG, 128, 1, 1024, 0, 1, 0 },
{ "print", OPT_PRINT, "Print data and log to stdout",
- (gptr*) &_print, (gptr*) &_print, 0,
+ (uchar**) &_print, (uchar**) &_print, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "print_data", OPT_PRINT_DATA, "Print data to stdout",
- (gptr*) &_print_data, (gptr*) &_print_data, 0,
+ (uchar**) &_print_data, (uchar**) &_print_data, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "print_meta", OPT_PRINT_META, "Print meta data to stdout",
- (gptr*) &_print_meta, (gptr*) &_print_meta, 0,
+ (uchar**) &_print_meta, (uchar**) &_print_meta, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "print_log", OPT_PRINT_LOG, "Print log to stdout",
- (gptr*) &_print_log, (gptr*) &_print_log, 0,
+ (uchar**) &_print_log, (uchar**) &_print_log, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "backup_path", OPT_BACKUP_PATH, "Path to backup files",
- (gptr*) &ga_backupPath, (gptr*) &ga_backupPath, 0,
+ (uchar**) &ga_backupPath, (uchar**) &ga_backupPath, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "dont_ignore_systab_0", 'f',
"Experimental. Do not ignore system table during restore.",
- (gptr*) &ga_dont_ignore_systab_0, (gptr*) &ga_dont_ignore_systab_0, 0,
+ (uchar**) &ga_dont_ignore_systab_0, (uchar**) &ga_dont_ignore_systab_0, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "ndb-nodegroup-map", OPT_NDB_NODEGROUP_MAP,
"Nodegroup map for ndbcluster. Syntax: list of (source_ng, dest_ng)",
- (gptr*) &opt_nodegroup_map_str,
- (gptr*) &opt_nodegroup_map_str,
+ (uchar**) &opt_nodegroup_map_str,
+ (uchar**) &opt_nodegroup_map_str,
0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "fields-enclosed-by", OPT_FIELDS_ENCLOSED_BY,
"Fields are enclosed by ...",
- (gptr*) &opt_fields_enclosed_by, (gptr*) &opt_fields_enclosed_by, 0,
+ (uchar**) &opt_fields_enclosed_by, (uchar**) &opt_fields_enclosed_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "fields-terminated-by", OPT_FIELDS_TERMINATED_BY,
"Fields are terminated by ...",
- (gptr*) &opt_fields_terminated_by,
- (gptr*) &opt_fields_terminated_by, 0,
+ (uchar**) &opt_fields_terminated_by,
+ (uchar**) &opt_fields_terminated_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "fields-optionally-enclosed-by", OPT_FIELDS_OPTIONALLY_ENCLOSED_BY,
"Fields are optionally enclosed by ...",
- (gptr*) &opt_fields_optionally_enclosed_by,
- (gptr*) &opt_fields_optionally_enclosed_by, 0,
+ (uchar**) &opt_fields_optionally_enclosed_by,
+ (uchar**) &opt_fields_optionally_enclosed_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "hex", OPT_HEX_FORMAT, "print binary types in hex format",
- (gptr*) &opt_hex_format, (gptr*) &opt_hex_format, 0,
+ (uchar**) &opt_hex_format, (uchar**) &opt_hex_format, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "tab", 'T', "Creates tab separated textfile for each table to "
"given path. (creates .txt files)",
- (gptr*) &tab_path, (gptr*) &tab_path, 0,
+ (uchar**) &tab_path, (uchar**) &tab_path, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "append", OPT_APPEND, "for --tab append data to file",
- (gptr*) &opt_append, (gptr*) &opt_append, 0,
+ (uchar**) &opt_append, (uchar**) &opt_append, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "lines-terminated-by", OPT_LINES_TERMINATED_BY, "",
- (gptr*) &opt_lines_terminated_by, (gptr*) &opt_lines_terminated_by, 0,
+ (uchar**) &opt_lines_terminated_by, (uchar**) &opt_lines_terminated_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "verbose", OPT_VERBOSE,
"verbosity",
- (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0,
+ (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
GET_INT, REQUIRED_ARG, 1, 0, 255, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/select_all.cpp b/storage/ndb/tools/select_all.cpp
index e2072f30edf..23d5f95f3f7 100644
--- a/storage/ndb/tools/select_all.cpp
+++ b/storage/ndb/tools/select_all.cpp
@@ -54,43 +54,43 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "parallelism", 'p', "parallelism",
- (gptr*) &_parallelism, (gptr*) &_parallelism, 0,
+ (uchar**) &_parallelism, (uchar**) &_parallelism, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)",
- (gptr*) &_lock, (gptr*) &_lock, 0,
+ (uchar**) &_lock, (uchar**) &_lock, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "order", 'o', "Sort resultset according to index",
- (gptr*) &_order, (gptr*) &_order, 0,
+ (uchar**) &_order, (uchar**) &_order, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "descending", 'z', "Sort descending (requires order flag)",
- (gptr*) &_descending, (gptr*) &_descending, 0,
+ (uchar**) &_descending, (uchar**) &_descending, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "header", 'h', "Print header",
- (gptr*) &_header, (gptr*) &_header, 0,
+ (uchar**) &_header, (uchar**) &_header, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
{ "useHexFormat", 'x', "Output numbers in hexadecimal format",
- (gptr*) &_useHexFormat, (gptr*) &_useHexFormat, 0,
+ (uchar**) &_useHexFormat, (uchar**) &_useHexFormat, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "delimiter", 'D', "Column delimiter",
- (gptr*) &_delimiter, (gptr*) &_delimiter, 0,
+ (uchar**) &_delimiter, (uchar**) &_delimiter, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "disk", 256, "Dump disk ref",
- (gptr*) &_dumpDisk, (gptr*) &_dumpDisk, 0,
+ (uchar**) &_dumpDisk, (uchar**) &_dumpDisk, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "rowid", 256, "Dump rowid",
- (gptr*) &use_rowid, (gptr*) &use_rowid, 0,
+ (uchar**) &use_rowid, (uchar**) &use_rowid, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "gci", 256, "Dump gci",
- (gptr*) &use_gci, (gptr*) &use_gci, 0,
+ (uchar**) &use_gci, (uchar**) &use_gci, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "tupscan", 't', "Scan in tup order",
- (gptr*) &_tup, (gptr*) &_tup, 0,
+ (uchar**) &_tup, (uchar**) &_tup, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "nodata", 256, "Dont print data",
- (gptr*) &nodata, (gptr*) &nodata, 0,
+ (uchar**) &nodata, (uchar**) &nodata, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/select_count.cpp b/storage/ndb/tools/select_count.cpp
index 552d156b665..73982e886b5 100644
--- a/storage/ndb/tools/select_count.cpp
+++ b/storage/ndb/tools/select_count.cpp
@@ -43,13 +43,13 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "parallelism", 'p', "parallelism",
- (gptr*) &_parallelism, (gptr*) &_parallelism, 0,
+ (uchar**) &_parallelism, (uchar**) &_parallelism, 0,
GET_INT, REQUIRED_ARG, 240, 0, 0, 0, 0, 0 },
{ "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)",
- (gptr*) &_lock, (gptr*) &_lock, 0,
+ (uchar**) &_lock, (uchar**) &_lock, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/waiter.cpp b/storage/ndb/tools/waiter.cpp
index de8d15ac17a..a292ab9140a 100644
--- a/storage/ndb/tools/waiter.cpp
+++ b/storage/ndb/tools/waiter.cpp
@@ -46,17 +46,17 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "no-contact", 'n', "Wait for cluster no contact",
- (gptr*) &_no_contact, (gptr*) &_no_contact, 0,
+ (uchar**) &_no_contact, (uchar**) &_no_contact, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started",
- (gptr*) &_not_started, (gptr*) &_not_started, 0,
+ (uchar**) &_not_started, (uchar**) &_not_started, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "single-user", OPT_WAIT_STATUS_SINGLE_USER,
"Wait for cluster to enter single user mode",
- (gptr*) &_single_user, (gptr*) &_single_user, 0,
+ (uchar**) &_single_user, (uchar**) &_single_user, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "timeout", 't', "Timeout to wait",
- (gptr*) &_timeout, (gptr*) &_timeout, 0,
+ (uchar**) &_timeout, (uchar**) &_timeout, 0,
GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};