提交 9d5c90e5 编写于 作者: W Wesley Wang 提交者: guangshu.wgs

New features

1. Support session information synchronization mechanism
2. Support public cloud shared proxy CPU resource tenant isolation
3. Support random routing
4. Support specifying ip routing
5. Support to configure tenant isolation
6. Support OB_MYSQL_COM_STMT_RESET
7. Support Primary Zone routing
8. Fast fail-fast for request probes is supported. POC use only
9. Support text PS
10. Support OB_MYSQL_COM_RESET_CONNECTION
11. Support connection string ClusterId custom separator
12. Support non-Alibaba cloud environment, use remote ip as virtual ip
13. 【OB Sharding】Support SHOW INDEX FROM statement
14. 【OB Sharding】Support truncate syntax
15. 【OB Sharding】Support SHOW FULL TABLES statement
16. 【OB Sharding】SHOW KEYS FROM statement
17. 【OB Sharding】Support SHOW FULL COLUMNS statement
18. 【OB Sharding】When the scan_all switch is false, union and union
     all are supported;
19. 【OB Sharding】When the scan_all switch is true, union all is
     supported
20. 【OB Sharding】show table, show index, etc. support like syntax
21. 【OB Sharding】Limited support for subqueries
22. 【OB Sharding】Support to adjust the memory limit according to the
     container memory size
23. Turn off the default parameter for fast-fail request probes. Off by
    default
24. Adjust the whitelist policy, no longer use the client_ip sent by the
    client, and directly use the tcp peer IP

Improvements
1. Add max_used_connections to reduce log printing when client
   connection is disconnected
2. locality changes support all_dummy refresh
3. Intercept configuration table multi-row insertion
4. Compatible with MySQL 8.0, HandleShake Capability adds multi related
   value
5. Optimize partially duplicated logs

Bug fixes
1. Fix the memory problem caused by accessing internal tables and
   abnormally obtaining partition information
2. Fixed OB_MYSQL_COM_STMT_EXECUTE protocol, ref_cursor reported error
   fetch out of sequence under function
3. Fix the issue that the enable_client_ip_checkout parameter does not
   take effect when there is a connect attr parameter
4. Fix the Sharding scenario, the select table name of the sub-database
   and sub-table is case-sensitive, resulting in an error report
5. Fix the Sharding scenario, the select of sub-database and sub-table
   will be intercepted and unsupported syntax problem
6. Fixed an issue where a single SQL was sent multiple times, causing
   the SQL to take more than 40ms
7. Fix performance issues introduced by random partitions
8. Fix the problem of disconnection of changUser command under normal
   protocol
9. Fixed the problem that file systems such as xfs cannot accurately
   determine whether it is a directory using the readdir system call
10. Fix the problem that rslist startup fails more than 3 times and does
    not fall back to the original rslist
11. Fixed inaccurate sql routing caused by text PS escape symbols
12. Fix name super long text PS, prepare stage odp core
13. Fix text PS case insensitivity
14. Fix the error Unknown prepared statement handle when executing the
    text PS large request
15. Fix text PS date type route as partition key, text ps parameter
    routing is not allowed
16. Fix text PS trigger pl routing is not allowed
17. Fix text PS name contains illegal characters, execute error 1243
18. Fix the problem that user, value, etc. are used as keywords in
    lexical analysis
19. Fixed the problem that SSL cannot be used for the link between
    Client and Proxy
20. 【OB Sharding】Fixed that the hint with partition key cannot
    calculate the partition key when inserting
21. 【OB Sharding】Fixed that if the partition key is after the 64th
    column in the insert statement, it will report that it cannot be
    calculated
22. 【OB Sharding】Fix the problem of disconnection of sequence query
23. 【OB Sharding】Fix the core caused by not supporting sum(case when)
     in the function
24. When hot restart, if the old connection receives the COM_PING
    command, the old Proxy will actively disconnect the connection
