summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am2
-rw-r--r--include/m_string.h7
-rw-r--r--include/my_atomic.h10
-rw-r--r--include/my_base.h71
-rw-r--r--include/my_bit.h109
-rw-r--r--include/my_dbug.h2
-rw-r--r--include/my_global.h12
-rw-r--r--include/my_handler.h56
-rw-r--r--include/my_sys.h25
-rw-r--r--include/myisam.h26
10 files changed, 246 insertions, 74 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 8335da36e93..bf85409c36f 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -26,7 +26,7 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
my_getopt.h sslopt-longopts.h my_dir.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
m_ctype.h my_attribute.h $(HEADERS_GEN)
-noinst_HEADERS = config-win.h config-netware.h \
+noinst_HEADERS = config-win.h config-netware.h my_bit.h \
heap.h my_bitmap.h my_uctype.h \
myisam.h myisampack.h myisammrg.h ft_global.h\
mysys_err.h my_base.h help_start.h help_end.h \
diff --git a/include/m_string.h b/include/m_string.h
index 00fb4cb0656..036eb8fe4d6 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -67,7 +67,7 @@
# define bcopy(s, d, n) memcpy((d), (s), (n))
# define bcmp(A,B,C) memcmp((A),(B),(C))
# define bzero(A,B) memset((A),0,(B))
-# define bmove_align(A,B,C) memcpy((A),(B),(C))
+# define bmove_align(A,B,C) memcpy((A),(B),(C))
#endif
#if defined(__cplusplus)
@@ -129,7 +129,10 @@ extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len);
extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
#undef bcmp
#define bcmp(A,B,C) my_bcmp((A),(B),(C))
-#endif
+#define bzero_if_purify(A,B) bzero(A,B)
+#else
+#define bzero_if_purify(A,B)
+#endif /* HAVE_purify */
#ifndef bmove512
extern void bmove512(uchar *dst,const uchar *src,size_t len);
diff --git a/include/my_atomic.h b/include/my_atomic.h
index a1347d26401..ed439e5fe87 100644
--- a/include/my_atomic.h
+++ b/include/my_atomic.h
@@ -35,7 +35,7 @@
#ifdef HAVE_INLINE
#define make_atomic_add(S) \
-static inline int ## S my_atomic_add ## S( \
+STATIC_INLINE int ## S my_atomic_add ## S( \
int ## S volatile *a, int ## S v) \
{ \
make_atomic_add_body(S); \
@@ -43,7 +43,7 @@ static inline int ## S my_atomic_add ## S( \
}
#define make_atomic_swap(S) \
-static inline int ## S my_atomic_swap ## S( \
+STATIC_INLINE int ## S my_atomic_swap ## S( \
int ## S volatile *a, int ## S v) \
{ \
make_atomic_swap_body(S); \
@@ -51,7 +51,7 @@ static inline int ## S my_atomic_swap ## S( \
}
#define make_atomic_cas(S) \
-static inline int my_atomic_cas ## S(int ## S volatile *a, \
+STATIC_INLINE int my_atomic_cas ## S(int ## S volatile *a, \
int ## S *cmp, int ## S set) \
{ \
int8 ret; \
@@ -60,7 +60,7 @@ static inline int my_atomic_cas ## S(int ## S volatile *a, \
}
#define make_atomic_load(S) \
-static inline int ## S my_atomic_load ## S(int ## S volatile *a) \
+STATIC_INLINE int ## S my_atomic_load ## S(int ## S volatile *a) \
{ \
int ## S ret; \
make_atomic_load_body(S); \
@@ -68,7 +68,7 @@ static inline int ## S my_atomic_load ## S(int ## S volatile *a) \
}
#define make_atomic_store(S) \
-static inline void my_atomic_store ## S( \
+STATIC_INLINE void my_atomic_store ## S( \
int ## S volatile *a, int ## S v) \
{ \
make_atomic_store_body(S); \
diff --git a/include/my_base.h b/include/my_base.h
index 339554979a8..acf6920e21d 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* This file includes constants used with all databases */
-/* Author: Michael Widenius */
#ifndef _my_base_h
#define _my_base_h
@@ -48,10 +47,11 @@
#define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */
#define HA_OPEN_FROM_SQL_LAYER 64
#define HA_OPEN_MMAP 128 /* open memory mapped */
+#define HA_OPEN_COPY 256 /* Open copy (for repair) */
/* Internal temp table, used for temporary results */
-#define HA_OPEN_INTERNAL_TABLE 256
+#define HA_OPEN_INTERNAL_TABLE 512
- /* The following is parameter to ha_rkey() how to use key */
+/* The following is parameter to ha_rkey() how to use key */
/*
We define a complete-field prefix of a key value as a prefix where
@@ -137,7 +137,7 @@ enum ha_extra_function {
HA_EXTRA_RESET_STATE, /* Reset positions */
HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/
HA_EXTRA_NO_IGNORE_DUP_KEY,
- HA_EXTRA_PREPARE_FOR_DELETE,
+ HA_EXTRA_PREPARE_FOR_DROP,
HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */
HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */
/*
@@ -187,9 +187,14 @@ enum ha_extra_function {
Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be
executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY.
*/
- HA_EXTRA_INSERT_WITH_UPDATE
+ HA_EXTRA_INSERT_WITH_UPDATE,
+ /* Inform handler that we will do a rename */
+ HA_EXTRA_PREPARE_FOR_RENAME
};
+/* Compatible option, to be deleted in 6.0 */
+#define HA_EXTRA_PREPARE_FOR_DELETE HA_EXTRA_PREPARE_FOR_DROP
+
/* The following is parameter to ha_panic() */
enum ha_panic_function {
@@ -292,6 +297,8 @@ enum ha_base_keytype {
#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */
#define HA_OPTION_CREATE_FROM_ENGINE 256
#define HA_OPTION_RELIES_ON_SQL_LAYER 512
+#define HA_OPTION_NULL_FIELDS 1024
+#define HA_OPTION_PAGE_CHECKSUM 2048
#define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */
#define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */
@@ -302,6 +309,7 @@ enum ha_base_keytype {
#define HA_CREATE_TMP_TABLE 4
#define HA_CREATE_CHECKSUM 8
#define HA_CREATE_KEEP_FILES 16 /* don't overwrite .MYD and MYI */
+#define HA_CREATE_PAGE_CHECKSUM 32
#define HA_CREATE_DELAY_KEY_WRITE 64
#define HA_CREATE_RELIES_ON_SQL_LAYER 128
@@ -348,12 +356,15 @@ enum ha_base_keytype {
*/
#define HA_STATUS_AUTO 64
- /* Errorcodes given by functions */
+/*
+ Errorcodes given by handler functions
+
+ opt_sum_query() assumes these codes are > 1
+ Do not add error numbers before HA_ERR_FIRST.
+ If necessary to add lower numbers, change HA_ERR_FIRST accordingly.
+*/
+#define HA_ERR_FIRST 120 /* Copy of first error nr.*/
-/* opt_sum_query() assumes these codes are > 1 */
-/* Do not add error numbers before HA_ERR_FIRST. */
-/* If necessary to add lower numbers, change HA_ERR_FIRST accordingly. */
-#define HA_ERR_FIRST 120 /*Copy first error nr.*/
#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */
#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */
#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */
@@ -374,7 +385,7 @@ enum ha_base_keytype {
#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */
#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */
#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */
-#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting MyISAM tables in MERGE */
+#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */
#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */
#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */
#define HA_ERR_LOCK_WAIT_TIMEOUT 146
@@ -389,28 +400,33 @@ enum ha_base_keytype {
#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
-#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
+/* NULLs are not supported in spatial index */
+#define HA_ERR_NULL_IN_SPATIAL 158
#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */
#define HA_ERR_NO_PARTITION_FOUND 160 /* There's no partition in table for
given value */
#define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */
-#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr. */
-#define HA_ERR_FOREIGN_DUPLICATE_KEY 163 /* Upholding foreign key constraints
- would lead to a duplicate key
- error in some other table. */
-#define HA_ERR_TABLE_NEEDS_UPGRADE 164 /* The table changed in storage engine */
-#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */
+#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr */
+/*
+ Upholding foreign key constraints would lead to a duplicate key error
+ in some other table.
+*/
+#define HA_ERR_FOREIGN_DUPLICATE_KEY 163
+/* The table changed in storage engine */
+#define HA_ERR_TABLE_NEEDS_UPGRADE 164
+#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */
#define HA_ERR_AUTOINC_READ_FAILED 166 /* Failed to get next autoinc value */
#define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set row autoinc value */
#define HA_ERR_GENERIC 168 /* Generic error */
-#define HA_ERR_RECORD_IS_THE_SAME 169 /* row not actually updated :
- new values same as the old values */
-
-#define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this
- statement */
-#define HA_ERR_LAST 170 /*Copy last error nr.*/
-/* Add error numbers before HA_ERR_LAST and change it accordingly. */
+/* row not actually updated: new values same as the old values */
+#define HA_ERR_RECORD_IS_THE_SAME 169
+/* It is not possible to log this statement */
+#define HA_ERR_LOGGING_IMPOSSIBLE 170
+#define HA_ERR_NEW_FILE 171 /* New file format */
+#define HA_ERR_LAST 171 /* Copy of last error nr */
+
+/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
/* Other constants */
@@ -474,7 +490,7 @@ enum en_fieldtype {
};
enum data_file_type {
- STATIC_RECORD,DYNAMIC_RECORD,COMPRESSED_RECORD
+ STATIC_RECORD, DYNAMIC_RECORD, COMPRESSED_RECORD, BLOCK_RECORD
};
/* For key ranges */
@@ -526,4 +542,7 @@ typedef ulong ha_rows;
#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2)
+/* invalidator function reference for Query Cache */
+typedef void (* invalidator_by_filename)(const char * filename);
+
#endif /* _my_base_h */
diff --git a/include/my_bit.h b/include/my_bit.h
new file mode 100644
index 00000000000..2e464e89049
--- /dev/null
+++ b/include/my_bit.h
@@ -0,0 +1,109 @@
+/*
+ Some useful bit functions
+*/
+
+C_MODE_START
+#ifdef HAVE_INLINE
+
+extern const char _my_bits_nbits[256];
+extern const uchar _my_bits_reverse_table[256];
+
+/*
+ Find smallest X in 2^X >= value
+ This can be used to divide a number with value by doing a shift instead
+*/
+
+STATIC_INLINE uint my_bit_log2(ulong value)
+{
+ uint bit;
+ for (bit=0 ; value > 1 ; value>>=1, bit++) ;
+ return bit;
+}
+
+STATIC_INLINE uint my_count_bits(ulonglong v)
+{
+#if SIZEOF_LONG_LONG > 4
+ /* The following code is a bit faster on 16 bit machines than if we would
+ only shift v */
+ ulong v2=(ulong) (v >> 32);
+ return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
+ _my_bits_nbits[(uchar) (v >> 8)] +
+ _my_bits_nbits[(uchar) (v >> 16)] +
+ _my_bits_nbits[(uchar) (v >> 24)] +
+ _my_bits_nbits[(uchar) (v2)] +
+ _my_bits_nbits[(uchar) (v2 >> 8)] +
+ _my_bits_nbits[(uchar) (v2 >> 16)] +
+ _my_bits_nbits[(uchar) (v2 >> 24)]);
+#else
+ return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
+ _my_bits_nbits[(uchar) (v >> 8)] +
+ _my_bits_nbits[(uchar) (v >> 16)] +
+ _my_bits_nbits[(uchar) (v >> 24)]);
+#endif
+}
+
+STATIC_INLINE uint my_count_bits_ushort(ushort v)
+{
+ return _my_bits_nbits[v];
+}
+
+
+/*
+ Next highest power of two
+
+ SYNOPSIS
+ my_round_up_to_next_power()
+ v Value to check
+
+ RETURN
+ Next or equal power of 2
+ Note: 0 will return 0
+
+ NOTES
+ Algorithm by Sean Anderson, according to:
+ http://graphics.stanford.edu/~seander/bithacks.html
+ (Orignal code public domain)
+
+ Comments shows how this works with 01100000000000000000000000001011
+*/
+
+STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v)
+{
+ v--; /* 01100000000000000000000000001010 */
+ v|= v >> 1; /* 01110000000000000000000000001111 */
+ v|= v >> 2; /* 01111100000000000000000000001111 */
+ v|= v >> 4; /* 01111111110000000000000000001111 */
+ v|= v >> 8; /* 01111111111111111100000000001111 */
+ v|= v >> 16; /* 01111111111111111111111111111111 */
+ return v+1; /* 10000000000000000000000000000000 */
+}
+
+STATIC_INLINE uint32 my_clear_highest_bit(uint32 v)
+{
+ uint32 w=v >> 1;
+ w|= w >> 1;
+ w|= w >> 2;
+ w|= w >> 4;
+ w|= w >> 8;
+ w|= w >> 16;
+ return v & w;
+}
+
+STATIC_INLINE uint32 my_reverse_bits(uint32 key)
+{
+ return
+ (_my_bits_reverse_table[ key & 255] << 24) |
+ (_my_bits_reverse_table[(key>> 8) & 255] << 16) |
+ (_my_bits_reverse_table[(key>>16) & 255] << 8) |
+ _my_bits_reverse_table[(key>>24) ];
+}
+
+#else /* HAVE_INLINE */
+extern uint my_bit_log2(ulong value);
+extern uint32 my_round_up_to_next_power(uint32 v);
+uint32 my_clear_highest_bit(uint32 v);
+uint32 my_reverse_bits(uint32 key);
+extern uint my_count_bits(ulonglong v);
+extern uint my_count_bits_ushort(ushort v);
+#endif /* HAVE_INLINE */
+C_MODE_END
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 514cd17099b..a77e439b5db 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -101,7 +101,7 @@ extern FILE *_db_fp_(void);
#define DBUG_LONGJMP(a1) longjmp(a1)
#define DBUG_DUMP(keyword,a1,a2)
#define DBUG_END()
-#define DBUG_ASSERT(A)
+#define DBUG_ASSERT(A) do { } while(0)
#define DBUG_LOCK_FILE
#define DBUG_FILE (stderr)
#define DBUG_UNLOCK_FILE
diff --git a/include/my_global.h b/include/my_global.h
index ce76aeaec20..7952b2c9cdb 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -247,6 +247,8 @@
#endif
#undef inline_test_2
#undef inline_test_1
+/* helper macro for "instantiating" inline functions */
+#define STATIC_INLINE static inline
/*
The following macros are used to control inlining a bit more than
@@ -1020,6 +1022,8 @@ typedef long long intptr;
#error sizeof(void *) is neither sizeof(int) nor sizeof(long) nor sizeof(long long)
#endif
+#define MY_ERRPTR ((void*)(intptr)1)
+
#ifdef USE_RAID
/*
The following is done with a if to not get problems with pre-processors
@@ -1481,6 +1485,7 @@ do { doubleget_union _tmp; \
#define dlerror() ""
#endif
+
#ifndef __NETWARE__
/*
* Include standard definitions of operator new and delete.
@@ -1511,6 +1516,13 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
#if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
+/*
+ Only Linux is known to need an explicit sync of the directory to make sure a
+ file creation/deletion/renaming in(from,to) this directory durable.
+*/
+#ifdef TARGET_OS_LINUX
+#define NEED_EXPLICIT_SYNC_DIR 1
#endif
#endif /* my_global_h */
diff --git a/include/my_handler.h b/include/my_handler.h
index d7cd0567f9c..dabe73bd138 100644
--- a/include/my_handler.h
+++ b/include/my_handler.h
@@ -18,10 +18,30 @@
#ifndef _my_handler_h
#define _my_handler_h
-#include "my_base.h"
-#include "m_ctype.h"
#include "myisampack.h"
+/*
+ There is a hard limit for the maximum number of keys as there are only
+ 8 bits in the index file header for the number of keys in a table.
+ This means that 0..255 keys can exist for a table. The idea of
+ HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
+ a MyISAM table for which one has more keys than MyISAM is normally
+ compiled for. If you don't have this, you will get a core dump when
+ running myisamchk compiled for 128 keys on a table with 255 keys.
+*/
+
+#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */
+/*
+ The following defines can be increased if necessary.
+ But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
+*/
+
+#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */
+#define HA_MAX_KEY_SEG 16 /* Max segments for key */
+
+#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
+#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
+
typedef struct st_HA_KEYSEG /* Key-portion */
{
CHARSET_INFO *charset;
@@ -38,33 +58,35 @@ typedef struct st_HA_KEYSEG /* Key-portion */
} HA_KEYSEG;
#define get_key_length(length,key) \
-{ if ((uchar) *(key) != 255) \
- length= (uint) (uchar) *((key)++); \
+{ if (*(uchar*) (key) != 255) \
+ length= (uint) *(uchar*) ((key)++); \
else \
- { length=mi_uint2korr((key)+1); (key)+=3; } \
+ { length= mi_uint2korr((key)+1); (key)+=3; } \
}
#define get_key_length_rdonly(length,key) \
-{ if ((uchar) *(key) != 255) \
- length= ((uint) (uchar) *((key))); \
+{ if (*(uchar*) (key) != 255) \
+ length= ((uint) *(uchar*) ((key))); \
else \
- { length=mi_uint2korr((key)+1); } \
+ { length= mi_uint2korr((key)+1); } \
}
#define get_key_pack_length(length,length_pack,key) \
-{ if ((uchar) *(key) != 255) \
- { length= (uint) (uchar) *((key)++); length_pack=1; }\
+{ if (*(uchar*) (key) != 255) \
+ { length= (uint) *(uchar*) ((key)++); length_pack= 1; }\
else \
- { length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \
+ { length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
}
#define store_key_length_inc(key,length) \
{ if ((length) < 255) \
- { *(key)++=(length); } \
+ { *(key)++= (length); } \
else \
{ *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
}
+#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
+
#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
(((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
((1 << (bit_len)) - 1))
@@ -81,12 +103,20 @@ typedef struct st_HA_KEYSEG /* Key-portion */
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
-extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
+extern int ha_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
my_bool, my_bool);
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
register uchar *b, uint key_length, uint nextflag,
uint *diff_pos);
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a);
+extern void my_handler_error_register(void);
+extern void my_handler_error_unregister(void);
+/*
+ Inside an in-memory data record, memory pointers to pieces of the
+ record (like BLOBs) are stored in their native byte order and in
+ this amount of bytes.
+*/
+#define portable_sizeof_char_ptr 8
#endif /* _my_handler_h */
diff --git a/include/my_sys.h b/include/my_sys.h
index 2ce36760032..1b087360ef3 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -51,6 +51,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_WME 16 /* Write message on error */
#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
+#define MY_SYNC_DIR 1024 /* my_create/delete/rename: sync directory */
#define MY_RAID 64 /* Support for RAID */
#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
@@ -212,6 +213,7 @@ extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
myf MyFlags);
extern uint my_file_limit;
+extern ulong my_thread_stack_size;
#ifdef HAVE_LARGE_PAGES
extern my_bool my_use_large_pages;
@@ -276,7 +278,14 @@ enum cache_type
enum flush_type
{
- FLUSH_KEEP, FLUSH_RELEASE, FLUSH_IGNORE_CHANGED, FLUSH_FORCE_WRITE
+ FLUSH_KEEP, /* flush block and keep it in the cache */
+ FLUSH_RELEASE, /* flush block and remove it from the cache */
+ FLUSH_IGNORE_CHANGED, /* remove block from the cache */
+ /*
+ As my_disable_flush_pagecache_blocks is always 0, the following option
+ is strictly equivalent to FLUSH_KEEP
+ */
+ FLUSH_FORCE_WRITE
};
typedef struct st_record_cache /* Used when cacheing records */
@@ -627,6 +636,8 @@ extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
extern int my_fclose(FILE *fd,myf MyFlags);
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern int my_sync(File fd, myf my_flags);
+extern int my_sync_dir(const char *dir_name, myf my_flags);
+extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
extern int my_error _VARARGS((int nr,myf MyFlags, ...));
extern int my_printf_error _VARARGS((uint my_err, const char *format,
myf MyFlags, ...))
@@ -661,7 +672,7 @@ extern char *my_tmpdir(MY_TMPDIR *tmpdir);
extern void free_tmpdir(MY_TMPDIR *tmpdir);
extern void my_remember_signal(int signal_number,sig_handler (*func)(int));
-extern size_t dirname_part(char * to, const char *name, size_t *to_res_length);
+extern size_t dirname_part(char * to,const char *name, size_t *to_res_length);
extern size_t dirname_length(const char *name);
#define base_name(A) (A+dirname_length(A))
extern int test_if_hard_path(const char *dir_name);
@@ -707,7 +718,7 @@ extern sig_handler sigtstp_handler(int signal_number);
extern void handle_recived_signals(void);
extern sig_handler my_set_alarm_variable(int signo);
-extern void my_string_ptr_sort(uchar *base, uint items, size_t size);
+extern void my_string_ptr_sort(uchar *base,uint items,size_t size);
extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
size_t size_of_element,uchar *buffer[]);
extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size,
@@ -773,6 +784,7 @@ extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element);
extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array);
extern uchar *pop_dynamic(DYNAMIC_ARRAY*);
extern my_bool set_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index);
+extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements);
extern void get_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index);
extern void delete_dynamic(DYNAMIC_ARRAY *array);
extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
@@ -839,11 +851,8 @@ extern int unpackfrm(uchar **, size_t *, const uchar *);
extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem,
size_t count);
-extern uint my_bit_log2(ulong value);
-extern uint32 my_round_up_to_next_power(uint32 v);
-extern uint my_count_bits(ulonglong v);
-extern uint my_count_bits_ushort(ushort v);
extern void my_sleep(ulong m_seconds);
+extern ulong crc32(ulong crc, const uchar *buf, uint len);
extern uint my_set_max_open_files(uint files);
void my_free_open_file_info(void);
@@ -861,7 +870,7 @@ extern int my_getncpus();
#ifndef MAP_NOSYNC
#define MAP_NOSYNC 0
#endif
-#ifndef MAP_NORESERVE
+#ifndef MAP_NORESERVE
#define MAP_NORESERVE 0 /* For irix and AIX */
#endif
diff --git a/include/myisam.h b/include/myisam.h
index 6a76a298dee..e49446769dc 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -34,22 +34,16 @@ extern "C" {
#include <mysql/plugin.h>
/*
- There is a hard limit for the maximum number of keys as there are only
- 8 bits in the index file header for the number of keys in a table.
- This means that 0..255 keys can exist for a table. The idea of
- MI_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
- a MyISAM table for which one has more keys than MyISAM is normally
- compiled for. If you don't have this, you will get a core dump when
- running myisamchk compiled for 128 keys on a table with 255 keys.
+ Limit max keys according to HA_MAX_POSSIBLE_KEY
*/
-#define MI_MAX_POSSIBLE_KEY 255 /* For myisam_chk */
-#if MAX_INDEXES > MI_MAX_POSSIBLE_KEY
-#define MI_MAX_KEY MI_MAX_POSSIBLE_KEY /* Max allowed keys */
+
+#if MAX_INDEXES > HA_MAX_POSSIBLE_KEY
+#define MI_MAX_KEY HA_MAX_POSSIBLE_KEY /* Max allowed keys */
#else
#define MI_MAX_KEY MAX_INDEXES /* Max allowed keys */
#endif
-#define MI_MAX_POSSIBLE_KEY_BUFF (1024+6+6) /* For myisam_chk */
+#define MI_MAX_POSSIBLE_KEY_BUFF HA_MAX_POSSIBLE_KEY_BUFF
/*
The following defines can be increased if necessary.
But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and MI_MAX_KEY_LENGTH.
@@ -69,8 +63,6 @@ extern "C" {
#define MI_MIN_KEY_BLOCK_LENGTH 1024 /* Min key block length */
#define MI_MAX_KEY_BLOCK_LENGTH 16384
-#define mi_portable_sizeof_char_ptr 8
-
/*
In the following macros '_keyno_' is 0 .. keys-1.
If there can be more keys than bits in the key_map, the highest bit
@@ -256,8 +248,6 @@ typedef struct st_columndef /* column information */
#endif
} MI_COLUMNDEF;
-/* invalidator function reference for Query Cache */
-typedef void (* invalidator_by_filename)(const char * filename);
extern char * myisam_log_filename; /* Name of logfile */
extern ulong myisam_block_size;
@@ -310,7 +300,7 @@ extern int mi_delete_all_rows(struct st_myisam_info *info);
extern ulong _mi_calc_blob_length(uint length , const uchar *pos);
extern uint mi_get_pointer_length(ulonglong file_length, uint def);
-/* this is used to pass to mysql_myisamchk_table -- by Sasha Pachev */
+/* this is used to pass to mysql_myisamchk_table */
#define MYISAMCHK_REPAIR 1 /* equivalent to myisamchk -r */
#define MYISAMCHK_VERIFY 2 /* Verify, run repair if failure */
@@ -431,8 +421,8 @@ typedef struct st_mi_check_param
ulonglong unique_count[MI_MAX_KEY_SEG+1];
ulonglong notnull_count[MI_MAX_KEY_SEG+1];
- ha_checksum key_crc[MI_MAX_POSSIBLE_KEY];
- ulong rec_per_key_part[MI_MAX_KEY_SEG*MI_MAX_POSSIBLE_KEY];
+ ha_checksum key_crc[HA_MAX_POSSIBLE_KEY];
+ ulong rec_per_key_part[MI_MAX_KEY_SEG*HA_MAX_POSSIBLE_KEY];
void *thd;
const char *db_name, *table_name;
const char *op_name;