25. 【OBSharding】 Fix the syntax parsing problem of delete and update
上级 02b73017
......@@ -73,15 +73,20 @@ function do_config()
echo -e "\033[31m ===build debug version=== \033[0m"
;;
xgcov)
# configure for release
# configure for gcov
./configure --with-gcc-version=9.3.0 --with-coverage=yes --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no
echo -e "\033[31m ===build gcov version=== \033[0m"
;;
xperf)
# configure for release
# configure for perf
./configure --with-gcc-version=9.3.0 --with-coverage=no --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no --with-release --with-perf
echo -e "\033[31m ===build perf version=== \033[0m"
;;
xasan)
# configure for asan
./configure --with-gcc-version=9.3.0 --with-coverage=no --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no --with-asan
echo -e "\033[31m ===build asan version=== \033[0m"
;;
*)
# configure for release
./configure --with-gcc-version=9.3.0 --with-coverage=no --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no --with-release
......
AC_INIT([OceanBase],
[3.2.3.5],
[4.0.0],
[wgs13579@gmail.com],
[obproxy-ce],
[http://oceanbase.taobao.org/])
obapi_version="3.2.3.5"
obapi_version="4.0.0"
AC_SUBST(obapi_version)
AC_DISABLE_STATIC
......@@ -26,7 +26,7 @@
if test "$withval" = "yes"; then
case "$host_cpu" in
*aarch64* )
AM_CXXFLAGS="-g -O2 -D_OB_VERSION=1000 -D_NO_EXCEPTION -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wall -Wextra -Wno-unused-parameter -Wformat -Wno-conversion -Wno-deprecated -Wno-invalid-offsetof -Wno-unused-result -Wno-format-security -finline-functions -fno-strict-aliasing -mtune=generic -Wno-psabi -Wno-sign-compare -Wno-class-memaccess -Wno-deprecated-copy -Wno-ignored-qualifiers -Wno-aligned-new -Wno-format-truncation -Wno-literal-suffix -Wno-format-overflow -Wno-stringop-truncation -Wno-memset-elt-size -Wno-cast-function-type -Wno-address-of-packed-member -fuse-ld=lld -ffunction-sections -Wl,--no-warn-symbol-ordering,--symbol-ordering-file,${ac_abs_confdir}/hotfuncs.txt"
AM_CXXFLAGS="-g -O2 -D_OB_VERSION=1000 -D_NO_EXCEPTION -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wall -Wextra -Wno-unused-parameter -Wformat -Wno-conversion -Wno-deprecated -Wno-invalid-offsetof -Wno-unused-result -Wno-format-security -finline-functions -fno-strict-aliasing -mtune=generic -march=armv8-a+crc -Wno-psabi -Wno-sign-compare -Wno-class-memaccess -Wno-deprecated-copy -Wno-ignored-qualifiers -Wno-aligned-new -Wno-format-truncation -Wno-literal-suffix -Wno-format-overflow -Wno-stringop-truncation -Wno-memset-elt-size -Wno-cast-function-type -Wno-address-of-packed-member -fuse-ld=lld -ffunction-sections -Wl,--no-warn-symbol-ordering,--symbol-ordering-file,${ac_abs_confdir}/hotfuncs.txt"
AM_CFLAGS="-g -O2 -D_OB_VERSION=1000 -DCOMPATIBLE -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNDEBUG -finline-functions -fno-strict-aliasing -Wall -mtune=generic -Wno-psabi -Wno-sign-compare -fuse-ld=lld -ffunction-sections -Wl,--no-warn-symbol-ordering,--symbol-ordering-file,${ac_abs_confdir}/hotfuncs.txt"
;;
* )
......@@ -118,6 +118,18 @@
[with_perf=no]
)
AC_ARG_WITH([asan],
AS_HELP_STRING([--with-asan],
[with asan (default is NO)]),
[
if test "$withval" = "yes"; then
AM_CXXFLAGS="${AM_CXXFLAGS} -fsanitize=address -fstack-protector-strong -fno-optimize-sibling-calls -fno-omit-frame-pointer -static-libasan -fno-var-tracking-assignments -fno-optimize-sibling-calls -fno-inline -DUSING_ASAN"
AM_CFLAGS="${AM_CFLAGS} -fsanitize=address -fstack-protector-strong -fno-optimize-sibling-calls -fno-omit-frame-pointer -static-libasan -fno-var-tracking-assignments -fno-optimize-sibling-calls -fno-inline -DUSING_ASAN"
fi
],
[with_asan=no]
)
AC_ARG_WITH([5u-support],
AS_HELP_STRING([--with-5u-support],
[with 5u support (default is NO)]),
......
......@@ -147,7 +147,7 @@ function check_opt()
OBPROXY_OPT_LOCAL="${OBPROXY_OPT_LOCAL},$OBPROXY_EXTRA_OPT"
fi
OBPROXY_OPT_LOCAL=",enable_cached_server=true,enable_get_rslist_remote=true,monitor_stat_dump_interval=1s,enable_qos=true,enable_standby=false,query_digest_time_threshold=2ms,monitor_cost_ms_unit=true,enable_strict_kernel_release=false,enable_proxy_scramble=true,work_thread_num=$WORK_THREAD_NUM,proxy_mem_limited='2G',log_dir_size_threshold=10G${OBPROXY_OPT_LOCAL}"
OBPROXY_OPT_LOCAL=",server_detect_mode=0,enable_primary_zone=false,enable_cached_server=true,enable_get_rslist_remote=true,monitor_stat_dump_interval=1s,enable_qos=true,enable_standby=false,query_digest_time_threshold=2ms,monitor_cost_ms_unit=true,enable_strict_kernel_release=false,enable_proxy_scramble=true,work_thread_num=$WORK_THREAD_NUM,proxy_mem_limited='2G',log_dir_size_threshold=10G${OBPROXY_OPT_LOCAL}"
}
# change to the path where this script locates.
......
......@@ -4125,9 +4125,17 @@ int obj_accuracy_check(ObCastCtx &cast_ctx,
const ObObj *&res_obj)
{
int ret = OB_SUCCESS;
bool valid_accuracy = true;
ObObjType type = obj.get_type();
if (ob_is_number_tc(type) || ob_is_double_tc(type) || ob_is_float_tc(type)) {
if (accuracy.precision_ == -1 || accuracy.scale_ == -1) {
valid_accuracy = false; // invalid accuracy
}
}
if (accuracy.is_valid()) {
LOG_DEBUG("obj_accuracy_check before", K(obj), K(accuracy), K(cs_type));
LOG_DEBUG("obj_accuracy_check before", K(obj), K(accuracy), K(cs_type), K(valid_accuracy));
if (valid_accuracy && accuracy.is_valid()) {
switch (obj.get_type_class()) {
case ObFloatTC: {
ret = float_range_check(cast_ctx, accuracy, obj, buf_obj, res_obj, cast_ctx.cast_mode_);
......
......@@ -307,6 +307,9 @@ int ObSMUtils::get_ob_type(ObObjType &ob_type, EMySQLFieldType mysql_type)
case OB_MYSQL_TYPE_COMPLEX:
ob_type = ObExtendType;
break;
case OB_MYSQL_TYPE_OB_UROWID:
ob_type = ObURowIDType;
break;
default:
_OB_LOG(WARN, "unsupport MySQL type %d", mysql_type);
ret = OB_OBJ_TYPE_ERROR;
......
......@@ -40,9 +40,15 @@ lib/charset/ob_charset.cpp\
lib/charset/ob_ctype.h\
lib/charset/ob_ctype.c\
lib/charset/ob_ctype_utf8.c\
lib/charset/ob_ctype_gb18030.cc\
lib/charset/ob_ctype_gbk.c\
lib/charset/ob_ctype_utf16.c\
lib/charset/ob_ctype_uca.c\
lib/charset/ob_ctype_mb.c\
lib/charset/ob_ctype_bin.c\
lib/charset/ob_ctype_simple.c\
lib/charset/ob_mysql_global.h\
lib/charset/ob_config.h\
lib/charset/ob_dtoa.h\
lib/charset/ob_dtoa.c\
lib/charset/ob_uctype.h\
......@@ -207,6 +213,10 @@ lib/utility/ob_template_utils.h\
lib/utility/serialization.h\
lib/utility/ob_unify_serialize.h\
lib/utility/ob_serialization_helper.h\
lib/utility/ob_2_0_full_link_trace_util.h\
lib/utility/ob_2_0_full_link_trace_util.cpp\
lib/utility/ob_2_0_full_link_trace_info.h\
lib/utility/ob_2_0_full_link_trace_info.cpp\
lib/net/ob_addr.h\
lib/net/ob_addr.cpp\
lib/net/tbnetutil.cpp\
......@@ -226,6 +236,9 @@ lib/stat/ob_stat_template.h\
lib/stat/ob_di_list.h\
lib/stat/ob_di_tls.h\
lib/trace/ob_trace_event.h\
lib/trace/ob_trace.h\
lib/trace/ob_trace.cpp\
lib/trace/ob_trace_def.h\
lib/profile/ob_trace_id.h\
lib/wait_event/ob_wait_class.h\
lib/wait_event/ob_wait_event.h\
......
......@@ -28,6 +28,8 @@ using namespace oceanbase::lib;
EXTERN_C_BEGIN
#ifndef USING_ASAN
extern void *__libc_malloc(size_t size);
extern void __libc_free(void *ptr);
extern void *__libc_realloc(void *ptr, size_t size);
......@@ -290,4 +292,6 @@ int posix_memalign(void **memptr, size_t alignment, size_t size)
return err;
}
#endif
EXTERN_C_END
......@@ -15,6 +15,7 @@
#include "lib/thread_local/ob_tsi_factory.h"
#include "lib/utility/utility.h"
#include <algorithm>
#include "obutils/ob_proxy_config.h"
#ifdef __OB_MTRACE__
#include <execinfo.h>
#endif
......
......@@ -235,6 +235,7 @@ MOD_ITEM_DEF(OB_PROXY_QOS)
MOD_ITEM_DEF(OB_PROXY_SSL_RELATED)
MOD_ITEM_DEF(OB_PROXY_CONFIG_TABLE)
MOD_ITEM_DEF(OB_PROMETHEUS_RELATED)
MOD_ITEM_DEF(OB_PROXY_SESS_SYNC)
//mergeservermodules
MOD_ITEM_DEF(OB_MS_CELL_ARRAY)
......
此差异已折叠。
......@@ -27,15 +27,26 @@ enum ObCharsetType
CHARSET_INVALID = 0,
CHARSET_BINARY = 1,
CHARSET_UTF8MB4 = 2,
CHARSET_GBK = 3,
CHARSET_UTF16 = 4,
CHARSET_GB18030 = 5,
CHARSET_MAX,
};
enum ObCollationType
{
CS_TYPE_INVALID = 0,
CS_TYPE_GBK_CHINESE_CI = 28,
CS_TYPE_UTF8MB4_GENERAL_CI = 45,
CS_TYPE_UTF8MB4_BIN = 46,
CS_TYPE_UTF16_GENERAL_CI = 54,
CS_TYPE_UTF16_BIN = 55,
CS_TYPE_BINARY = 63,
CS_TYPE_GBK_BIN = 87,
CS_TYPE_UTF16_UNICODE_CI = 101,
CS_TYPE_UTF8MB4_UNICODE_CI = 224,
CS_TYPE_GB18030_CHINESE_CI = 248,
CS_TYPE_GB18030_BIN = 249,
CS_TYPE_MAX,
};
/*
......@@ -89,8 +100,8 @@ private:
virtual ~ObCharset() {};
public:
static const int64_t CHARSET_WRAPPER_COUNT = 2;
static const int64_t COLLATION_WRAPPER_COUNT = 3;
static const int64_t CHARSET_WRAPPER_COUNT = 5;
static const int64_t COLLATION_WRAPPER_COUNT = 11;
static double strntod(const char *str,
size_t str_len,
......
/**
* Copyright (c) 2021 OceanBase
* OceanBase Database Proxy(ODP) is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#ifndef OB_CONFIG_H
#define OB_CONFIG_H
#define _GNU_SOURCE 1
#define SIZEOF_SIZE_T 8
#define SIZEOF_CHARP 8
#define SIZEOF_VOIDP 8
#define SIZEOF_LONG 8
#define SIZEOF_CHAR 1
#define HAS_CHAR 1
#define HAS_LONG 1
#define HAS_CHARP 1
#define SIZEOF_SHORT 2
#define HAS_SHORT 1
#define SIZEOF_INT 4
#define HAS_INT 1
#define SIZEOF_LONG_LONG 8
#define HAS_LONG_LONG 1
#define SIZEOF_OFF_T 8
#define HAS_OFF_T 1
#define SIZEOF_SIGSET_T 128
#define HAS_SIGSET_T 1
#define HAS_SIZE_T 1
#define SIZEOF_UINT 4
#define HAS_UINT 1
#define SIZEOF_ULONG 8
#define HAS_ULONG 1
#define HAS_U_INT32_T 1
#define SIZEOF_U_INT32_T 4
#define HAS_MBSTATE_T
#define MAX_INDEXES 64U
#define QSORT_TYPE_IS_VOID 1
#define SIGNAL_RETURN_TYPE_IS_VOID 1
#define VOID_SIGHANDLER 1
#define RETSIGTYPE void
#define RETQSORTTYPE void
#define STRUCT_RLIMIT struct rlimit
#define SOCKET_SIZE_TYPE socklen_t
#endif
......@@ -12,85 +12,93 @@
#include "lib/charset/ob_ctype.h"
static uint32_t
ob_convert_internal(char *to, uint32_t to_length,
static uint32
ob_convert_internal(char *to, uint32 to_length,
const ObCharsetInfo *to_cs,
const char *from, uint32_t from_length,
const ObCharsetInfo *from_cs, uint32_t *errors)
const char *from, uint32 from_length,
const ObCharsetInfo *from_cs, uint *errors)
{
int res;
unsigned int error_num= 0;
int cnvres;
ob_wc_t wc;
const unsigned char *from_end = (const unsigned char*) from + from_length;
const unsigned char *from_end= (const unsigned char*) from + from_length;
char *to_start= to;
unsigned char *to_end= (unsigned char*) to + to_length;
ob_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
ob_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
uint32_t error_count= 0;
while (1) {
if ((res = (*mb_wc)((unsigned char *) from, from_end, &wc)) > 0) {
from+= res;
} else if (res == OB_CS_ERR_ILLEGAL_SEQUENCE) {
error_count++;
ob_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
pbool conitnue = TRUE;
while (conitnue) {
if ((cnvres= (*mb_wc)(from_cs, &wc, (unsigned char*) from, from_end)) > 0) {
from+= cnvres;
} else if (cnvres == OB_CS_ILSEQ) {
from++;
wc= '?';
} else if (res > OB_CS_ERR_TOOSMALL) {
/*
A correct multibyte sequence detected
But it doesn't have Unicode mapping.
*/
error_count++;
from+= (-res);
error_num++;
} else if (cnvres > OB_CS_TOOSMALL) {
from+= (-cnvres);
wc= '?';
error_num++;
} else {
break; // Not enough characters
break;
}
outp:
if ((res= (*wc_mb)(wc, (unsigned char*) to, to_end)) > 0) {
to+= res;
} else if (res == OB_CS_ERR_ILLEGAL_UNICODE && wc != '?') {
error_count++;
wc= '?';
goto outp;
} else {
break;
pbool go = TRUE;
while (go) {
go = FALSE;
if ((cnvres= (*wc_mb)(to_cs, wc, (unsigned char*) to, to_end)) > 0)
to+= cnvres;
else if (cnvres == OB_CS_ILUNI && wc != '?') {
error_num++;
wc= '?';
go = TRUE;
} else {
conitnue = FALSE;
}
}
}
*errors= error_count;
return (uint32_t) (to - to_start);
*errors= error_num;
return (uint32) (to - to_start);
}
uint32_t
ob_convert(char *to, uint32_t to_length, const ObCharsetInfo *to_cs,
const char *from, uint32_t from_length,
const ObCharsetInfo *from_cs, uint32_t *errors) {
uint32_t length, length2;
/*
If any of the character sets is not ASCII compatible,
immediately switch to slow mb_wc->wc_mb method.
*/
uint32
ob_convert(char *to, uint32 to_length, const ObCharsetInfo *to_cs,
const char *from, uint32 from_length,
const ObCharsetInfo *from_cs, uint *errors)
{
uint32 length, length2;
if ((to_cs->state | from_cs->state) & OB_CS_NONASCII) {
return ob_convert_internal(to, to_length, to_cs,
from, from_length, from_cs, errors);
return ob_convert_internal(to, to_length, to_cs, from, from_length, from_cs, errors);
} else {
length= length2= OB_MIN(to_length, from_length);
}
length= length2= to_length < from_length ? to_length : from_length;
#if defined(__i386__)
while (length >= 4) {
if ((*(uint32*)from) & 0x80808080) break;
*((uint32*) to) = *((const uint32*) from);
from += 4;
to += 4;
length -= 4;
}
#endif /* __i386__ */
for (; ; *to++= *from++, length--) {
while (TRUE) {
if (!length) {
*errors= 0;
return length2;
}
if (*((unsigned char*) from) > 0x7F) { /* A non-ASCII character */
uint32_t copied_length= length2 - length;
} else if (*((unsigned char*) from) > 0x7F) {
uint32 copied_length= length2 - length;
to_length-= copied_length;
from_length-= copied_length;
return copied_length + ob_convert_internal(to, to_length, to_cs,
from, from_length, from_cs,
errors);
}
*to++= *from++;
length--;
}
return 0;
return 0;
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -31,12 +31,12 @@ typedef enum
//==================================================
double ob_strtod(const char *str, char **end, int *error);
size_t ob_fcvt(double x, int precision, int width, char *to, ob_bool *error);
size_t ob_gcvt(double x, ob_gcvt_arg_type type, int width, char *to, ob_bool *error);
size_t ob_gcvt_opt(double x, ob_gcvt_arg_type type, int width, char *to, ob_bool *error,
ob_bool use_oracle_mode);
size_t ob_gcvt_strict(double x, ob_gcvt_arg_type type, int width, char *to, ob_bool *error,
ob_bool use_oracle_mode, ob_bool use_force_e_format);
size_t ob_fcvt(double x, int precision, int width, char *to, bool *error);
size_t ob_gcvt(double x, ob_gcvt_arg_type type, int width, char *to, bool *error);
size_t ob_gcvt_opt(double x, ob_gcvt_arg_type type, int width, char *to, bool *error,
bool use_oracle_mode);
size_t ob_gcvt_strict(double x, ob_gcvt_arg_type type, int width, char *to, bool *error,
bool use_oracle_mode, bool use_force_e_format);
#ifdef __cplusplus
}
......
......@@ -13,6 +13,49 @@
#ifndef OCEANBASE_LIB_OBMYSQL_OB_MYSQL_GLOBAL_
#define OCEANBASE_LIB_OBMYSQL_OB_MYSQL_GLOBAL_
#define MY_GLOBAL_INCLUDED
#if !defined(__WIN__) && defined(_WIN32)
#define __WIN__
#endif
#define INNODB_COMPATIBILITY_HOOKS
#ifdef __CYGWIN__
#undef WIN
#undef WIN32
#undef _WIN
#undef _WIN32
#undef _WIN64
#undef __WIN__
#undef __WIN32__
#define HAS_ERRNO_AS_DEFINE
#endif
#if defined(i386) && !defined(__i386__)
#define __i386__
#endif
#ifdef __cplusplus
#define C_MODE_START extern "C" {
#define C_MODE_END }
#else
#define C_MODE_START
#define C_MODE_END
#endif
#ifdef __cplusplus
#define CPP_UNNAMED_NS_START namespace {
#define CPP_UNNAMED_NS_END }
#endif
#include "lib/charset/ob_config.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -37,96 +80,307 @@
#include <assert.h>
#define TRUE (1)
#define FALSE (0)
#define MY_MAX(a, b) ((a) > (b) ? (a) : (b))
#define MY_MIN(a, b) ((a) < (b) ? (a) : (b))
typedef unsigned char uchar;
typedef signed char int8;
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
(defined(__GNUC__) && defined(__cplusplus))
#define LINT_INIT(var) var= 0
#else
#define LINT_INIT(var)
#endif
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
defined(__cplusplus) || !defined(__GNUC__)
#define UNINIT_VAR(x) x= 0
#else
#define UNINIT_VAR(x) x= x
#endif
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
#ifndef TRUE
#define TRUE (1)
#define FALSE (0)
#endif
typedef int File;
typedef int my_socket;
#define INVALID_SOCKET -1
#define sig_handler RETSIGTYPE
#define OB_MAX(a, b) ((a) > (b) ? (a) : (b))
#define OB_MIN(a, b) ((a) < (b) ? (a) : (b))
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
#define NullS (char *) 0
#ifdef STDCALL
#undef STDCALL
#endif
#ifdef _WIN32
#define STDCALL __stdcall
#else
#define STDCALL
#endif
#ifndef HAS_UCHAR
typedef unsigned char uchar;
#endif
#ifndef HAS_UINT8
typedef unsigned char uint8;
typedef short int16;
typedef unsigned short uint16;
typedef int int32;
typedef unsigned int uint32;
typedef unsigned long ulong;
typedef unsigned long ulonglong;
typedef long longlong;
#endif
#ifndef HAS_INT16
typedef short int16;
#endif
#ifndef HAS_UINT16
typedef unsigned short uint16;
#endif
#ifndef HAS_INT32
typedef int int32;
#endif
#ifndef HAS_UINT32
typedef unsigned int uint32;
#endif
#ifndef longlong_defined
#if SIZEOF_LONG_LONG != 8 || !defined(HAS_LONG_LONG)
typedef unsigned long ulonglong;
typedef long longlong;
#else
typedef unsigned long long int ulonglong;
typedef long long int longlong;
#endif
#if !defined(__USE_MISC) && !defined(HAS_ULONG)
typedef unsigned long ulong;
#endif
#endif
#ifndef HAS_INT64
typedef longlong int64;
#endif
#ifndef HAS_UINT64
typedef ulonglong uint64;
typedef char ob_bool;
#endif
#if SIZEOF_CHARP == SIZEOF_INT
typedef int int_ptr;
#elif SIZEOF_CHARP == SIZEOF_LONG
typedef long int_ptr;
#elif SIZEOF_CHARP == SIZEOF_LONG_LONG
typedef long long int_ptr;
#else
#error sizeof(void *) is neither sizeof(int) nor sizeof(long) nor sizeof(long long)
#endif
#if defined(NO_CLIENT_LONG_LONG)
typedef unsigned long my_ulonglong;
#elif !defined (__WIN__)
typedef unsigned long long my_ulonglong;
#else
typedef unsigned __int64 my_ulonglong;
#endif
#if !defined(_WIN32)
typedef off_t os_off_t;
#if SIZEOF_OFF_T <= 4
typedef unsigned long ob_off_t;
#else
typedef ulonglong ob_off_t;
#endif
#if defined(_WIN32)
typedef unsigned long long ob_off_t;
typedef unsigned long long os_off_t;
#endif
#endif
#define MY_FILEPOS_ERROR (~(ob_off_t) 0)
typedef ulonglong table_map;
typedef ulonglong nesting_map;
typedef int myf;
typedef char my_bool;
#define MYF(v) (myf) (v)
#ifndef LL
#ifdef HAS_LONG_LONG
#define LL(A) A ## LL
#else
#define LL(A) A ## L
#endif
#endif
#ifndef ULL
#ifdef HAS_LONG_LONG
#define ULL(A) A ## ULL
#else
#define ULL(A) A ## UL
#endif
#endif
#if !defined(HAS_UINT)
#undef HAS_UINT
#define HAS_UINT
typedef unsigned int uint;
typedef unsigned short ushort;
#endif
#if defined(__GNUC__) && !defined(_lint)
typedef char pchar;
typedef char puchar;
typedef char pbool;
typedef short pshort;
typedef float pfloat;
#else
typedef int pchar;
typedef uint puchar;
typedef int pbool;
typedef int pshort;
typedef double pfloat;
#endif
C_MODE_START
typedef int (*qsort_cmp)(const void *,const void *);
typedef int (*qsort_cmp2)(const void*, const void *,const void *);
C_MODE_END
#define qsort_t RETQSORTTYPE
#if defined(HAS_LONG_LONG) && !defined(LONGLONG_MIN)
#define LONGLONG_MIN ((long long) 0x8000000000000000LL)
#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL)
#endif
#if defined(HAS_LONG_LONG) && !defined(ULONGLONG_MAX)
//===================================================================
#define ob_sint1korr(P) (*((int8_t*)(P)))
#define ob_uint1korr(P) (*((uint8_t *)P))
#define ob_sint2korr(P) (int16) (*((int16 *) (P)))
#define ob_sint3korr(P) ((int32) ((((uchar) (P)[2]) & 128) ? \
(((uint32) 255L << 24) | \
(((uint32) (uchar) (P)[2]) << 16) |\
(((uint32) (uchar) (P)[1]) << 8) | \
((uint32) (uchar) (P)[0])) : \
(((uint32) (uchar) (P)[2]) << 16) |\
(((uint32) (uchar) (P)[1]) << 8) | \
((uint32) (uchar) (P)[0])))
#define ob_sint4korr(P) (int32) (*((int32 *) (P)))
#define ob_uint2korr(P) (uint16) (*((uint16 *) (P)))
#define ob_uint3korr(P) (uint32) (((uint32) ((uchar) (P)[0])) +\
(((uint32) ((uchar) (P)[1])) << 8) +\
(((uint32) ((uchar) (P)[2])) << 16))
#define ob_uint4korr(P) (uint32) (*((uint32 *) (P)))
#define ob_uint5korr(P) ((ulonglong)(((uint32) ((uchar) (P)[0])) +\
(((uint32) ((uchar) (P)[1])) << 8) +\
(((uint32) ((uchar) (P)[2])) << 16) +\
(((uint32) ((uchar) (P)[3])) << 24)) +\
(((ulonglong) ((uchar) (P)[4])) << 32))
#define ob_uint6korr(P) ((ulonglong)(((uint32) ((uchar) (P)[0])) + \
(((uint32) ((uchar) (P)[1])) << 8) + \
(((uint32) ((uchar) (P)[2])) << 16) + \
(((uint32) ((uchar) (P)[3])) << 24)) + \
(((ulonglong) ((uchar) (P)[4])) << 32) + \
(((ulonglong) ((uchar) (P)[5])) << 40))
#define ob_uint8korr(P) (ulonglong) (*((ulonglong *) (P)))
#define ob_sint8korr(P) (longlong) (*((longlong *) (P)))
#define ob_int1store(P,V) do { *((uint8_t *)(P)) = (uint8_t)(V); } while (0)
#define ob_int2store(P,V) do { uchar *pP= (uchar*)(P);\
*((uint16*)(pP))= (uint16) (V);\
} while (0)
#define ob_int3store(P,V) do { *(P)= (uchar) ((V));\
*(P+1)=(uchar) (((uint) (V) >> 8));\
*(P+2)=(uchar) (((V) >> 16));\
#ifdef ULLONG_MAX
#define ULONGLONG_MAX ULLONG_MAX
#else
#define ULONGLONG_MAX ((unsigned long long)(~0ULL))
#endif
#endif
#define INT_MAX8 0x7F
#define INT_MIN8 (~0x7F)
#define UINT_MAX8 0xFF
#define INT_MAX16 0x7FFF
#define INT_MIN16 (~0x7FFF)
#define UINT_MAX16 0xFFFF
#define INT_MAX24 0x007FFFFF
#define INT_MIN24 (~0x007FFFFF)
#define UINT_MAX24 0x00FFFFFF
#define INT_MAX32 0x7FFFFFFFL
#define INT_MIN32 (~0x7FFFFFFFL)
#define UINT_MAX32 0xFFFFFFFFL
#define INT_MAX64 0x7FFFFFFFFFFFFFFFLL
#define INT_MIN64 (~0x7FFFFFFFFFFFFFFFLL)
#ifndef DBL_MAX
#define DBL_MAX 1.79769313486231470e+308
#define FLT_MAX ((float)3.40282346638528860e+38)
#endif
#ifndef DBL_MIN
#define DBL_MIN 4.94065645841246544e-324
#define FLT_MIN ((float)1.40129846432481707e-45)
#endif
#define int1store(T,A) do { *((uint8_t *)(T)) = (uint8_t)(A); } while (0)
#define int2store(T,A) do { unsigned char *pT= (unsigned char*)(T);\
*((unsigned short*)(pT))= (unsigned short) (A);\
} while (0)
#define ob_int4store(P,V) do { uchar *pP= (uchar*)(P);\
*((uint32 *) (pP))= (uint32) (V); \
} while (0)
#define ob_int5store(P,V) do { *(P)= (uchar)((V));\
*((P)+1)=(uchar) (((V) >> 8));\
*((P)+2)=(uchar) (((V) >> 16));\
*((P)+3)=(uchar) (((V) >> 24));\
*((P)+4)=(uchar) (((V) >> 32));\
} while(0)
#define ob_int6store(P,V) do { *(P)= (uchar)((V)); \
*((P)+1)=(uchar) (((V) >> 8)); \
*((P)+2)=(uchar) (((V) >> 16)); \
*((P)+3)=(uchar) (((V) >> 24)); \
*((P)+4)=(uchar) (((V) >> 32)); \
*((P)+5)=(uchar) (((V) >> 40)); \
} while(0)
#define ob_int8store(P,V) do { uchar *pP= (uchar*)(P);\
*((ulonglong *) (pP))= (ulonglong) (V);\
} while(0)
#define int3store(T,A) do { *(T)= (unsigned char) ((A));\
*(T+1)=(unsigned char) (((uint) (A) >> 8));\
*(T+2)=(unsigned char) (((A) >> 16));\
} while (0)
#define int4store(T,A) do { unsigned char *pT= (unsigned char*)(T);\
*((unsigned int *) (pT))= (unsigned int) (A); \
} while (0)
#define int5store(T,A) do { *(T)= (unsigned char)((A));\
*((T)+1)=(unsigned char) (((A) >> 8));\
*((T)+2)=(unsigned char) (((A) >> 16));\
*((T)+3)=(unsigned char) (((A) >> 24));\
*((T)+4)=(unsigned char) (((A) >> 32));\
} while(0)
#define int6store(T,A) do { *(T)= (unsigned char)((A)); \
*((T)+1)=(unsigned char) (((A) >> 8)); \
*((T)+2)=(unsigned char) (((A) >> 16)); \
*((T)+3)=(unsigned char) (((A) >> 24)); \
*((T)+4)=(unsigned char) (((A) >> 32)); \
*((T)+5)=(unsigned char) (((A) >> 40)); \
} while(0)
#define int8store(T,A) do { unsigned char *pT= (unsigned char*)(T);\
*((uint64 *) (pT))= (uint64) (A);\
} while(0)
#define uint1korr(A) (*((uint8_t *)A))
#define uint2korr(A) (unsigned short) (*((unsigned short *) (A)))
#define uint3korr(A) (unsigned int) (((unsigned int) ((unsigned char) (A)[0])) +\
(((unsigned int) ((unsigned char) (A)[1])) << 8) +\
(((unsigned int) ((unsigned char) (A)[2])) << 16))
#define uint4korr(A) (unsigned int) (*((unsigned int *) (A)))
#define uint5korr(A) ((uint64)(((unsigned int) ((unsigned char) (A)[0])) +\
(((unsigned int) ((unsigned char) (A)[1])) << 8) +\
(((unsigned int) ((unsigned char) (A)[2])) << 16) +\
(((unsigned int) ((unsigned char) (A)[3])) << 24)) +\
(((uint64) ((unsigned char) (A)[4])) << 32))
#define uint6korr(A) ((uint64)(((unsigned int) ((unsigned char) (A)[0])) + \
(((unsigned int) ((unsigned char) (A)[1])) << 8) + \
(((unsigned int) ((unsigned char) (A)[2])) << 16) + \
(((unsigned int) ((unsigned char) (A)[3])) << 24)) + \
(((uint64) ((unsigned char) (A)[4])) << 32) + \
(((uint64) ((unsigned char) (A)[5])) << 40))
#define uint8korr(A) (uint64) (*((uint64 *) (A)))
#define sint1korr(A) (*((int8_t*)(A)))
#define sint2korr(A) (short) (*((short *) (A)))
#define sint3korr(A) ((int) ((((unsigned char) (A)[2]) & 128) ? \
(((unsigned int) 255L << 24) | \
(((unsigned int) (unsigned char) (A)[2]) << 16) |\
(((unsigned int) (unsigned char) (A)[1]) << 8) | \
((unsigned int) (unsigned char) (A)[0])) : \
(((unsigned int) (unsigned char) (A)[2]) << 16) |\
(((unsigned int) (unsigned char) (A)[1]) << 8) | \
((unsigned int) (unsigned char) (A)[0])))
#define sint4korr(A) (int) (*((int *) (A)))
#define sint8korr(A) (int64) (*((int64 *) (A)))
#ifndef MYSQL_PLUGIN_IMPORT
#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN))
#define MYSQL_PLUGIN_IMPORT __declspec(dllimport)
#else
#define MYSQL_PLUGIN_IMPORT
#endif
#endif
enum loglevel {
ERROR_LEVEL= 0,
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册