[scn] fix failure of mittest after refresh feature scn
This commit is contained in:
parent
49a02f3304
commit
54b64a7263
@ -1,3 +0,0 @@
|
||||
sysbench_obp
|
||||
bmsqltest_obp
|
||||
tpch_obp
|
9
.github/pull_request_template.md
vendored
9
.github/pull_request_template.md
vendored
@ -13,6 +13,7 @@ If possible, please consider writing useful notes for better and faster reviews
|
||||
4. If there is a discussion in the mailing list, please add the link.
|
||||
-->
|
||||
|
||||
|
||||
### Why are the changes needed?
|
||||
|
||||
<!--
|
||||
@ -21,15 +22,18 @@ Please clarify why the changes are needed. For instance,
|
||||
2. If you fix a bug, you can clarify why it is a bug.
|
||||
-->
|
||||
|
||||
|
||||
### Will break the compatibility? How if so?
|
||||
|
||||
|
||||
<!--
|
||||
Please make sure it do not break the system compatibility, such as
|
||||
Please label `alert/break' if so, such as
|
||||
1. nGQL grammar changes;
|
||||
2. RPC protocol can't be compatible with previous;
|
||||
2. RPC protocol can't be compatible with previous, refer to https://diwakergupta.github.io/thrift-missing-guide/#_versioning_compatibility;
|
||||
3. Storage format; etc.
|
||||
-->
|
||||
|
||||
|
||||
### Does this PR introduce any user-facing change?
|
||||
|
||||
<!--
|
||||
@ -37,6 +41,7 @@ If yes, please clarify the previous behavior and the change this PR proposes - p
|
||||
If no, write 'No'.
|
||||
-->
|
||||
|
||||
|
||||
### How was this patch tested?
|
||||
|
||||
<!--
|
||||
|
118
.gitignore
vendored
118
.gitignore
vendored
@ -1,4 +1,15 @@
|
||||
############# root #############
|
||||
###### lines below this line must be placed at the top of the file
|
||||
unittest/**/test_*
|
||||
unittest/**/*_test
|
||||
unittest/**/**/test_*
|
||||
unittest/**/**/*_test
|
||||
unittest/**/unittest_*
|
||||
!unittest/**/test_*.*
|
||||
!unittest/**/**/test_*.*
|
||||
!unittest/**/unittest_*.*
|
||||
###### lines above this line must be placed at the top of the file
|
||||
!doc/*/Makefile
|
||||
!src/rpc/easy/**
|
||||
*.a
|
||||
*.bak
|
||||
*.gcda
|
||||
@ -75,6 +86,7 @@ coverage/
|
||||
cscope.*
|
||||
depcomp
|
||||
dist_branch
|
||||
doc/**/*.html
|
||||
install-sh
|
||||
launch_bootstrap
|
||||
libtool
|
||||
@ -88,25 +100,6 @@ obproxy_config.bin
|
||||
observer.log*
|
||||
paratest*
|
||||
rollback_sql_pre.txt
|
||||
svn_dist_version
|
||||
svn_version.c
|
||||
tags
|
||||
test-driver
|
||||
.dir-locals.el
|
||||
compile_commands.json
|
||||
*.ccls-cache/
|
||||
.cproject
|
||||
.cache
|
||||
.history/*
|
||||
## Intellij files
|
||||
.idea
|
||||
cmake-build-debug
|
||||
cmake-build-release
|
||||
*.iml
|
||||
## OSX dir files
|
||||
.DS_Store
|
||||
|
||||
############# src #############
|
||||
src/.settings/
|
||||
src/client/*
|
||||
src/election/election
|
||||
@ -139,6 +132,8 @@ src/observer/observer
|
||||
src/sql/parser/*.output
|
||||
src/sql/parser/expr_parser.output
|
||||
src/sql/parser/sql_parser.output
|
||||
svn_dist_version
|
||||
svn_version.c
|
||||
src/sql/parser/sql_parser_mysql_mode_lex.c
|
||||
src/sql/parser/sql_parser_mysql_mode_lex.h
|
||||
src/sql/parser/sql_parser_mysql_mode_tab.c
|
||||
@ -154,20 +149,8 @@ src/sql/parser/sql_parser_oracle_utf8_mode_tab.c
|
||||
src/sql/parser/sql_parser_oracle_utf8_mode_tab.h
|
||||
src/sql/parser/_gen_parser.output
|
||||
src/sql/parser/_gen_parser.error
|
||||
src/pl/parser/pl_parser_mysql_mode_lex.c
|
||||
src/pl/parser/pl_parser_mysql_mode_lex.h
|
||||
src/pl/parser/pl_parser_mysql_mode_tab.c
|
||||
src/pl/parser/pl_parser_mysql_mode_tab.h
|
||||
src/pl/parser/pl_parser_oracle_mode_lex.c
|
||||
src/pl/parser/pl_parser_oracle_mode_lex.h
|
||||
src/pl/parser/pl_parser_oracle_mode_tab.c
|
||||
src/pl/parser/pl_parser_oracle_mode_tab.h
|
||||
src/pl/parser/_gen_parser.error
|
||||
src/pl/parser/_gen_pl_parser.output
|
||||
src/pl/parser/pl_parser_mysql_mode.output
|
||||
src/pl/parser/pl_parser_oracle_mode.output
|
||||
|
||||
############# tools #############
|
||||
tags
|
||||
test-driver
|
||||
tools/ObRestore/mvn_repository
|
||||
tools/agentserver/agentserver
|
||||
tools/agentserver/incbackupserver
|
||||
@ -262,27 +245,6 @@ tools/storage_test/storagetest
|
||||
tools/trace/trace_tool
|
||||
tools/upgrade/upgrade_post_extract_files*
|
||||
tools/upgrade/upgrade_pre_extract_files*
|
||||
tools/obtest/sql/backup_restore/meta_db_init.sql
|
||||
## Debug bin and configuration
|
||||
tools/deploy/bin
|
||||
tools/deploy/config2.py
|
||||
tools/deploy/.obd
|
||||
tools/deploy/distributed-with-proxy.yaml
|
||||
tools/deploy/distributed.yaml
|
||||
tools/deploy/obd_profile.sh
|
||||
tools/deploy/single-with-proxy.yaml
|
||||
tools/deploy/single.yaml
|
||||
|
||||
############# unittest #############
|
||||
unittest/**/test_*
|
||||
unittest/**/*_test
|
||||
unittest/**/**/test_*
|
||||
unittest/**/**/*_test
|
||||
unittest/**/unittest_*
|
||||
!unittest/**/test_*.*
|
||||
!unittest/**/**/test_*.*
|
||||
!unittest/**/unittest_*.*
|
||||
|
||||
unittest/clog/deploy/log_tool
|
||||
unittest/clog/deploy/ob_server_main
|
||||
unittest/clog/deploy/post_msg_main
|
||||
@ -299,6 +261,8 @@ unittest/obproxy/etc/
|
||||
unittest/obproxy/failed.result
|
||||
unittest/obproxy/failed.sql
|
||||
unittest/rpc/rpc_bench
|
||||
unittest/sql/engine/*/test_*
|
||||
unittest/sql/engine/expr/*_test
|
||||
unittest/sql/engine/expr/arithmatic.out
|
||||
unittest/sql/executor/rpc_remote_scheduler
|
||||
unittest/sql/executor/stress_interm_result_manager
|
||||
@ -320,16 +284,42 @@ unittest/storage/sstable_perf_tool
|
||||
unittest/storage/storage_bench
|
||||
unittest/storage/tmp
|
||||
unittest/storage/transaction/performance
|
||||
src/pl/parser/pl_parser_mysql_mode.output
|
||||
src/pl/parser/pl_parser_oracle_mode.output
|
||||
deps/oblib/src/common/storage/ob_io_selector.h
|
||||
/tools/obtest/sql/backup_restore/meta_db_init.sql
|
||||
.dir-locals.el
|
||||
compile_commands.json
|
||||
test/tmp
|
||||
test/var
|
||||
*.ccls-cache/
|
||||
.cproject
|
||||
.cache
|
||||
deps/3rd
|
||||
|
||||
## binary and test logs
|
||||
##### Git Sub Module
|
||||
deps/logmessage
|
||||
|
||||
###### Intellij files
|
||||
.idea
|
||||
cmake-build-debug
|
||||
cmake-build-release
|
||||
*.iml
|
||||
|
||||
###### OSX dir files
|
||||
.DS_Store
|
||||
|
||||
###### Debug bin and configuration
|
||||
tools/deploy/bin
|
||||
tools/deploy/config2.py
|
||||
tools/deploy/.obd
|
||||
tools/deploy/distributed-with-proxy.yaml
|
||||
tools/deploy/distributed.yaml
|
||||
tools/deploy/obd_profile.sh
|
||||
tools/deploy/single-with-proxy.yaml
|
||||
tools/deploy/single.yaml
|
||||
|
||||
###### binary and test logs
|
||||
tools/ob-configserver/bin/*
|
||||
tools/ob-configserver/tests/*.log
|
||||
tools/ob-configserver/tests/*.out
|
||||
|
||||
############# deps #############
|
||||
deps/oblib/src/common/storage/ob_io_selector.h
|
||||
deps/3rd
|
||||
|
||||
############# test #############
|
||||
test/tmp
|
||||
test/var
|
0
asan_ignore_list.txt → .gitmodules
vendored
0
asan_ignore_list.txt → .gitmodules
vendored
82
.secignore
82
.secignore
@ -7,7 +7,7 @@
|
||||
# Under the segmentation lines there are the folders which you need to ignore #
|
||||
##########################################################
|
||||
**
|
||||
http://license.coscl.org.cn/MulanPubL-2.0*
|
||||
http://license.coscl.org.cn/MulanPubL-2.0
|
||||
http://license.coscl.org.cn/MulanPubL-1.0
|
||||
https://open.oceanbase.com*
|
||||
https://www.oceanbase.com*
|
||||
@ -30,7 +30,6 @@
|
||||
http://www.python.org/*
|
||||
https://oracle.github.io/*
|
||||
https://en.wikipedia.org/wiki/*
|
||||
http://en.wikipedia.org/wiki/*
|
||||
https://mariadb.com/*
|
||||
https://github.com/akopytov/sysbench*
|
||||
http://foo.bar.com*
|
||||
@ -39,7 +38,6 @@
|
||||
http://llvm.org/bugs*
|
||||
https://bugs.llvm.org/*
|
||||
http://www.apache.org/licenses/*
|
||||
https://issues.apache.org/*
|
||||
https://github.com/vectorclass*
|
||||
https://github.com/jcn/cowsay-py/blob/master/cowsay.py
|
||||
http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16
|
||||
@ -125,72 +123,8 @@
|
||||
madler@alumni.caltech.edu
|
||||
http://en.wikipedia.org/wiki/X86-64#Linux
|
||||
https://github.com/jsteemann/atoi
|
||||
https://tools.ietf.org/html/rfc1951
|
||||
hewei@mail.ied.ac.cn
|
||||
http://trade.taobao.com/trade/*
|
||||
http://buy.tmall.com/order/*
|
||||
http://unit.buyer.trade.taobao.com/trade/*
|
||||
http://abc.com/*
|
||||
https://oceanbase.slack.com/*
|
||||
https://ask.oceanbase.com/*
|
||||
https://cdn.nlark.com/yuque/*
|
||||
https://h5.dingtalk.com/circle/*
|
||||
https://gw.alipayobjects.com/*
|
||||
http://yum-test.obvos.alibaba-inc.com/*
|
||||
http://yum.tbsite.net/taobao/*
|
||||
https://www.cnblogs.com/*
|
||||
http://murmurhash.googlepages.com/
|
||||
rbrown64@csc.com.au
|
||||
http://bazaar.launchpad.net/*
|
||||
http://stackoverflow.com/*
|
||||
https://stackoverflow.com/*
|
||||
https://cloud.tencent.com/*
|
||||
http://k3.alibaba-inc.com/*
|
||||
https://k3.alibaba-inc.com/*
|
||||
libecb@schmorp.de
|
||||
http://software.schmorp.de/*
|
||||
http://www-01.ibm.com/*
|
||||
http://msdn.microsoft.com/*
|
||||
http://www.open-std.org/*
|
||||
http://forums.freebsd.org/*
|
||||
http://www.ussg.indiana.edu/*
|
||||
https://www.qqxiuzi.cn/daohang.htm
|
||||
https://blog.csdn.net/*
|
||||
http://blog.csdn.net/*
|
||||
https://es5.github.io/*
|
||||
http://rapidjson.org/*
|
||||
https://tools.ietf.org/*
|
||||
http://tools.ietf.org/*
|
||||
https://github.com/madler/zlib/*
|
||||
http://www.zlib.net
|
||||
http://www.oberhumer.com/*
|
||||
http://www.quicklz.com/
|
||||
http://www.goof.com/*
|
||||
http://www.fastlz.org/*
|
||||
http://baike.corp.taobao.com/*
|
||||
http://gitlab.alibaba-inc.com/*
|
||||
https://gerry.lamost.org/*
|
||||
https://www.techonthenet.com/oracle/*
|
||||
http://www.techonthenet.com/oracle/*
|
||||
http://review.alibaba-inc.com/*
|
||||
https://gw.alicdn.com/*
|
||||
http://docs.oracle.com/*
|
||||
https://oracle-base.com/*
|
||||
https://www.kernel.org/doc/*
|
||||
https://www.atatech.org/*
|
||||
http://www.atatech.org/*
|
||||
http://oceanbase.alibaba-inc.com/*
|
||||
https://community.oracle.com/tech/*
|
||||
https://docs.docker.com/*
|
||||
http://helloworld.com/*
|
||||
http://1.1.1.1:8080/*
|
||||
https://mirrors.aliyun.com/*
|
||||
https://bixense.com/clicolors/
|
||||
martin.gieseking@uos.de
|
||||
jloup@gzip.org
|
||||
http://www.lz4.org
|
||||
https://github.com/lz4/lz4
|
||||
https://www.contributor-covenant.org/*
|
||||
https://github.com/oceanbase/*
|
||||
**/Doxyfile
|
||||
www.doxygen.org)
|
||||
https://www.gnu.org/software/libiconv/
|
||||
@ -212,9 +146,8 @@
|
||||
http://docs.mathjax.org/en/latest/output.html)
|
||||
https://www.mathjax.org
|
||||
https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/.
|
||||
https://issues.apache.org/*
|
||||
https://www.atatech.org/*
|
||||
**/*.result
|
||||
http://trade.taobao.com/trade/*
|
||||
https://workitem.aone.alibaba-inc.com/*
|
||||
http://oracle.chinaitlab.com*
|
||||
http://bugfree.corp.taobao.com*
|
||||
@ -273,6 +206,8 @@
|
||||
*@email.com
|
||||
emily@163.com
|
||||
12@126.com
|
||||
765432455@qq.com
|
||||
641745677@qq.com
|
||||
555@qq.com
|
||||
foo@aol.com
|
||||
bar@aol.com
|
||||
@ -348,6 +283,8 @@
|
||||
*@email.com
|
||||
emily@163.com
|
||||
12@126.com
|
||||
765432455@qq.com
|
||||
641745677@qq.com
|
||||
555@qq.com
|
||||
foo@aol.com
|
||||
bar@aol.com
|
||||
@ -423,6 +360,8 @@
|
||||
*@email.com
|
||||
emily@163.com
|
||||
12@126.com
|
||||
765432455@qq.com
|
||||
641745677@qq.com
|
||||
555@qq.com
|
||||
foo@aol.com
|
||||
bar@aol.com
|
||||
@ -446,10 +385,9 @@
|
||||
/tools/codestyle/**
|
||||
/src/objit/deps/googletest/**
|
||||
/.git/**
|
||||
/deps/oblib/src/lib/compress/**
|
||||
--------------------------------------------------------
|
||||
# Config the ignored fold to escape the Chinese scan by GLOB wildcard
|
||||
--------------------------------------------------------
|
||||
# Set md5 of pemFile string to filter
|
||||
# This section must be end up with '--------------------------------------------------------'!!!
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
138
CLOSE_SOURCES
Normal file
138
CLOSE_SOURCES
Normal file
@ -0,0 +1,138 @@
|
||||
# 以下代码目录或者文件,只属于商业版,不属于开源社区版
|
||||
# 本文件的目录pattern格式与CODEOWNERS相同
|
||||
# 开源裁剪方案参考: https://yuque.antfin-inc.com/docs/share/a24792b6-95f7-4a44-89cb-dd5f9bc59a58?#
|
||||
|
||||
#deps part
|
||||
deps/oblib/src/lib/xml/**
|
||||
deps/reasy
|
||||
deps/oblib/src/lib/oracleclient
|
||||
|
||||
#source part
|
||||
src/sql/parser/sql_parser_oracle_mode.l
|
||||
src/sql/parser/sql_parser_oracle_mode.y
|
||||
src/share/inner_table/sys_package/catodci.sql
|
||||
src/share/inner_table/sys_package/dbms_any.sql
|
||||
src/share/inner_table/sys_package/dbms_any_body.sql
|
||||
src/share/inner_table/sys_package/dbms_application.sql
|
||||
src/share/inner_table/sys_package/dbms_application_body.sql
|
||||
src/share/inner_table/sys_package/dbms_audit_mgmt.sql
|
||||
src/share/inner_table/sys_package/dbms_audit_mgmt_body.sql
|
||||
src/share/inner_table/sys_package/dbms_crypto.sql
|
||||
src/share/inner_table/sys_package/dbms_crypto_body.sql
|
||||
src/share/inner_table/sys_package/dbms_debug.sql
|
||||
src/share/inner_table/sys_package/dbms_debug_body.sql
|
||||
src/share/inner_table/sys_package/dbms_describe.sql
|
||||
src/share/inner_table/sys_package/dbms_describe_body.sql
|
||||
src/share/inner_table/sys_package/dbms_errlog.sql
|
||||
src/share/inner_table/sys_package/dbms_errlog_body.sql
|
||||
src/share/inner_table/sys_package/dbms_ijob.sql
|
||||
src/share/inner_table/sys_package/dbms_ijob_body.sql
|
||||
src/share/inner_table/sys_package/dbms_ischeduler.sql
|
||||
src/share/inner_table/sys_package/dbms_ischeduler_body.sql
|
||||
src/share/inner_table/sys_package/dbms_job.sql
|
||||
src/share/inner_table/sys_package/dbms_job_body.sql
|
||||
src/share/inner_table/sys_package/dbms_lob.sql
|
||||
src/share/inner_table/sys_package/dbms_lob_body.sql
|
||||
src/share/inner_table/sys_package/dbms_lock.sql
|
||||
src/share/inner_table/sys_package/dbms_lock_body.sql
|
||||
src/share/inner_table/sys_package/dbms_metadata.sql
|
||||
src/share/inner_table/sys_package/dbms_metadata_body.sql
|
||||
src/share/inner_table/sys_package/dbms_monitor.sql
|
||||
src/share/inner_table/sys_package/dbms_monitor_body.sql
|
||||
src/share/inner_table/sys_package/dbms_output.sql
|
||||
src/share/inner_table/sys_package/dbms_output_body.sql
|
||||
src/share/inner_table/sys_package/dbms_plancache.sql
|
||||
src/share/inner_table/sys_package/dbms_plancache_body.sql
|
||||
src/share/inner_table/sys_package/dbms_preprocessor.sql
|
||||
src/share/inner_table/sys_package/dbms_preprocessor_body.sql
|
||||
src/share/inner_table/sys_package/dbms_random.sql
|
||||
src/share/inner_table/sys_package/dbms_random_body.sql
|
||||
src/share/inner_table/sys_package/dbms_resource_manager.sql
|
||||
src/share/inner_table/sys_package/dbms_resource_manager_body.sql
|
||||
src/share/inner_table/sys_package/dbms_scheduler.sql
|
||||
src/share/inner_table/sys_package/dbms_scheduler_body.sql
|
||||
src/share/inner_table/sys_package/dbms_session.sql
|
||||
src/share/inner_table/sys_package/dbms_session_body.sql
|
||||
src/share/inner_table/sys_package/dbms_spm.sql
|
||||
src/share/inner_table/sys_package/dbms_spm_body.sql
|
||||
src/share/inner_table/sys_package/dbms_spm_mysql.sql
|
||||
src/share/inner_table/sys_package/dbms_spm_body_mysql.sql
|
||||
src/share/inner_table/sys_package/dbms_sql.sql
|
||||
src/share/inner_table/sys_package/dbms_sql_body.sql
|
||||
src/share/inner_table/sys_package/dbms_standard.sql
|
||||
src/share/inner_table/sys_package/dbms_stats.sql
|
||||
src/share/inner_table/sys_package/dbms_stats_body.sql
|
||||
src/share/inner_table/sys_package/dbms_sys_error.sql
|
||||
src/share/inner_table/sys_package/dbms_sys_error_body.sql
|
||||
src/share/inner_table/sys_package/dbms_utility.sql
|
||||
src/share/inner_table/sys_package/dbms_utility_body.sql
|
||||
src/share/inner_table/sys_package/dbms_utl_encode.sql
|
||||
src/share/inner_table/sys_package/dbms_utl_encode_body.sql
|
||||
src/share/inner_table/sys_package/dbms_warning.sql
|
||||
src/share/inner_table/sys_package/dbms_warning_body.sql
|
||||
src/share/inner_table/sys_package/dbms_xa.sql
|
||||
src/share/inner_table/sys_package/dbms_xa_body.sql
|
||||
src/share/inner_table/sys_package/odciconst.sql
|
||||
src/share/inner_table/sys_package/sa_components.sql
|
||||
src/share/inner_table/sys_package/sa_components_body.sql
|
||||
src/share/inner_table/sys_package/sa_label_admin.sql
|
||||
src/share/inner_table/sys_package/sa_label_admin_body.sql
|
||||
src/share/inner_table/sys_package/sa_policy_admin.sql
|
||||
src/share/inner_table/sys_package/sa_policy_admin_body.sql
|
||||
src/share/inner_table/sys_package/sa_session.sql
|
||||
src/share/inner_table/sys_package/sa_session_body.sql
|
||||
src/share/inner_table/sys_package/sa_sysdba.sql
|
||||
src/share/inner_table/sys_package/sa_sysdba_body.sql
|
||||
src/share/inner_table/sys_package/sa_user_admin.sql
|
||||
src/share/inner_table/sys_package/sa_user_admin_body.sql
|
||||
src/share/inner_table/sys_package/utl_file.sql
|
||||
src/share/inner_table/sys_package/utl_file_body.sql
|
||||
src/share/inner_table/sys_package/utl_i18n.sql
|
||||
src/share/inner_table/sys_package/utl_i18n_body.sql
|
||||
src/share/inner_table/sys_package/utl_inaddr.sql
|
||||
src/share/inner_table/sys_package/utl_inaddr_body.sql
|
||||
src/share/inner_table/sys_package/utl_raw.sql
|
||||
src/share/inner_table/sys_package/utl_raw_body.sql
|
||||
src/share/inner_table/sys_package/utlpwdmg.sql
|
||||
src/share/inner_table/sys_package/xml_type.sql
|
||||
src/share/inner_table/sys_package/xml_type_body.sql
|
||||
src/logservice/libobcdc/tests/conf
|
||||
|
||||
#tool
|
||||
tools/agentserver
|
||||
tools/codestyle
|
||||
tools/ob_bench
|
||||
tools/obmeter
|
||||
tools/obproxy
|
||||
tools/obtest
|
||||
tools/script
|
||||
tools/upgrade/README.md
|
||||
tools/ob_admin/log_miner
|
||||
|
||||
#script
|
||||
script/backup_restore
|
||||
script/ha
|
||||
script/supervisor
|
||||
script/deploy
|
||||
script/remove_old_branches.pl
|
||||
script/tpcc_create_table_3zone.sql
|
||||
script/obstat
|
||||
|
||||
#rpm part
|
||||
rpm/oceanbase-build.sh
|
||||
rpm/oceanbase-cdc-build.sh
|
||||
|
||||
#other part
|
||||
hotfuncs.txt
|
||||
observer.prof
|
||||
test
|
||||
mittest
|
||||
gdb-macros
|
||||
asan_ignore_list.txt
|
||||
CODEOWNERS
|
||||
INSTALL
|
||||
.akfarm
|
||||
.aone.yml
|
||||
.akconfig
|
||||
.ak_scan_switch
|
||||
.obdev
|
@ -3,8 +3,14 @@ cmake_minimum_required(VERSION 3.20)
|
||||
include(cmake/Utils.cmake)
|
||||
include(cmake/Env.cmake)
|
||||
|
||||
#project(OceanBase
|
||||
# VERSION 4.0.0.0
|
||||
# DESCRIPTION "OceanBase distributed database system"
|
||||
# HOMEPAGE_URL "http://oceanbase.alipay.com"
|
||||
# LANGUAGES CXX C ASM)
|
||||
|
||||
project("OceanBase_CE"
|
||||
VERSION 4.1.0.0
|
||||
VERSION 4.0.0.0
|
||||
DESCRIPTION "OceanBase distributed database system"
|
||||
HOMEPAGE_URL "https://open.oceanbase.com/"
|
||||
LANGUAGES CXX C ASM)
|
||||
@ -118,24 +124,6 @@ cmake_dependent_option(
|
||||
"NOT OB_BUILD_RPM" OFF)
|
||||
option(OB_BUILD_TEST "" OFF)
|
||||
|
||||
# OB_BUILD_RPM => build sql proxy parser
|
||||
cmake_dependent_option(
|
||||
OB_BUILD_LIBOB_SQL_PROXY_PARSER "Build lib_sql_proxy_parser" OFF
|
||||
"NOT OB_BUILD_RPM" ON
|
||||
)
|
||||
|
||||
# OB_BUILD_RPM => build OB_BUILD_LIBOBTABLE
|
||||
cmake_dependent_option(
|
||||
OB_BUILD_LIBOBTABLE "Build liboblog" OFF
|
||||
"NOT OB_BUILD_RPM" ON
|
||||
)
|
||||
|
||||
# OB_BUILD_RPM => build OB_BUILD_OBADMIN
|
||||
cmake_dependent_option(
|
||||
OB_BUILD_OBADMIN "Build ob_admin" OFF
|
||||
"NOT OB_BUILD_RPM" ON
|
||||
)
|
||||
|
||||
include(CTest)
|
||||
if (OB_BUILD_UNITTEST)
|
||||
add_subdirectory(unittest)
|
||||
@ -143,11 +131,3 @@ elseif(OB_INCLUDE_UNITTEST)
|
||||
add_subdirectory(unittest EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
|
||||
if (OB_BUILD_TOOLS)
|
||||
add_subdirectory(tools)
|
||||
elseif (OB_INCLUDE_TOOLS)
|
||||
add_subdirectory(tools EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
include(cmake/RPM.cmake)
|
||||
|
3
NEWS
Normal file
3
NEWS
Normal file
@ -0,0 +1,3 @@
|
||||
1.0 will be released.
|
||||
Kick MySQL's ass.
|
||||
perf_dev merged into master
|
@ -28,13 +28,13 @@ See [Quick start](https://open.oceanbase.com/quickStart) to try out OceanBase Da
|
||||
|
||||
## System architecture
|
||||
|
||||

|
||||
## 
|
||||
|
||||
## Roadmap
|
||||
|
||||

|
||||

|
||||
|
||||
Link: [4.0.0 function list](https://github.com/oceanbase/oceanbase/milestone/3)
|
||||
Link: [3.1.5 function list](https://github.com/oceanbase/oceanbase/milestone/6)
|
||||
|
||||
## Case study
|
||||
For our success stories, see [Success stories](https://www.oceanbase.com/en/customer/home).
|
||||
|
50
build.sh
50
build.sh
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
TOPDIR=`readlink -f \`dirname $0\``
|
||||
BUILD_SH=$TOPDIR/build.sh
|
||||
@ -17,7 +17,6 @@ NEED_MAKE=false
|
||||
NEED_INIT=false
|
||||
LLD_OPTION=ON
|
||||
ASAN_OPTION=ON
|
||||
STATIC_LINK_LGPL_DEPS_OPTION=ON
|
||||
|
||||
echo "$0 ${ALL_ARGS[@]}"
|
||||
|
||||
@ -31,25 +30,28 @@ function echo_err() {
|
||||
|
||||
function usage
|
||||
{
|
||||
echo -e "Usage:"
|
||||
echo -e "\t./build.sh -h"
|
||||
echo -e "\t./build.sh init"
|
||||
echo -e "\t./build.sh clean"
|
||||
echo -e "\t./build.sh [BuildType] [--init] [--make [MakeOptions]]"
|
||||
echo -e "Usage:
|
||||
\t./build.sh -h
|
||||
\t./build.sh init
|
||||
\t./build.sh clean
|
||||
\t./build.sh --ce
|
||||
\t./build.sh [BuildType] [--init] [--make [MakeOptions]]
|
||||
\t./build.sh [BuildType] [--init] [--ob-make [MakeOptions]]
|
||||
|
||||
echo -e "\nOPTIONS:"
|
||||
echo -e "\tBuildType => debug(default), release, errsim, dissearray, rpm"
|
||||
echo -e "\tMakeOptions => Options to make command, default: -j N"
|
||||
OPTIONS:
|
||||
BuildType => debug(default), release, errsim, dissearray, rpm
|
||||
MakeOptions => Options to make command, default: -j N
|
||||
|
||||
echo -e "\nExamples:"
|
||||
echo -e "\t# Build by debug mode and make with -j24."
|
||||
echo -e "\t./build.sh debug --make -j24"
|
||||
Examples:
|
||||
\t# Build by debug mode and make with -j24.
|
||||
\t./build.sh debug --make -j24
|
||||
|
||||
echo -e "\n\t# Init and build with release mode but not compile."
|
||||
echo -e "\t./build.sh release --init"
|
||||
\t# Init and build with release mode but not compile.
|
||||
\t./build.sh release --init
|
||||
|
||||
echo -e "\n\t# Build with rpm mode and make with default arguments."
|
||||
echo -e "\t./build.sh rpm --make"
|
||||
\t# Build with rpm mode and make with default arguments.
|
||||
\t./build.sh rpm --make
|
||||
"
|
||||
}
|
||||
|
||||
# parse arguments
|
||||
@ -62,6 +64,10 @@ function parse_args
|
||||
elif [[ "$i" == "--make" ]]
|
||||
then
|
||||
NEED_MAKE=make
|
||||
elif [[ "$i" == "--ob-make" ]]
|
||||
then
|
||||
NEED_MAKE=ob-make
|
||||
MAKE_ARGS=()
|
||||
elif [[ $NEED_MAKE == false ]]
|
||||
then
|
||||
BUILD_ARGS+=("$i")
|
||||
@ -110,7 +116,7 @@ function do_init
|
||||
exit $?
|
||||
fi
|
||||
time2_ms=$(echo $[$(date +%s%N)/1000000])
|
||||
|
||||
# 计算时间差值
|
||||
cost_time_ms=$(($time2_ms - $time1_ms))
|
||||
cost_time_s=`expr $cost_time_ms / 1000`
|
||||
let min=cost_time_s/60
|
||||
@ -164,11 +170,6 @@ function build
|
||||
xdebug_no_unity)
|
||||
do_build "$@" -DCMAKE_BUILD_TYPE=Debug -DOB_USE_LLD=$LLD_OPTION -DOB_ENABLE_UNITY=OFF
|
||||
;;
|
||||
xccls)
|
||||
do_build "$@" -DCMAKE_BUILD_TYPE=Debug -DOB_USE_LLD=$LLD_OPTION -DOB_BUILD_CCLS=ON
|
||||
# build soft link for ccls
|
||||
ln -sf ${TOPDIR}/build_ccls/compile_commands.json ${TOPDIR}/compile_commands.json
|
||||
;;
|
||||
xdebug_asan)
|
||||
do_build "$@" -DCMAKE_BUILD_TYPE=Debug -DOB_USE_LLD=$LLD_OPTION -DOB_USE_ASAN=$ASAN_OPTION
|
||||
;;
|
||||
@ -197,8 +198,7 @@ function build
|
||||
do_build "$@" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_DEBUG_LOG=ON -DENABLE_OBJ_LEAK_CHECK=ON -DOB_USE_LLD=$LLD_OPTION
|
||||
;;
|
||||
xrpm)
|
||||
STATIC_LINK_LGPL_DEPS_OPTION=OFF
|
||||
do_build "$@" -DOB_BUILD_RPM=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOB_USE_LLD=$LLD_OPTION -DENABLE_FATAL_ERROR_HANG=OFF -DENABLE_AUTO_FDO=ON -DOB_STATIC_LINK_LGPL_DEPS=$STATIC_LINK_LGPL_DEPS_OPTION
|
||||
do_build "$@" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOB_USE_LLD=$LLD_OPTION -DENABLE_FATAL_ERROR_HANG=OFF
|
||||
;;
|
||||
xenable_smart_var_check)
|
||||
do_build "$@" -DCMAKE_BUILD_TYPE=Debug -DOB_USE_LLD=$LLD_OPTION -DENABLE_SMART_VAR_CHECK=ON -DOB_ENABLE_AVX2=ON
|
||||
|
@ -1,15 +1,17 @@
|
||||
ob_define(DEBUG_PREFIX "-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.")
|
||||
ob_define(AUTO_FDO_OPT "")
|
||||
ob_define(OB_LD_BIN ld)
|
||||
ob_define(CACHE_UUID "e3cf8ff1-e7e7-4aa3-ae43-3fc35e2bb836")
|
||||
ob_define(ASAN_IGNORE_LIST "${CMAKE_SOURCE_DIR}/asan_ignore_list.txt")
|
||||
|
||||
ob_define(DEP_3RD_DIR "${CMAKE_SOURCE_DIR}/deps/3rd")
|
||||
ob_define(DEVTOOLS_DIR "${CMAKE_SOURCE_DIR}/deps/3rd/usr/local/oceanbase/devtools")
|
||||
ob_define(DEP_DIR "${CMAKE_SOURCE_DIR}/deps/3rd/usr/local/oceanbase/deps/devel")
|
||||
# TODO: will remove all DEP_3RD_DIR rpm
|
||||
ob_define(DEP_3RD_DIR "${CMAKE_SOURCE_DIR}/deps/3rd")
|
||||
|
||||
ob_define(OB_BUILD_CDC OFF)
|
||||
ob_define(OB_USE_CLANG ON)
|
||||
ob_define(OB_ERRSIM OFF)
|
||||
ob_define(BUILD_NUMBER 1)
|
||||
ob_define(AONE_BUILD_NUMBER 1)
|
||||
ob_define(OB_GPERF_MODE OFF)
|
||||
ob_define(OB_TRANS_ERRSIM OFF)
|
||||
ob_define(OB_DIS_SEARRAY OFF)
|
||||
@ -20,9 +22,6 @@ ob_define(ENABLE_FATAL_ERROR_HANG ON)
|
||||
ob_define(ENABLE_SMART_VAR_CHECK OFF)
|
||||
ob_define(ENABLE_COMPILE_DLL_MODE OFF)
|
||||
ob_define(OB_CMAKE_RULES_CHECK ON)
|
||||
ob_define(OB_STATIC_LINK_LGPL_DEPS ON)
|
||||
ob_define(HOTFUNC_PATH "${CMAKE_SOURCE_DIR}/hotfuncs.txt")
|
||||
ob_define(OB_BUILD_CCLS OFF)
|
||||
|
||||
# 'ENABLE_PERF_MODE' use for offline system insight performance test
|
||||
# PERF_MODE macro controls many special code path in system
|
||||
@ -35,6 +34,7 @@ ob_define(OB_MAX_UNITY_BATCH_SIZE 30)
|
||||
ob_define(OB_ENABLE_UNITY ON)
|
||||
|
||||
if(WITH_COVERAGE)
|
||||
# doc about coverage: https://yuque.antfin.com/docs/share/c6a2742b-bc66-4054-a781-681264a3b6fe?#
|
||||
# -ftest-coverage to generate .gcno file
|
||||
# -fprofile-arcs to generate .gcda file
|
||||
# -DDBUILD_COVERAGE marco use to mark 'coverage build type' and to handle some speical case
|
||||
@ -42,17 +42,8 @@ if(WITH_COVERAGE)
|
||||
set(DEBUG_PREFIX "")
|
||||
endif()
|
||||
|
||||
ob_define(AUTO_FDO_OPT "")
|
||||
if(ENABLE_AUTO_FDO)
|
||||
set(AUTO_FDO_OPT "-fprofile-sample-use=${CMAKE_SOURCE_DIR}/observer.prof")
|
||||
endif()
|
||||
|
||||
|
||||
# should not use initial-exec for tls-model if building OBCDC.
|
||||
if(NOT OB_BUILD_CDC)
|
||||
add_definitions(-DENABLE_INITIAL_EXEC_TLS_MODEL)
|
||||
endif()
|
||||
|
||||
if (OB_USE_CLANG)
|
||||
find_program(OB_CC clang
|
||||
"${DEVTOOLS_DIR}/bin"
|
||||
@ -73,24 +64,29 @@ if (OB_USE_CLANG)
|
||||
if (OB_USE_LLD)
|
||||
set(LD_OPT "-fuse-ld=${DEVTOOLS_DIR}/bin/ld.lld")
|
||||
set(REORDER_COMP_OPT "-ffunction-sections -funique-internal-linkage-names -fdebug-info-for-profiling")
|
||||
set(REORDER_LINK_OPT "-Wl,--no-rosegment,--build-id=sha1,--no-warn-symbol-ordering,--symbol-ordering-file,${HOTFUNC_PATH}")
|
||||
set(REORDER_LINK_OPT "-Wl,--no-rosegment,--build-id=sha1")
|
||||
set(OB_LD_BIN "${DEVTOOLS_DIR}/bin/ld.lld")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "--gcc-toolchain=${GCC9} ${DEBUG_PREFIX} ${AUTO_FDO_OPT} -fcolor-diagnostics ${REORDER_COMP_OPT} -fmax-type-align=8 ${CMAKE_ASAN_FLAG} ${CMAKE_COVERAGE_FLAG} -std=gnu++11")
|
||||
set(CMAKE_C_FLAGS "--gcc-toolchain=${GCC9} ${DEBUG_PREFIX} ${AUTO_FDO_OPT} -fcolor-diagnostics ${REORDER_COMP_OPT} -fmax-type-align=8 ${CMAKE_ASAN_FLAG} ${CMAKE_COVERAGE_FLAG}")
|
||||
set(CMAKE_CXX_FLAGS "--gcc-toolchain=${GCC9} ${DEBUG_PREFIX} ${AUTO_FDO_OPT} -fcolor-diagnostics ${REORDER_COMP_OPT} -fmax-type-align=8 ${CMAKE_ASAN_FLAG} ${CMAKE_COVERAGE_FLAG} -DCACHE_UUID=${CACHE_UUID} -std=gnu++11")
|
||||
set(CMAKE_C_FLAGS "--gcc-toolchain=${GCC9} ${DEBUG_PREFIX} ${AUTO_FDO_OPT} -fcolor-diagnostics ${REORDER_COMP_OPT} -fmax-type-align=8 ${CMAKE_ASAN_FLAG} ${CMAKE_COVERAGE_FLAG} -DCACHE_UUID=${CACHE_UUID}")
|
||||
set(CMAKE_CXX_LINK_FLAGS "${LD_OPT} --gcc-toolchain=${GCC9} ${DEBUG_PREFIX} ${AUTO_FDO_OPT}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${LD_OPT} -Wl,-z,noexecstack ${REORDER_LINK_OPT}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${LD_OPT} -Wl,-z,noexecstack ${REORDER_LINK_OPT}")
|
||||
else() # not clang, use gcc
|
||||
message("gcc9 not support currently, please set OB_USE_CLANG ON and we will finish it as soon as possible")
|
||||
endif()
|
||||
|
||||
if (OB_BUILD_CCLS)
|
||||
# ccls场景采用更大的unity的联合编译单元,ccls是非完整编译,掉用clang AST接口,单元的size和耗时成指数衰减
|
||||
set(OB_MAX_UNITY_BATCH_SIZE 200)
|
||||
# -DCCLS_LASY_ENABLE 给全局设置上,将采用ccls懒加载模式,主要针对单测case,当添加上-DCCLS_LASY_OFF,首次将会进行检索
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCCLS_LASY_ENABLE")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCCLS_LASY_ENABLE")
|
||||
find_program(OB_CC gcc
|
||||
PATHS ${DEVTOOLS_DIR}/bin
|
||||
NO_DEFAULT_PATH)
|
||||
find_program(OB_CXX g++
|
||||
PATHS ${DEVTOOLS_DIR}/bin
|
||||
NO_DEFAULT_PATH)
|
||||
if (OB_USE_LLD)
|
||||
set(LD_OPT "-B${CMAKE_SOURCE_DIR}/rpm/.compile")
|
||||
set(REORDER_COMP_OPT "-ffunction-sections")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${LD_OPT} -fdiagnostics-color ${REORDER_COMP_OPT}")
|
||||
set(CMAKE_C_FLAGS "${LD_OPT} -fdiagnostics-color ${REORDER_COMP_OPT}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-z noexecstack ${REORDER_LINK_OPT}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-z noexecstack ${REORDER_LINK_OPT}")
|
||||
endif()
|
||||
|
||||
if (OB_CC AND OB_CXX)
|
||||
@ -100,6 +96,15 @@ else()
|
||||
message(FATAL_ERROR "can't find suitable compiler")
|
||||
endif()
|
||||
|
||||
find_program(OB_COMPILE_EXECUTABLE ob-compile)
|
||||
if (NOT OB_COMPILE_EXECUTABLE)
|
||||
message(WARNING "ob-compile not found, compile locally.")
|
||||
else()
|
||||
set(CMAKE_C_COMPILER_LAUNCHER ${OB_COMPILE_EXECUTABLE})
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${OB_COMPILE_EXECUTABLE})
|
||||
set(CMAKE_C_LINKER_LAUNCHER ${OB_COMPILE_EXECUTABLE})
|
||||
set(CMAKE_CXX_LINKER_LAUNCHER ${OB_COMPILE_EXECUTABLE})
|
||||
endif()
|
||||
|
||||
option(OB_ENABLE_AVX2 "enable AVX2 and related instruction set support for x86_64" OFF)
|
||||
|
||||
|
@ -5,4 +5,5 @@ macro(ob_def_error ERR_ID ERR_MSG)
|
||||
endmacro()
|
||||
|
||||
ob_def_error(E1001 "[E1001] Header files are not allowed in CMakeLists.txt")
|
||||
ob_def_error(HELP_LINK "https://yuque.antfin.com/docs/share/f2745c4d-afc9-4c80-8348-88741f902bab?#uVf51")
|
||||
|
||||
|
@ -24,12 +24,6 @@ set(CPACK_PACKAGE_VERSION_MINOR "${OceanBase_CE_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${OceanBase_CE_VERSION_PATCH}")
|
||||
set(CPACK_RPM_PACKAGE_URL "${OceanBase_CE_HOMEPAGE_URL}")
|
||||
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
|
||||
## set relocation path install prefix for each component
|
||||
set(CPACK_RPM_DEVEL_PACKAGE_PREFIX /usr)
|
||||
set(CPACK_RPM_UTILS_PACKAGE_PREFIX /usr)
|
||||
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/home")
|
||||
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/home/admin")
|
||||
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/home/admin/oceanbase")
|
||||
set(CPACK_RPM_PACKAGE_GROUP "Applications/Databases")
|
||||
set(CPACK_RPM_PACKAGE_DESCRIPTION "OceanBase is a distributed relational database")
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "Mulan PubL v2.")
|
||||
@ -39,12 +33,8 @@ set(CPACK_RPM_SPEC_MORE_DEFINE
|
||||
"%global _missing_build_ids_terminate_build 0
|
||||
%global _find_debuginfo_opts -g
|
||||
%define __strip ${CMAKE_SOURCE_DIR}/deps/3rd/usr/local/oceanbase/devtools/bin/llvm-strip
|
||||
%undefine __brp_mangle_shebangs
|
||||
%define __debug_install_post %{_rpmconfigdir}/find-debuginfo.sh %{?_find_debuginfo_opts} %{_builddir}/%{?buildsubdir};%{nil}
|
||||
%if \\\"%name\\\" != \\\"oceanbase-ce-sql-parser\\\" && \\\"%name\\\" != \\\"oceanbase-sql-parser\\\"
|
||||
%debug_package
|
||||
%endif
|
||||
")
|
||||
%debug_package")
|
||||
|
||||
## TIPS
|
||||
#
|
||||
@ -66,6 +56,10 @@ install(FILES
|
||||
tools/upgrade/upgrade_post_checker.py
|
||||
tools/upgrade/upgrade_checker.py
|
||||
tools/upgrade/upgrade_cluster_health_checker.py
|
||||
tools/upgrade/upgrade_rolling_pre.py
|
||||
tools/upgrade/upgrade_rolling_post.py
|
||||
tools/upgrade/priv_checker.py
|
||||
tools/upgrade/mysql_to_ora_priv.py
|
||||
DESTINATION etc
|
||||
COMPONENT server)
|
||||
|
||||
@ -75,7 +69,7 @@ install(
|
||||
COMPONENT server)
|
||||
|
||||
## oceanbase-cdc
|
||||
if (NOT OB_SO_CACHE AND OB_BUILD_CDC)
|
||||
if (NOT OB_SO_CACHE)
|
||||
include(GNUInstallDirs)
|
||||
install(
|
||||
TARGETS obcdc obcdc_tailf
|
||||
@ -103,13 +97,11 @@ install(
|
||||
endif()
|
||||
|
||||
## oceanbase-sql-parser
|
||||
if (OB_BUILD_LIBOB_SQL_PROXY_PARSER)
|
||||
install(PROGRAMS
|
||||
${CMAKE_BINARY_DIR}/src/sql/parser/libob_sql_proxy_parser_static.a
|
||||
DESTINATION lib
|
||||
COMPONENT sql-parser
|
||||
)
|
||||
endif()
|
||||
install(PROGRAMS
|
||||
${CMAKE_BINARY_DIR}/src/sql/parser/libob_sql_proxy_parser_static.a
|
||||
DESTINATION lib
|
||||
COMPONENT sql-parser
|
||||
)
|
||||
|
||||
install(FILES
|
||||
src/objit/include/objit/common/ob_item_type.h
|
||||
@ -121,6 +113,13 @@ install(FILES
|
||||
DESTINATION include
|
||||
COMPONENT sql-parser)
|
||||
|
||||
## oceanbase-sql-parser
|
||||
install(PROGRAMS
|
||||
${CMAKE_BINARY_DIR}/src/sql/parser/libob_sql_proxy_parser_static.a
|
||||
DESTINATION lib
|
||||
COMPONENT sql-parser
|
||||
)
|
||||
|
||||
install(FILES
|
||||
src/objit/include/objit/common/ob_item_type.h
|
||||
deps/oblib/src/common/sql_mode/ob_sql_mode.h
|
||||
@ -291,22 +290,20 @@ install(FILES
|
||||
COMPONENT table)
|
||||
|
||||
install(FILES
|
||||
src/libtable/examples/ob_pstore_example.cpp
|
||||
src/libtable/examples/ob_kvtable_example.cpp
|
||||
src/libtable/examples/ob_table_example.cpp
|
||||
src/libtable/examples/example_makefile.mk
|
||||
src/libtable//examples/ob_pstore_example.cpp
|
||||
src/libtable//examples/ob_kvtable_example.cpp
|
||||
src/libtable//examples/ob_table_example.cpp
|
||||
src/libtable//examples/example_makefile.mk
|
||||
DESTINATION examples
|
||||
COMPONENT table)
|
||||
|
||||
if (OB_BUILD_LIBOBTABLE)
|
||||
install(PROGRAMS
|
||||
${CMAKE_BINARY_DIR}/src/libtable/src/libobtable.so
|
||||
${CMAKE_BINARY_DIR}/src/libtable/src/libobtable.so.1
|
||||
${CMAKE_BINARY_DIR}/src/libtable/src/libobtable.so.1.0.0
|
||||
${CMAKE_BINARY_DIR}/src/libtable/src/libobtable_static.a
|
||||
DESTINATION lib
|
||||
COMPONENT table)
|
||||
endif()
|
||||
install(PROGRAMS
|
||||
${CMAKE_BINARY_DIR}/src/libtable/src/libobtable.so
|
||||
${CMAKE_BINARY_DIR}/src/libtable/src/libobtable.so.1
|
||||
${CMAKE_BINARY_DIR}/src/libtable/src/libobtable.so.1.0.0
|
||||
${CMAKE_BINARY_DIR}/src/libtable/src/libobtable_static.a
|
||||
DESTINATION lib
|
||||
COMPONENT table)
|
||||
|
||||
## oceanbase-libs
|
||||
install(PROGRAMS
|
||||
@ -318,15 +315,12 @@ install(PROGRAMS
|
||||
DESTINATION lib
|
||||
COMPONENT libs
|
||||
)
|
||||
if(OB_BUILD_OBMAIN)
|
||||
## oceanbase-utils
|
||||
install(PROGRAMS
|
||||
${CMAKE_BINARY_DIR}/tools/ob_admin/ob_admin
|
||||
${CMAKE_BINARY_DIR}/tools/ob_error/src/ob_error
|
||||
DESTINATION /usr/bin
|
||||
COMPONENT utils
|
||||
)
|
||||
endif()
|
||||
## oceanbase-utils
|
||||
install(PROGRAMS
|
||||
${CMAKE_BINARY_DIR}/tools/ob_admin/ob_admin
|
||||
DESTINATION /usr/bin
|
||||
COMPONENT utils
|
||||
)
|
||||
|
||||
# install cpack to make everything work
|
||||
include(CPack)
|
||||
@ -336,4 +330,4 @@ add_custom_target(rpm
|
||||
COMMAND +make package
|
||||
DEPENDS
|
||||
observer obcdc_tailf obtable obtable_static
|
||||
ob_admin ob_error ob_sql_proxy_parser_static)
|
||||
ob_admin ob_sql_proxy_parser_static)
|
||||
|
@ -79,16 +79,9 @@ function(config_target_unity target)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(config_ccls_flag target)
|
||||
if (OB_BUILD_CCLS)
|
||||
target_compile_definitions(${target} PRIVATE CCLS_LASY_OFF)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ob_add_object_target target)
|
||||
add_library(${target} OBJECT "${${target}_cache_objects_}")
|
||||
config_target_unity(${target})
|
||||
config_ccls_flag(${target})
|
||||
endfunction()
|
||||
|
||||
function(ob_lib_add_target target)
|
||||
@ -97,12 +90,10 @@ function(ob_lib_add_target target)
|
||||
target_link_libraries(${target} PUBLIC oblib_base)
|
||||
list(APPEND oblib_object_libraries ${target})
|
||||
set(oblib_object_libraries "${oblib_object_libraries}" CACHE INTERNAL "observer library list")
|
||||
config_ccls_flag(${target})
|
||||
endfunction()
|
||||
|
||||
function(ob_add_new_object_target target target_objects_list)
|
||||
message(STATUS "ob_add_new_object_target ${target}")
|
||||
add_library(${target} OBJECT EXCLUDE_FROM_ALL "${${target_objects_list}_cache_objects_}")
|
||||
config_target_unity(${target})
|
||||
config_ccls_flag(${target})
|
||||
function(ob_add_new_object_target target_name target_objects_list)
|
||||
message(STATUS "ob_add_new_object_target ${target_name}")
|
||||
add_library(${target_name} OBJECT EXCLUDE_FROM_ALL "${${target_objects_list}_cache_objects_}")
|
||||
config_target_unity(${target_name})
|
||||
endfunction()
|
||||
|
21
deps/easy/src/io/easy_ssl.c
vendored
21
deps/easy/src/io/easy_ssl.c
vendored
@ -1707,6 +1707,14 @@ static int easy_ssl_dhparam(easy_ssl_ctx_t *ssl, char *file)
|
||||
DH *dh;
|
||||
BIO *bio;
|
||||
|
||||
/*
|
||||
* -----BEGIN DH PARAMETERS-----
|
||||
* MIGHAoGBALu8LcrYRnSQfEP89YDpz9vZWKP1aLQtSwju1OsPs1BMbAMCducQgAxc
|
||||
* y7qokiYUxb7spWWl/fHSh6K8BJvmd4Bg6RqSp1fjBI9osHb302zI8pul34HcLKcl
|
||||
* 7OZicMyaUDXYzs7vnqAnSmOrHlj6/UmI0PZdFGdX2gcd8EXP4WubAgEC
|
||||
* -----END DH PARAMETERS-----
|
||||
*/
|
||||
|
||||
static unsigned char dh1024_p[] = {
|
||||
0xBB, 0xBC, 0x2D, 0xCA, 0xD8, 0x46, 0x74, 0x90, 0x7C, 0x43, 0xFC, 0xF5,
|
||||
0x80, 0xE9, 0xCF, 0xDB, 0xD9, 0x58, 0xA3, 0xF5, 0x68, 0xB4, 0x2D, 0x4B,
|
||||
@ -1774,6 +1782,19 @@ static int easy_ssl_dhparam_mysql(easy_ssl_ctx_t *ssl)
|
||||
{
|
||||
DH *dh;
|
||||
|
||||
/*
|
||||
Diffie-Hellman key.
|
||||
Generated using: >openssl dhparam -5 -C 2048
|
||||
|
||||
-----BEGIN DH PARAMETERS-----
|
||||
MIIBCAKCAQEAil36wGZ2TmH6ysA3V1xtP4MKofXx5n88xq/aiybmGnReZMviCPEJ
|
||||
46+7VCktl/RZ5iaDH1XNG1dVQmznt9pu2G3usU+k1/VB4bQL4ZgW4u0Wzxh9PyXD
|
||||
glm99I9Xyj4Z5PVE4MyAsxCRGA1kWQpD9/zKAegUBPLNqSo886Uqg9hmn8ksyU9E
|
||||
BV5eAEciCuawh6V0O+Sj/C3cSfLhgA0GcXp3OqlmcDu6jS5gWjn3LdP1U0duVxMB
|
||||
h/neTSCSvtce4CAMYMjKNVh9P1nu+2d9ZH2Od2xhRIqMTfAS1KTqF3VmSWzPFCjG
|
||||
mjxx/bg6bOOjpgZapvB6ABWlWmRmAAWFtwIBBQ==
|
||||
-----END DH PARAMETERS-----
|
||||
*/
|
||||
static unsigned char dh2048_p[]=
|
||||
{
|
||||
0x8A, 0x5D, 0xFA, 0xC0, 0x66, 0x76, 0x4E, 0x61, 0xFA, 0xCA, 0xC0, 0x37,
|
||||
|
5
deps/init/dep_create.sh
vendored
5
deps/init/dep_create.sh
vendored
@ -86,9 +86,6 @@ function get_os_release() {
|
||||
rocky)
|
||||
version_ge "8.0" && compat_centos8 && return
|
||||
;;
|
||||
tencentos)
|
||||
version_ge "3.1" && compat_centos8 && return
|
||||
;;
|
||||
esac
|
||||
elif [[ "${OS_ARCH}x" == "aarch64x" ]]; then
|
||||
case "$ID" in
|
||||
@ -125,6 +122,8 @@ WORKSACPE_DEPS_DIR="$(cd $(dirname $0); cd ..; pwd)"
|
||||
WORKSPACE_DEPS_3RD=${WORKSACPE_DEPS_DIR}/3rd
|
||||
WORKSAPCE_DEPS_3RD_DONE=${WORKSPACE_DEPS_3RD}/DONE
|
||||
WORKSAPCE_DEPS_3RD_MD5=${WORKSPACE_DEPS_3RD}/${MD5}
|
||||
WORKSAPCE_DEPS_3RD_BUSINESS=${WORKSPACE_DEPS_3RD}/BUSINESS
|
||||
WORKSAPCE_DEPS_3RD_OPENSOURCE=${WORKSPACE_DEPS_3RD}/OPENSOURCE
|
||||
|
||||
# 开始判断本地目录依赖目录是否存在
|
||||
if [ -f ${WORKSAPCE_DEPS_3RD_MD5} ]; then
|
||||
|
15
deps/init/oceanbase.el7.aarch64.deps
vendored
15
deps/init/oceanbase.el7.aarch64.deps
vendored
@ -8,15 +8,21 @@ os=7
|
||||
arch=aarch64
|
||||
repo=http://mirrors.aliyun.com/oceanbase/community/stable/el/7/aarch64/
|
||||
|
||||
[target-tbsite]
|
||||
os=7
|
||||
arch=aarch64
|
||||
repo=http://yum.tbsite.net/taobao/7/aarch64/test/ob-deploy/
|
||||
|
||||
[deps]
|
||||
devdeps-gtest-1.8.0-132022101316.el7.aarch64.rpm
|
||||
devdeps-gtest-1.8.0-72022092914.el7.aarch64.rpm
|
||||
devdeps-isa-l-static-2.22.0-22022092915.el7.aarch64.rpm
|
||||
devdeps-libcurl-static-7.29.0-32022093010.el7.aarch64.rpm
|
||||
devdeps-libunwind-static-1.6.2-222022100410.el7.aarch64.rpm
|
||||
devdeps-mariadb-connector-c-3.1.12-12022100422.el7.aarch64.rpm
|
||||
devdeps-libaio-0.3.112-12022092915.el7.aarch64.rpm
|
||||
devdeps-rapidjson-1.1.0-12022100410.el7.aarch64.rpm
|
||||
devdeps-openssl-static-1.0.1e-12022100422.el7.aarch64.rpm
|
||||
devdeps-libxml2-2.10.3-32022111420.el7.aarch64.rpm
|
||||
devdeps-libxml2-2.9.10-12022090616.el7.aarch64.rpm
|
||||
devdeps-mxml-2.12.0-12022090616.el7.aarch64.rpm
|
||||
devdeps-apr-1.6.5-32022090616.el7.aarch64.rpm
|
||||
devdeps-xz-5.2.2-42022090615.el7.aarch64.rpm
|
||||
@ -35,9 +41,8 @@ obdevtools-gcc9-9.3.0-52022092914.el7.aarch64.rpm
|
||||
obdevtools-llvm-11.0.1-312022092921.el7.aarch64.rpm
|
||||
|
||||
[tools-deps]
|
||||
devdeps-oblogmsg-1.0-42022101823.el7.aarch64.rpm
|
||||
devdeps-oblogmsg-1.0-32022100420.el7.aarch64.rpm
|
||||
devdeps-rocksdb-6.22.1.1-52022100420.el7.aarch64.rpm
|
||||
|
||||
[test-utils]
|
||||
ob-deploy-1.6.0-41.el7.aarch64.rpm target=community
|
||||
obclient-2.0.2-3.el7.aarch64.rpm target=community
|
||||
#ob-deploy-1.5.0-12.el7.aarch64.rpm target=community
|
||||
|
9
deps/init/oceanbase.el7.x86_64.deps
vendored
9
deps/init/oceanbase.el7.x86_64.deps
vendored
@ -3,14 +3,13 @@ os=7
|
||||
arch=x86_64
|
||||
repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/7/x86_64/
|
||||
|
||||
|
||||
[target-community]
|
||||
os=7
|
||||
arch=x86_64
|
||||
repo=http://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64/
|
||||
|
||||
[deps]
|
||||
devdeps-gtest-1.8.0-132022101316.el7.x86_64.rpm
|
||||
devdeps-gtest-1.8.0-72022092914.el7.x86_64.rpm
|
||||
devdeps-isa-l-static-2.22.0-22022092915.el7.x86_64.rpm
|
||||
devdeps-libcurl-static-7.29.0-32022093010.el7.x86_64.rpm
|
||||
devdeps-libunwind-static-1.6.2-222022100410.el7.x86_64.rpm
|
||||
@ -18,7 +17,7 @@ devdeps-mariadb-connector-c-3.1.12-12022100422.el7.x86_64.rpm
|
||||
devdeps-libaio-0.3.112-12022092915.el7.x86_64.rpm
|
||||
devdeps-rapidjson-1.1.0-12022100410.el7.x86_64.rpm
|
||||
devdeps-openssl-static-1.0.1e-12022100422.el7.x86_64.rpm
|
||||
devdeps-libxml2-2.10.3-32022111420.el7.x86_64.rpm
|
||||
devdeps-libxml2-2.9.10-12022090616.el7.x86_64.rpm
|
||||
devdeps-mxml-2.12.0-12022090616.el7.x86_64.rpm
|
||||
devdeps-apr-1.6.5-32022090616.el7.x86_64.rpm
|
||||
devdeps-xz-5.2.2-42022090615.el7.x86_64.rpm
|
||||
@ -37,9 +36,7 @@ obdevtools-gcc9-9.3.0-52022092914.el7.x86_64.rpm
|
||||
obdevtools-llvm-11.0.1-312022092921.el7.x86_64.rpm
|
||||
|
||||
[tools-deps]
|
||||
devdeps-oblogmsg-1.0-42022101823.el7.x86_64.rpm
|
||||
devdeps-oblogmsg-1.0-32022100420.el7.x86_64.rpm
|
||||
devdeps-rocksdb-6.22.1.1-52022100420.el7.x86_64.rpm
|
||||
|
||||
[test-utils]
|
||||
ob-deploy-1.6.0-41.el7.x86_64.rpm target=community
|
||||
obclient-2.0.2-3.el7.x86_64.rpm target=community
|
||||
|
12
deps/init/oceanbase.el8.aarch64.deps
vendored
12
deps/init/oceanbase.el8.aarch64.deps
vendored
@ -1,7 +1,7 @@
|
||||
[target-default]
|
||||
os=8
|
||||
arch=aarch64
|
||||
repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/8/aarch64/
|
||||
repo=http://yum-test.obvos.alibaba-inc.com/oceanbase/development-kit/el/8/aarch64/
|
||||
|
||||
[target-community]
|
||||
os=8
|
||||
@ -9,14 +9,15 @@ arch=aarch64
|
||||
repo=http://mirrors.aliyun.com/oceanbase/community/stable/el/8/aarch64/
|
||||
|
||||
[deps]
|
||||
devdeps-gtest-1.8.0-132022101316.el8.aarch64.rpm
|
||||
devdeps-gtest-1.8.0-72022092914.el8.aarch64.rpm
|
||||
devdeps-isa-l-static-2.22.0-22022092915.el8.aarch64.rpm
|
||||
devdeps-libcurl-static-7.29.0-32022093010.el8.aarch64.rpm
|
||||
devdeps-libunwind-static-1.6.2-222022100410.el8.aarch64.rpm
|
||||
devdeps-mariadb-connector-c-3.1.12-12022100422.el8.aarch64.rpm
|
||||
devdeps-libaio-0.3.112-12022092915.el8.aarch64.rpm
|
||||
devdeps-rapidjson-1.1.0-12022100410.el8.aarch64.rpm
|
||||
devdeps-openssl-static-1.0.1e-12022100422.el8.aarch64.rpm
|
||||
devdeps-libxml2-2.10.3-32022111420.el8.aarch64.rpm
|
||||
devdeps-libxml2-2.9.10-12022090616.el8.aarch64.rpm
|
||||
devdeps-mxml-2.12.0-12022090616.el8.aarch64.rpm
|
||||
devdeps-apr-1.6.5-32022090616.el8.aarch64.rpm
|
||||
devdeps-xz-5.2.2-42022090615.el8.aarch64.rpm
|
||||
@ -35,9 +36,8 @@ obdevtools-gcc9-9.3.0-52022092914.el8.aarch64.rpm
|
||||
obdevtools-llvm-11.0.1-312022092921.el8.aarch64.rpm
|
||||
|
||||
[tools-deps]
|
||||
devdeps-oblogmsg-1.0-42022101823.el8.aarch64.rpm
|
||||
devdeps-oblogmsg-1.0-32022100420.el8.aarch64.rpm
|
||||
devdeps-rocksdb-6.22.1.1-52022100420.el8.aarch64.rpm
|
||||
|
||||
[test-utils]
|
||||
ob-deploy-1.6.0-41.el8.aarch64.rpm target=community
|
||||
obclient-2.0.2-3.el8.aarch64.rpm target=community
|
||||
#ob-deploy-1.5.0-12.el8.aarch64.rpm target=community
|
||||
|
11
deps/init/oceanbase.el8.x86_64.deps
vendored
11
deps/init/oceanbase.el8.x86_64.deps
vendored
@ -1,7 +1,7 @@
|
||||
[target-default]
|
||||
os=8
|
||||
arch=x86_64
|
||||
repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/8/x86_64/
|
||||
repo=http://yum-test.obvos.alibaba-inc.com/oceanbase/development-kit/el/8/x86_64/
|
||||
|
||||
[target-community]
|
||||
os=8
|
||||
@ -9,7 +9,7 @@ arch=x86_64
|
||||
repo=http://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/
|
||||
|
||||
[deps]
|
||||
devdeps-gtest-1.8.0-132022101316.el8.x86_64.rpm
|
||||
devdeps-gtest-1.8.0-72022092914.el8.x86_64.rpm
|
||||
devdeps-isa-l-static-2.22.0-22022092915.el8.x86_64.rpm
|
||||
devdeps-libcurl-static-7.29.0-32022093010.el8.x86_64.rpm
|
||||
devdeps-libunwind-static-1.6.2-222022100410.el8.x86_64.rpm
|
||||
@ -17,7 +17,7 @@ devdeps-mariadb-connector-c-3.1.12-12022100422.el8.x86_64.rpm
|
||||
devdeps-libaio-0.3.112-12022092915.el8.x86_64.rpm
|
||||
devdeps-rapidjson-1.1.0-12022100410.el8.x86_64.rpm
|
||||
devdeps-openssl-static-1.0.1e-12022100422.el8.x86_64.rpm
|
||||
devdeps-libxml2-2.10.3-32022111420.el8.x86_64.rpm
|
||||
devdeps-libxml2-2.9.10-12022090616.el8.x86_64.rpm
|
||||
devdeps-mxml-2.12.0-12022090616.el8.x86_64.rpm
|
||||
devdeps-apr-1.6.5-32022090616.el8.x86_64.rpm
|
||||
devdeps-xz-5.2.2-42022090615.el8.x86_64.rpm
|
||||
@ -36,9 +36,8 @@ obdevtools-gcc9-9.3.0-52022092914.el8.x86_64.rpm
|
||||
obdevtools-llvm-11.0.1-312022092921.el8.x86_64.rpm
|
||||
|
||||
[tools-deps]
|
||||
devdeps-oblogmsg-1.0-42022101823.el8.x86_64.rpm
|
||||
devdeps-oblogmsg-1.0-32022100420.el8.x86_64.rpm
|
||||
devdeps-rocksdb-6.22.1.1-52022100420.el8.x86_64.rpm
|
||||
|
||||
[test-utils]
|
||||
ob-deploy-1.6.0-41.el8.x86_64.rpm target=community
|
||||
obclient-2.0.2-3.el8.x86_64.rpm target=community
|
||||
#ob-deploy-1.5.0-12.el8.x86_64.rpm target=community
|
||||
|
3
deps/oblib/README.md
vendored
3
deps/oblib/README.md
vendored
@ -1 +1,4 @@
|
||||
This is a common library for OceanBase project.
|
||||
|
||||
lib code clone from http://gitlab.alibaba-inc.com/oceanbase/oceanbase/commits/master : c1e9d22c09fcbee932f50a026c8084c826734036
|
||||
2016-10-29 22:19:33
|
||||
|
10
deps/oblib/src/CMakeLists.txt
vendored
10
deps/oblib/src/CMakeLists.txt
vendored
@ -45,7 +45,7 @@ if (OB_USE_CLANG)
|
||||
if (ENABLE_SANITY)
|
||||
target_compile_options(oblib_base_base
|
||||
INTERFACE
|
||||
"$<$<COMPILE_LANGUAGE:CXX>:SHELL:-Xclang -load -Xclang ${CMAKE_CURRENT_SOURCE_DIR}/lib/alloc/libsanity_${ARCHITECTURE}.so>"
|
||||
"$<$<COMPILE_LANGUAGE:CXX>:SHELL:-Xclang -load -Xclang ${CMAKE_CURRENT_SOURCE_DIR}/lib/alloc/libsanity.so>"
|
||||
-fno-builtin-memset
|
||||
-fno-builtin-bzero
|
||||
-fno-builtin-memcpy
|
||||
@ -109,10 +109,6 @@ endif()
|
||||
|
||||
target_compile_features(oblib_base_base INTERFACE cxx_std_11)
|
||||
|
||||
set(LGPL_DEPS "-L${DEP_DIR}/lib/mariadb -lmariadb")
|
||||
if (OB_STATIC_LINK_LGPL_DEPS)
|
||||
set(LGPL_DEPS "-L${DEP_DIR}/lib/mariadb -l:libmariadbclient.a")
|
||||
endif()
|
||||
target_link_libraries(oblib_base_base_base
|
||||
INTERFACE
|
||||
oss
|
||||
@ -120,8 +116,8 @@ target_link_libraries(oblib_base_base_base
|
||||
${DEP_DIR}/lib/libisal.a
|
||||
${DEP_DIR}/lib/libssl.a
|
||||
${DEP_DIR}/lib/libcrypto.a
|
||||
${LGPL_DEPS}
|
||||
$<$<STREQUAL:"${ARCHITECTURE}","x86_64">:${DEP_DIR}/lib/libunwind.a>
|
||||
${DEP_DIR}/lib/mariadb/libmariadbclient.a
|
||||
${DEP_DIR}/lib/libunwind.a
|
||||
${DEP_DIR}/lib/libz.a
|
||||
-L${DEP_DIR}/var/usr/lib64
|
||||
-L${DEP_DIR}/var/usr/lib
|
||||
|
15
deps/oblib/src/common/ob_range.cpp
vendored
15
deps/oblib/src/common/ob_range.cpp
vendored
@ -283,21 +283,6 @@ int64_t ObNewVersionRange::hash() const
|
||||
return hash_value;
|
||||
}
|
||||
|
||||
ObLogTsRange::ObLogTsRange()
|
||||
: start_log_ts_(MIN_TS),
|
||||
end_log_ts_(MIN_TS)
|
||||
{
|
||||
}
|
||||
|
||||
OB_SERIALIZE_MEMBER(ObLogTsRange, start_log_ts_, end_log_ts_);
|
||||
|
||||
int64_t ObLogTsRange::hash() const
|
||||
{
|
||||
int64_t hash_value = 0;
|
||||
hash_value = common::murmurhash(&start_log_ts_, sizeof(start_log_ts_), hash_value);
|
||||
hash_value = common::murmurhash(&end_log_ts_, sizeof(end_log_ts_), hash_value);
|
||||
return hash_value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
45
deps/oblib/src/common/ob_range.h
vendored
45
deps/oblib/src/common/ob_range.h
vendored
@ -62,7 +62,7 @@ public:
|
||||
inline void set_all_open() { set_data(0); }
|
||||
inline void set_all_close() { data_ = INCLUSIVE_START | INCLUSIVE_END; }
|
||||
inline int8_t get_data() const { return data_; }
|
||||
inline void set_inclusive(const int8_t data)
|
||||
inline void set_inclusive(const int8_t data)
|
||||
{
|
||||
data_ &= MIN_VALUE + MAX_VALUE;
|
||||
data_ += data & (INCLUSIVE_START + INCLUSIVE_END);
|
||||
@ -325,44 +325,6 @@ public:
|
||||
TO_STRING_KV(K_(base_version), K_(snapshot_version));
|
||||
};
|
||||
|
||||
struct ObLogTsRange
|
||||
{
|
||||
OB_UNIS_VERSION(1);
|
||||
public:
|
||||
static const int64_t MIN_TS = 0;
|
||||
static const int64_t MAX_TS = INT64_MAX;
|
||||
|
||||
ObLogTsRange();
|
||||
OB_INLINE void reset();
|
||||
OB_INLINE bool is_valid() const
|
||||
{
|
||||
return end_log_ts_ >= start_log_ts_;
|
||||
}
|
||||
OB_INLINE bool is_empty() const
|
||||
{
|
||||
return end_log_ts_ == start_log_ts_;
|
||||
}
|
||||
int64_t hash() const;
|
||||
OB_INLINE bool operator == (const ObLogTsRange &range) const
|
||||
{
|
||||
return start_log_ts_ == range.start_log_ts_
|
||||
&& end_log_ts_ == range.end_log_ts_;
|
||||
}
|
||||
OB_INLINE bool operator != (const ObLogTsRange &range) const
|
||||
{
|
||||
return !this->operator==(range);
|
||||
}
|
||||
OB_INLINE bool contain(const int64_t log_ts) const
|
||||
{
|
||||
return is_valid() && start_log_ts_ < log_ts
|
||||
&& end_log_ts_ >= log_ts;
|
||||
}
|
||||
|
||||
int64_t start_log_ts_;
|
||||
int64_t end_log_ts_;
|
||||
|
||||
TO_STRING_KV(K_(start_log_ts), K_(end_log_ts));
|
||||
};
|
||||
|
||||
class ObNewRange
|
||||
{
|
||||
@ -730,11 +692,6 @@ bool ObNewVersionRange::operator ==(const ObNewVersionRange &range) const
|
||||
&& snapshot_version_ == range.snapshot_version_;
|
||||
}
|
||||
|
||||
void ObLogTsRange::reset()
|
||||
{
|
||||
start_log_ts_ = ObLogTsRange::MIN_TS;
|
||||
end_log_ts_ = ObLogTsRange::MIN_TS;
|
||||
}
|
||||
|
||||
} // end namespace common
|
||||
} // end namespace oceanbase
|
||||
|
6
deps/oblib/src/common/ob_store_format.cpp
vendored
6
deps/oblib/src/common/ob_store_format.cpp
vendored
@ -65,7 +65,7 @@ int ObStoreFormat::find_row_store_type(const ObString &row_store, ObRowStoreType
|
||||
}
|
||||
if (!is_row_store_type_valid(row_store_type)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("Unexpected row store type", K(row_store_type), K(row_store), K(ret));
|
||||
LOG_ERROR("Unexpected row store type", K(row_store_type), K(row_store), K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ int ObStoreFormat::find_store_format_type(const ObString &store_format,
|
||||
} else if (!(OB_STORE_FORMAT_INVALID < start && start <= OB_STORE_FORMAT_MAX)
|
||||
|| !(OB_STORE_FORMAT_INVALID < end && end <= OB_STORE_FORMAT_MAX)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("Unexpected store format type", K(start), K(end), K(ret));
|
||||
LOG_ERROR("Unexpected store format type", K(start), K(end), K(ret));
|
||||
} else {
|
||||
for (int64_t i = start; i < end && !is_store_format_valid(store_format_type); i++) {
|
||||
if (0 == store_format.case_compare(get_store_format_name(static_cast<ObStoreFormatType> (i)))) {
|
||||
@ -94,7 +94,7 @@ int ObStoreFormat::find_store_format_type(const ObString &store_format,
|
||||
}
|
||||
if (!is_store_format_valid(store_format_type)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("Unexpected store format type", K(store_format), K(store_format_type), K(ret));
|
||||
LOG_ERROR("Unexpected store format type", K(store_format), K(store_format_type), K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
|
31
deps/oblib/src/common/object/ob_obj_funcs.h
vendored
31
deps/oblib/src/common/object/ob_obj_funcs.h
vendored
@ -1108,10 +1108,8 @@ inline int obj_print_plain_str<ObHexStringType>(const ObObj &obj, char *buffer,
|
||||
ObCharsetType src_type = ObCharset::charset_type_by_coll(obj.get_collation_type()); \
|
||||
ObCharsetType dst_type = ObCharset::charset_type_by_coll(params.cs_type_); \
|
||||
if (src_type == CHARSET_BINARY || src_type == dst_type || src_type == CHARSET_INVALID) {\
|
||||
if (obj.get_collation_type() == CS_TYPE_BINARY && params.binary_string_print_hex_) { \
|
||||
ret = hex_print(obj.get_string_ptr(), obj.get_string_len(), buffer, length, pos); \
|
||||
} else if (params.use_memcpy_) { \
|
||||
ret = databuff_memcpy(buffer, length, pos, obj.get_string_len(), obj.get_string_ptr()); \
|
||||
if (params.use_memcpy_) { \
|
||||
ret = databuff_memcpy(buffer, length, pos, obj.get_string_len(), obj.get_string_ptr()); \
|
||||
} else { \
|
||||
ret = databuff_printf(buffer, length, pos, "%.*s", obj.get_string_len(), obj.get_string_ptr()); \
|
||||
} \
|
||||
@ -1550,10 +1548,8 @@ inline int obj_print_sql<ObJsonType>(const ObObj &obj, char *buffer, int64_t len
|
||||
} else if (OB_FAIL(j_base->print(jbuf, false))) { // json binary to string
|
||||
COMMON_LOG(WARN, "fail to convert json to string", K(ret), K(obj));
|
||||
} else if (OB_FAIL(databuff_printf(buffer, length, pos, "'"))) {
|
||||
COMMON_LOG(WARN, "fail to print \"'\"", K(ret), K(length), K(pos));
|
||||
} else if (OB_FAIL(databuff_printf(buffer, length, pos, "%.*s",
|
||||
static_cast<int>(MIN(jbuf.length(), length - pos)),
|
||||
jbuf.ptr()))) {
|
||||
COMMON_LOG(WARN, "fail to print \"\'\"", K(ret), K(length), K(pos));
|
||||
} else if (OB_FAIL(databuff_printf(buffer, length, pos, "%s", jbuf.ptr()))) {
|
||||
COMMON_LOG(WARN, "fail to print json doc", K(ret), K(length), K(pos), K(jbuf.length()));
|
||||
} else if (OB_FAIL(databuff_printf(buffer, length, pos, "'"))) {
|
||||
COMMON_LOG(WARN, "fail to print \"'\"", K(ret), K(length), K(pos));
|
||||
@ -1585,9 +1581,8 @@ inline int obj_print_plain_str<ObJsonType>(const ObObj &obj, char *buffer, int64
|
||||
} else if (params.use_memcpy_) {
|
||||
ret = databuff_memcpy(buffer, length, pos, jbuf.length(), jbuf.ptr());
|
||||
} else {
|
||||
ret = databuff_printf(buffer, length, pos, "%.*s",
|
||||
static_cast<int>(MIN(jbuf.length(), length - pos)),
|
||||
jbuf.ptr());
|
||||
int32_t length = jbuf.length();
|
||||
ret = databuff_printf(buffer, length, pos, "%.*s", length, jbuf.ptr());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1606,9 +1601,7 @@ inline int obj_print_json<ObJsonType>(const ObObj &obj, char *buf, int64_t buf_l
|
||||
COMMON_LOG(WARN, "fail to get json base", K(ret), K(in_type));
|
||||
} else if (OB_FAIL(j_base->print(jbuf, false))) { // json binary to string
|
||||
COMMON_LOG(WARN, "fail to convert json to string", K(ret), K(obj));
|
||||
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos, "%.*s",
|
||||
static_cast<int>(MIN(jbuf.length(), buf_len - pos)),
|
||||
jbuf.ptr()))) {
|
||||
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos, "%s", jbuf.ptr()))) {
|
||||
COMMON_LOG(WARN, "fail to print json doc", K(ret), K(buf_len), K(pos), K(jbuf.length()));
|
||||
}
|
||||
return ret;
|
||||
@ -2508,11 +2501,9 @@ template <>
|
||||
int ret = OB_SUCCESS; \
|
||||
ObCharsetType src_type = ObCharset::charset_type_by_coll(obj.get_collation_type()); \
|
||||
ObCharsetType dst_type = ObCharset::charset_type_by_coll(params.cs_type_); \
|
||||
if (src_type == CHARSET_BINARY && params.binary_string_print_hex_) { \
|
||||
ret = hex_print(obj.get_string_ptr(), obj.get_string_len(), buffer, length, pos); \
|
||||
} else if (src_type == dst_type) { \
|
||||
if (src_type == dst_type) { \
|
||||
if (params.use_memcpy_) { \
|
||||
ret = databuff_memcpy(buffer, length, pos, obj.get_string_len(), obj.get_string_ptr()); \
|
||||
ret = databuff_memcpy(buffer, length, pos, obj.get_string_len(), obj.get_string_ptr()); \
|
||||
} else { \
|
||||
ret = databuff_printf(buffer, length, pos, "%.*s", obj.get_string_len(), obj.get_string_ptr()); \
|
||||
} \
|
||||
@ -2676,9 +2667,7 @@ inline int obj_print_plain_str<ObLobType>(const ObObj &obj, char *buffer, int64_
|
||||
UNUSED(params);
|
||||
int ret = OB_SUCCESS;
|
||||
ObString str = obj.get_lob_print_string(length - pos);
|
||||
if (obj.get_collation_type() == CS_TYPE_BINARY && params.binary_string_print_hex_) {
|
||||
ret = hex_print(str.ptr(), str.length(), buffer, length, pos);
|
||||
} else if (params.use_memcpy_) {
|
||||
if (params.use_memcpy_) {
|
||||
ret = databuff_memcpy(buffer, length, pos, str.length(), str.ptr());
|
||||
} else {
|
||||
ret = databuff_printf(buffer, length, pos, "%.*s", str.length(), str.ptr());
|
||||
|
13
deps/oblib/src/common/object/ob_object.h
vendored
13
deps/oblib/src/common/object/ob_object.h
vendored
@ -656,8 +656,7 @@ struct ObObjPrintParams
|
||||
uint32_t use_memcpy_:1;
|
||||
uint32_t skip_escape_:1;
|
||||
uint32_t beginning_space_:1;
|
||||
uint32_t binary_string_print_hex_:1;
|
||||
uint32_t reserved_:26;
|
||||
uint32_t reserved_:27;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -947,13 +946,13 @@ public:
|
||||
{
|
||||
meta_.set_urowid();
|
||||
v_.string_ = (const char *)urowid.rowid_content_;
|
||||
val_len_ = static_cast<int32_t>(urowid.rowid_len_);
|
||||
val_len_ = urowid.rowid_len_;
|
||||
}
|
||||
void set_urowid(const char *ptr, const int64_t size)
|
||||
{
|
||||
meta_.set_urowid();
|
||||
v_.string_ = ptr;
|
||||
val_len_ = static_cast<int32_t>(size);
|
||||
val_len_ = size;
|
||||
}
|
||||
//@}
|
||||
|
||||
@ -2080,7 +2079,7 @@ inline void ObObj::set_lob_locator(const ObLobLocator &value)
|
||||
meta_.set_type(ObLobType);
|
||||
meta_.set_collation_level(CS_LEVEL_IMPLICIT);
|
||||
v_.lob_locator_ = &value;
|
||||
val_len_ = static_cast<int32_t>(value.get_total_size());
|
||||
val_len_ = value.get_total_size();
|
||||
}
|
||||
|
||||
inline void ObObj::set_lob_locator(const ObObjType type, const ObLobLocator &value)
|
||||
@ -2089,7 +2088,7 @@ inline void ObObj::set_lob_locator(const ObObjType type, const ObLobLocator &val
|
||||
meta_.set_type(ObLobType);
|
||||
meta_.set_collation_level(CS_LEVEL_IMPLICIT);
|
||||
v_.lob_locator_ = &value;
|
||||
val_len_ = static_cast<int32_t>(value.get_total_size());
|
||||
val_len_ = value.get_total_size();
|
||||
}
|
||||
|
||||
inline void ObObj::set_otimestamp_value(const ObObjType type, const ObOTimestampData &value)
|
||||
@ -3143,7 +3142,7 @@ template<>
|
||||
inline void ObObj::set_obj_value<ObURowIDData>(const ObURowIDData &urowid)
|
||||
{
|
||||
v_.string_ = (const char *)urowid.rowid_content_;
|
||||
val_len_ = static_cast<int32_t>(urowid.rowid_len_);
|
||||
val_len_ = urowid.rowid_len_;
|
||||
}
|
||||
|
||||
struct ParamFlag
|
||||
|
BIN
deps/oblib/src/lib/alloc/libsanity_aarch64.so
vendored
BIN
deps/oblib/src/lib/alloc/libsanity_aarch64.so
vendored
Binary file not shown.
9
deps/oblib/src/lib/alloc/memory_dump.cpp
vendored
9
deps/oblib/src/lib/alloc/memory_dump.cpp
vendored
@ -352,11 +352,10 @@ int label_stat(AChunk *chunk, ABlock *block, AObject *object,
|
||||
} else {
|
||||
hold = align_up2(chunk->alloc_bytes_ + ACHUNK_HEADER_SIZE, get_page_size());
|
||||
}
|
||||
char label[AOBJECT_LABEL_SIZE + 1];
|
||||
STRNCPY(label, object->label_, sizeof(label));
|
||||
label[sizeof(label) - 1] = '\0';
|
||||
int len = strlen(label);
|
||||
ObString str(len, label);
|
||||
void *label = &object->label_[0];
|
||||
void *end = memchr(label, '\0', sizeof(object->label_));
|
||||
int len = end ? (char*)end - (char*)label : sizeof(object->label_);
|
||||
ObString str(len, (char*)label);
|
||||
LabelItem *litem = nullptr;
|
||||
LabelInfoItem *linfoitem = lmap.get(str);
|
||||
if (NULL != linfoitem) {
|
||||
|
2
deps/oblib/src/lib/alloc/memory_dump.h
vendored
2
deps/oblib/src/lib/alloc/memory_dump.h
vendored
@ -102,7 +102,7 @@ struct LabelInfoItem
|
||||
void *block_;
|
||||
};
|
||||
|
||||
typedef common::hash::ObHashMap<ObString, LabelInfoItem, hash::NoPthreadDefendMode> LabelMap;
|
||||
typedef common::hash::ObHashMap<ObString, LabelInfoItem> LabelMap;
|
||||
|
||||
using lib::AChunk;
|
||||
using lib::ABlock;
|
||||
|
11
deps/oblib/src/lib/alloc/memory_sanity.cpp
vendored
11
deps/oblib/src/lib/alloc/memory_sanity.cpp
vendored
@ -49,16 +49,13 @@ void sanity_set_whitelist(const char *str)
|
||||
|
||||
void memory_sanity_abort()
|
||||
{
|
||||
if ('\0' == whitelist[0]) {
|
||||
abort();
|
||||
}
|
||||
void *addrs[128];
|
||||
int n_addr = backtrace(addrs, sizeof(addrs)/sizeof(addrs[0]));
|
||||
void *vip_addr = NULL;
|
||||
for (int i = 0; NULL == vip_addr && i < n_addr; i++) {
|
||||
for (int j = 0; NULL == vip_addr && j < sizeof(vips)/sizeof(vips[0]); j++) {
|
||||
for (int j = 0; NULL == vip_addr && j < 8; j++) {
|
||||
t_vip *vip = &vips[j];
|
||||
if ('\0' == vip->func_[0]) {
|
||||
if (0 == strlen(vip->func_)) {
|
||||
break;
|
||||
} else if (0 == vip->min_addr_ || 0 == vip->max_addr_) {
|
||||
continue;
|
||||
@ -84,9 +81,9 @@ void memory_sanity_abort()
|
||||
if (real_len < buf_len - pos) {
|
||||
pos += real_len;
|
||||
}
|
||||
for (int i = 0; i < sizeof(vips)/sizeof(vips[0]); i++) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
t_vip *vip = &vips[i];
|
||||
if ('\0' == vip->func_[0]) {
|
||||
if (0 == strlen(vip->func_)) {
|
||||
break;
|
||||
} else if (strstr(func_name, vip->func_) != NULL) {
|
||||
strncpy(vip_func, func_name, sizeof(vip_func));
|
||||
|
12
deps/oblib/src/lib/alloc/memory_sanity.h
vendored
12
deps/oblib/src/lib/alloc/memory_sanity.h
vendored
@ -72,7 +72,7 @@ static constexpr int64_t sanity_max_canonical_addr = 0x4f210376cf1c;
|
||||
|
||||
static inline bool sanity_addr_in_range(const void *ptr)
|
||||
{
|
||||
return (int64_t)ptr < sanity_max_canonical_addr && (int64_t)ptr >= sanity_min_canonical_addr;
|
||||
return (int64_t)ptr >= sanity_min_canonical_addr && (int64_t)ptr < sanity_max_canonical_addr;
|
||||
}
|
||||
|
||||
static inline void* sanity_to_shadow(const void *ptr)
|
||||
@ -139,12 +139,12 @@ static inline void sanity_check_range(const void *ptr, ssize_t len)
|
||||
char *start_align = (char*)sanity_align_up((uint64_t)start, 8);
|
||||
char *end_align = (char*)sanity_align_down((uint64_t)end, 8);
|
||||
if (start_align > start &&
|
||||
(*(int8_t*)sanity_to_shadow(start_align - 8) != 0x0 &&
|
||||
*(int8_t*)sanity_to_shadow(start_align - 8) < (len + start - (start_align - 8)))) {
|
||||
(*(uint8_t*)sanity_to_shadow(start_align - 8) != 0x0 &&
|
||||
*(uint8_t*)sanity_to_shadow(start_align - 8) < (len + start - (start_align - 8)))) {
|
||||
memory_sanity_abort();
|
||||
}
|
||||
if (end_align >= start_align + 8) {
|
||||
if (*(int8_t*)sanity_to_shadow(start_align) != 0x0) {
|
||||
if (*(uint8_t*)sanity_to_shadow(start_align) != 0x0) {
|
||||
memory_sanity_abort();
|
||||
}
|
||||
if (end_align > start_align + 8) {
|
||||
@ -157,8 +157,8 @@ static inline void sanity_check_range(const void *ptr, ssize_t len)
|
||||
}
|
||||
}
|
||||
if (end_align < end &&
|
||||
(*(int8_t*)sanity_to_shadow(end_align) != 0x0 &&
|
||||
*(int8_t*)sanity_to_shadow(end_align) < (end - end_align))) {
|
||||
(*(uint8_t*)sanity_to_shadow(end_align) != 0x0 &&
|
||||
*(uint8_t*)sanity_to_shadow(end_align) < (end - end_align))) {
|
||||
memory_sanity_abort();
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ void *ObMallocAllocator::alloc(const int64_t size, const oceanbase::lib::ObMemAt
|
||||
} else if (OB_UNLIKELY(0 == inner_attr.tenant_id_)
|
||||
|| OB_UNLIKELY(INT64_MAX == inner_attr.tenant_id_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_ERROR("invalid argument", K(inner_attr.tenant_id_), K(ret));
|
||||
LOG_ERROR("invalid argument", KCSTRING(lbt()), K(inner_attr.tenant_id_), K(ret));
|
||||
} else if (OB_NOT_NULL(allocator = get_tenant_ctx_allocator(inner_attr.tenant_id_, inner_attr.ctx_id_))) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(create_tenant_ctx_allocator(inner_attr.tenant_id_, inner_attr.ctx_id_))) {
|
||||
|
@ -216,7 +216,9 @@ void ObTenantCtxAllocator::print_usage() const
|
||||
return mgr->get_ctx_hold(ctx_id_, ctx_hold_bytes);
|
||||
});
|
||||
}
|
||||
|
||||
if (ctx_hold_bytes * 0.8 >= sum_item.hold_) {
|
||||
_LOG_WARN("there has too much memory fragments");
|
||||
}
|
||||
if (ctx_hold_bytes > 0 || sum_item.used_ > 0) {
|
||||
_LOG_INFO("\n[MEMORY] tenant_id=%5ld ctx_id=%25s hold=% '15ld used=% '15ld limit=% '15ld"
|
||||
"\n[MEMORY] idle_size=% '10ld free_size=% '10ld"
|
||||
|
2
deps/oblib/src/lib/allocator/ob_allocator.h
vendored
2
deps/oblib/src/lib/allocator/ob_allocator.h
vendored
@ -93,8 +93,6 @@ public:
|
||||
alloc_->free(ptr); ptr = NULL;
|
||||
}
|
||||
}
|
||||
virtual int64_t total() const { return alloc_ != nullptr ? alloc_->total() : 0; }
|
||||
virtual int64_t used() const { return alloc_ != nullptr ? alloc_->used() : 0; }
|
||||
void set_alloc(ObIAllocator *alloc) { alloc_ = alloc; }
|
||||
ObWrapperAllocator &operator=(const ObWrapperAllocator &that)
|
||||
{
|
||||
|
@ -18,7 +18,6 @@ namespace oceanbase
|
||||
namespace common
|
||||
{
|
||||
lib::ObSimpleRateLimiter ObMemLeakChecker::rl_ = {INT64_MAX};
|
||||
constexpr const char ObMemLeakChecker::MOD_INFO_MAP_STR[];
|
||||
|
||||
} // end of namespace common
|
||||
} // end of namespace oceanbase
|
||||
|
@ -24,7 +24,6 @@ namespace common
|
||||
{
|
||||
class ObMemLeakChecker
|
||||
{
|
||||
static constexpr const char MOD_INFO_MAP_STR[] = "leakInfoMap";
|
||||
struct PtrKey
|
||||
{
|
||||
void *ptr_;
|
||||
@ -60,26 +59,7 @@ class ObMemLeakChecker
|
||||
typedef hash::ObHashMap<PtrKey, Info> mod_alloc_info_t;
|
||||
|
||||
public:
|
||||
|
||||
class mod_info_map_t
|
||||
{
|
||||
public:
|
||||
typedef hash::ObHashMap<Info, std::pair<int64_t, int64_t>> hashmap;
|
||||
int create(int64_t bucket_num)
|
||||
{
|
||||
ObMemAttr attr(common::OB_SERVER_TENANT_ID, MOD_INFO_MAP_STR, ObCtxIds::DEFAULT_CTX_ID,
|
||||
lib::OB_HIGH_ALLOC);
|
||||
return map_.create(bucket_num, attr, attr);
|
||||
}
|
||||
|
||||
hashmap *operator->()
|
||||
{
|
||||
return &map_;
|
||||
}
|
||||
private:
|
||||
hashmap map_;
|
||||
};
|
||||
|
||||
typedef hash::ObHashMap<Info, std::pair<int64_t, int64_t>> mod_info_map_t;
|
||||
using TCharArray = char[2 * lib::AOBJECT_LABEL_SIZE + 1];
|
||||
|
||||
ObMemLeakChecker()
|
||||
@ -123,8 +103,6 @@ public:
|
||||
if (nullptr == str || 0 == STRLEN(str) || 0 == STRNCMP(str, "NONE", STRLEN("NONE"))) {
|
||||
origin_str_[0] = '\0';
|
||||
tmp_ct = NOCHECK;
|
||||
} else if (0 == STRNCMP(str, MOD_INFO_MAP_STR, strlen(MOD_INFO_MAP_STR))) {
|
||||
// ensure leak_mod is different from the mod_info_map's label
|
||||
} else {
|
||||
STRNCPY(origin_str_, str, sizeof(origin_str_));
|
||||
origin_str_[sizeof(origin_str_) - 1] = '\0';
|
||||
@ -200,7 +178,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int load_leak_info_map(mod_info_map_t &info_map)
|
||||
int load_leak_info_map(hash::ObHashMap<Info, std::pair<int64_t, int64_t>> &info_map)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
using hashtable = mod_alloc_info_t::hashtable;
|
||||
@ -212,14 +190,14 @@ public:
|
||||
while (node_it != bucket_it->node_end()) {
|
||||
std::pair<int64_t, int64_t> item;
|
||||
//_OB_LOG(INFO, "hash value, bt=%s, hash=%lu", it->second.bt_, it->second.hash());
|
||||
ret = info_map->get_refactored(node_it->second, item);
|
||||
ret = info_map.get_refactored(node_it->second, item);
|
||||
if (OB_FAIL(ret) && OB_HASH_NOT_EXIST != ret) {
|
||||
_OB_LOG(INFO, "LEAK_CHECKER, ptr=%p bt=%s", node_it->first.ptr_, node_it->second.bt_);
|
||||
} else {
|
||||
if (OB_SUCC(ret)) {
|
||||
item.first += 1;
|
||||
item.second += node_it->second.bytes_;
|
||||
if (OB_FAIL(info_map->set_refactored(node_it->second, item, 1, 0, 1))) {
|
||||
if (OB_FAIL(info_map.set_refactored(node_it->second, item, 1, 0, 1))) {
|
||||
_OB_LOG(WARN, "failed to aggregate memory size, ret=%d", ret);
|
||||
} else {
|
||||
_OB_LOG(DEBUG, "LEAK_CHECKER hash updated");
|
||||
@ -227,7 +205,7 @@ public:
|
||||
} else {
|
||||
item.first = 1;
|
||||
item.second = node_it->second.bytes_;
|
||||
if (OB_FAIL(info_map->set_refactored(node_it->second, item, 1, 0, 0))) {
|
||||
if (OB_FAIL(info_map.set_refactored(node_it->second, item, 1, 0, 0))) {
|
||||
_OB_LOG(WARN, "failed to aggregate memory size, ret=%d", ret);
|
||||
} else {
|
||||
_OB_LOG(DEBUG, "LEAK_CHECKER hash inserted");
|
||||
@ -242,8 +220,11 @@ public:
|
||||
}
|
||||
void print()
|
||||
{
|
||||
mod_info_map_t tmp_map;
|
||||
int ret = tmp_map.create(10000);
|
||||
ObMemAttr attr(common::OB_SERVER_TENANT_ID, "leakInfoMap", ObCtxIds::DEFAULT_CTX_ID,
|
||||
lib::OB_HIGH_ALLOC);
|
||||
using Hash = hash::ObHashMap<Info, std::pair<int64_t, int64_t>>;
|
||||
Hash tmp_map;
|
||||
int ret = tmp_map.create(10000, attr, attr);
|
||||
if (OB_FAIL(ret)) {
|
||||
_OB_LOG(ERROR, "failed to create hashmap, err=%d", ret);
|
||||
} else if (OB_FAIL(load_leak_info_map(tmp_map))) {
|
||||
@ -251,8 +232,8 @@ public:
|
||||
} else {
|
||||
_OB_LOG(INFO, "######## LEAK_CHECKER (str = %s)########", origin_str_);
|
||||
|
||||
mod_info_map_t::hashmap::const_iterator jt = tmp_map->begin();
|
||||
for (; jt != tmp_map->end(); ++jt)
|
||||
Hash::const_iterator jt = tmp_map.begin();
|
||||
for (; jt != tmp_map.end(); ++jt)
|
||||
{
|
||||
_OB_LOG(INFO, "[LC] bt=%s, count=%ld, bytes=%ld",
|
||||
jt->first.bt_, jt->second.first, jt->second.second);
|
||||
|
2
deps/oblib/src/lib/allocator/ob_qsync.h
vendored
2
deps/oblib/src/lib/allocator/ob_qsync.h
vendored
@ -112,7 +112,7 @@ struct QSyncCriticalGuard
|
||||
class ObDynamicQSync
|
||||
{
|
||||
public:
|
||||
enum { MAX_REF_CNT = 48 };
|
||||
enum { MAX_REF_CNT = 64 };
|
||||
struct Ref
|
||||
{
|
||||
Ref(): ref_(0) {}
|
||||
|
36
deps/oblib/src/lib/allocator/ob_slice_alloc.h
vendored
36
deps/oblib/src/lib/allocator/ob_slice_alloc.h
vendored
@ -131,11 +131,9 @@ public:
|
||||
}
|
||||
public:
|
||||
uint32_t total() { return total_; }
|
||||
int32_t stock() { return stock_; }
|
||||
int32_t remain() { return stock_ > K ? stock_ - K : (stock_ < 0 ? stock_ + K : stock_); }
|
||||
bool acquire() { return dec_if_gt(K, K) > K; }
|
||||
bool release() { return faa(-K) > 0; }
|
||||
bool recycle() {
|
||||
bool recyle() {
|
||||
int32_t total = total_;
|
||||
return inc_if_lt(2 * K, -K + total) == -K + total;
|
||||
}
|
||||
@ -273,40 +271,13 @@ public:
|
||||
LIB_LOG(INFO, "ObSliceAlloc init finished", K(bsize_), K(isize_), K(slice_limit_), KP(tmallocator_));
|
||||
}
|
||||
~ObSliceAlloc() {
|
||||
destroy();
|
||||
tmallocator_ = NULL;
|
||||
}
|
||||
int init(const int size, const int block_size, BlockAlloc& block_alloc, const ObMemAttr& attr) {
|
||||
int ret = common::OB_SUCCESS;
|
||||
new(this)ObSliceAlloc(size, attr, block_size, block_alloc, NULL);
|
||||
return ret;
|
||||
}
|
||||
void destroy() {
|
||||
for(int i = MAX_ARENA_NUM - 1; i >= 0; i--) {
|
||||
Arena& arena = arena_[i];
|
||||
Block* old_blk = arena.clear();
|
||||
if (NULL != old_blk) {
|
||||
blk_ref_[ObBlockSlicer::hash((uint64_t)old_blk) % MAX_REF_NUM].sync();
|
||||
if (old_blk->release()) {
|
||||
blk_list_.add(&old_blk->dlink_);
|
||||
}
|
||||
}
|
||||
}
|
||||
ObDLink* dlink = nullptr;
|
||||
dlink = blk_list_.top();
|
||||
while (OB_NOT_NULL(dlink)) {
|
||||
Block* blk = CONTAINER_OF(dlink, Block, dlink_);
|
||||
if (blk->recycle()) {
|
||||
destroy_block(blk);
|
||||
dlink = blk_list_.top();
|
||||
} else {
|
||||
_LIB_LOG(ERROR, "there was memory leak, stock=%d, total=%d, remain=%d"
|
||||
, blk->stock(), blk->total(), blk->remain());
|
||||
dlink = nullptr; // break
|
||||
}
|
||||
}
|
||||
tmallocator_ = NULL;
|
||||
bsize_ = 0;
|
||||
}
|
||||
void set_nway(int nway) {
|
||||
if (nway <= 0) {
|
||||
nway = 1;
|
||||
@ -380,7 +351,6 @@ public:
|
||||
Block* blk = item->host_;
|
||||
#ifndef NDEBUG
|
||||
abort_unless(blk->get_slice_alloc() == this);
|
||||
abort_unless(bsize_ != 0);
|
||||
#else
|
||||
if (this != blk->get_slice_alloc()) {
|
||||
LIB_LOG(ERROR, "blk is freed or alloced by different slice_alloc", K(this), K(blk->get_slice_alloc()));
|
||||
@ -421,7 +391,7 @@ private:
|
||||
}
|
||||
void add_to_blist(Block* blk) {
|
||||
blk_list_.add(&blk->dlink_);
|
||||
if (blk->recycle()) {
|
||||
if (blk->recyle()) {
|
||||
destroy_block(blk);
|
||||
}
|
||||
}
|
||||
|
26
deps/oblib/src/lib/allocator/ob_vslice_alloc.h
vendored
26
deps/oblib/src/lib/allocator/ob_vslice_alloc.h
vendored
@ -25,7 +25,6 @@ namespace common
|
||||
extern ObBlockAllocMgr default_blk_alloc;
|
||||
class ObBlockVSlicer
|
||||
{
|
||||
friend class ObVSliceAlloc;
|
||||
public:
|
||||
static const uint32_t ITEM_MAGIC_CODE = 0XCCEEDDF1;
|
||||
static const uint32_t ITEM_MAGIC_CODE_MASK = 0XFFFFFFF0;
|
||||
@ -73,7 +72,6 @@ private:
|
||||
|
||||
class ObVSliceAlloc : public common::ObIAllocator
|
||||
{
|
||||
friend class ObBlockVSlicer;
|
||||
public:
|
||||
enum { MAX_ARENA_NUM = 32, DEFAULT_BLOCK_SIZE = OB_MALLOC_NORMAL_BLOCK_SIZE };
|
||||
typedef ObBlockAllocMgr BlockAlloc;
|
||||
@ -93,31 +91,12 @@ public:
|
||||
ObVSliceAlloc(): nway_(0), bsize_(0), blk_alloc_(default_blk_alloc) {}
|
||||
ObVSliceAlloc(const ObMemAttr &attr, int block_size = DEFAULT_BLOCK_SIZE, BlockAlloc &blk_alloc = default_blk_alloc)
|
||||
: nway_(1), bsize_(block_size), mattr_(attr), blk_alloc_(blk_alloc) {}
|
||||
virtual ~ObVSliceAlloc() override { destroy(); }
|
||||
virtual ~ObVSliceAlloc() override {}
|
||||
int init(int block_size, BlockAlloc& block_alloc, const ObMemAttr& attr) {
|
||||
int ret = OB_SUCCESS;
|
||||
new(this)ObVSliceAlloc(attr, block_size, block_alloc);
|
||||
return ret;
|
||||
}
|
||||
void destroy() {
|
||||
for(int i = MAX_ARENA_NUM - 1; i >= 0; i--) {
|
||||
Arena& arena = arena_[i];
|
||||
Block* old_blk = arena.clear();
|
||||
if (NULL != old_blk) {
|
||||
int64_t old_pos = INT64_MAX;
|
||||
if (old_blk->freeze(old_pos)) {
|
||||
arena.sync();
|
||||
if (old_blk->retire(old_pos)) {
|
||||
destroy_block(old_blk);
|
||||
} else {
|
||||
// can not monitor all leak !!!
|
||||
LIB_LOG(ERROR, "there was memory leak", K(old_blk->ref_));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bsize_ = 0;
|
||||
}
|
||||
void set_nway(int nway) {
|
||||
if (nway <= 0) {
|
||||
nway = 1;
|
||||
@ -203,13 +182,12 @@ public:
|
||||
#ifdef OB_USE_ASAN
|
||||
::free(p);
|
||||
#else
|
||||
if (NULL != p) {
|
||||
if (bsize_ > 0 && NULL != p) {
|
||||
Block::Item* item = (Block::Item*)p - 1;
|
||||
abort_unless(Block::ITEM_MAGIC_CODE == item->MAGIC_CODE_);
|
||||
Block* blk = item->host_;
|
||||
#ifndef NDEBUG
|
||||
abort_unless(blk->get_vslice_alloc() == this);
|
||||
abort_unless(bsize_ != 0);
|
||||
#else
|
||||
if (this != blk->get_vslice_alloc()) {
|
||||
LIB_LOG(ERROR, "blk is freed or alloced by different vslice_alloc", K(this), K(blk->get_vslice_alloc()));
|
||||
|
@ -31,7 +31,6 @@ public:
|
||||
tenant_id_(0),
|
||||
user_id_(0),
|
||||
session_id_(0),
|
||||
plan_id_(0),
|
||||
sample_time_(0),
|
||||
event_no_(0),
|
||||
wait_time_(0),
|
||||
@ -76,7 +75,6 @@ public:
|
||||
uint64_t tenant_id_;
|
||||
uint64_t user_id_;
|
||||
uint64_t session_id_;
|
||||
uint64_t plan_id_;
|
||||
int64_t sample_time_; // sample time
|
||||
int64_t event_no_; // wait event no
|
||||
uint64_t wait_time_; // how long the event waited in total
|
||||
|
8
deps/oblib/src/lib/charset/ob_charset.cpp
vendored
8
deps/oblib/src/lib/charset/ob_charset.cpp
vendored
@ -2627,7 +2627,6 @@ int ObCharset::charset_convert(const ObCollationType from_type,
|
||||
char *to_str,
|
||||
uint32_t to_len,
|
||||
uint32_t &result_len,
|
||||
bool trim_incomplete_tail,
|
||||
bool report_error /*true*/,
|
||||
const ob_wc_t replaced_char /*'?'*/) {
|
||||
int ret = OB_SUCCESS;
|
||||
@ -2649,10 +2648,9 @@ int ObCharset::charset_convert(const ObCollationType from_type,
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected collation type", K(ret), K(from_type), K(to_type));
|
||||
} else {
|
||||
uint errors = 0;
|
||||
result_len = ob_convert(to_str, to_len, to_cs, from_str, from_len, from_cs,
|
||||
trim_incomplete_tail, replaced_char, &errors);
|
||||
if (OB_UNLIKELY(errors != 0 && report_error)) {
|
||||
uint errors;
|
||||
result_len = ob_convert(to_str, to_len, to_cs, from_str, from_len, from_cs, replaced_char, &errors);
|
||||
if (errors != 0 && report_error) {
|
||||
ret = OB_ERR_INCORRECT_STRING_VALUE;
|
||||
LOG_WARN("ob_convert failed", K(ret), K(errors),
|
||||
K(from_type), K(to_type),
|
||||
|
1
deps/oblib/src/lib/charset/ob_charset.h
vendored
1
deps/oblib/src/lib/charset/ob_charset.h
vendored
@ -438,7 +438,6 @@ public:
|
||||
char *to_str,
|
||||
uint32_t to_len,
|
||||
uint32_t &result_len,
|
||||
bool trim_incomplete_tail = true,
|
||||
bool report_error = true,
|
||||
const ob_wc_t replaced_char = '?');
|
||||
enum CONVERT_FLAG : int64_t {
|
||||
|
4
deps/oblib/src/lib/charset/ob_ctype.h
vendored
4
deps/oblib/src/lib/charset/ob_ctype.h
vendored
@ -561,9 +561,7 @@ void ob_hash_sort_mb_bin(const ObCharsetInfo *cs __attribute__((unused)),
|
||||
|
||||
uint32 ob_convert(char *to, uint32 to_length, const ObCharsetInfo *to_cs,
|
||||
const char *from, uint32 from_length,
|
||||
const ObCharsetInfo *from_cs,
|
||||
bool trim_incomplete_tail,
|
||||
const ob_wc_t replaced_char, uint *errors);
|
||||
const ObCharsetInfo *from_cs, const ob_wc_t replaced_char, uint *errors);
|
||||
|
||||
size_t ob_strnxfrm_unicode_full_bin(const ObCharsetInfo *cs,
|
||||
uchar *dst, size_t dstlen, uint nweights,
|
||||
|
11
deps/oblib/src/lib/charset/ob_ctype_bin_os.cc
vendored
11
deps/oblib/src/lib/charset/ob_ctype_bin_os.cc
vendored
@ -254,7 +254,7 @@ int ob_wildcmp_bin_impl(const ObCharsetInfo *cs,
|
||||
|
||||
INC_PTR(cs,wild_str,wild_end);
|
||||
cmp=likeconv(cs,cmp);
|
||||
while (true) {
|
||||
do {
|
||||
while (str != str_end && (unsigned char) likeconv(cs,*str) != cmp) {
|
||||
str++;
|
||||
}
|
||||
@ -265,15 +265,10 @@ int ob_wildcmp_bin_impl(const ObCharsetInfo *cs,
|
||||
int tmp=ob_wildcmp_bin_impl(cs,str,str_end,
|
||||
wild_str,wild_end,escape_char,
|
||||
w_one, w_many, recurse_level + 1);
|
||||
if (tmp <= 0) {
|
||||
if (tmp <= 0)
|
||||
return(tmp);
|
||||
} else if (str == str_end) {
|
||||
return -1;
|
||||
} else if (wild_str != wild_end && wild_str[0] == w_many) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (str != str_end && wild_str[0] != w_many);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
9
deps/oblib/src/lib/charset/ob_ctype_mb_os.cc
vendored
9
deps/oblib/src/lib/charset/ob_ctype_mb_os.cc
vendored
@ -211,7 +211,7 @@ int ob_wildcmp_mb_impl(const ObCharsetInfo *cs,
|
||||
mb_len= ob_ismbchar(cs, wild_str, wild_end);
|
||||
INC_PTR(cs,wild_str,wild_end);
|
||||
cmp=likeconv(cs,cmp);
|
||||
while (true) {
|
||||
do {
|
||||
while (TRUE) {
|
||||
if (str >= str_end) {
|
||||
return -1;
|
||||
@ -235,12 +235,7 @@ int ob_wildcmp_mb_impl(const ObCharsetInfo *cs,
|
||||
if (tmp <= 0)
|
||||
return (tmp);
|
||||
}
|
||||
if (str == str_end) {
|
||||
return -1;
|
||||
} else if (wild_str != wild_end && wild_str[0] == w_many) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} while (str != str_end && wild_str[0] != w_many);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
19
deps/oblib/src/lib/charset/ob_ctype_os.cc
vendored
19
deps/oblib/src/lib/charset/ob_ctype_os.cc
vendored
@ -23,7 +23,6 @@ ob_convert_internal(char *to, uint32 to_length,
|
||||
const ObCharsetInfo *to_cs,
|
||||
const char *from, uint32 from_length,
|
||||
const ObCharsetInfo *from_cs,
|
||||
bool trim_incomplete_tail,
|
||||
const ob_wc_t replaced_char, uint *errors)
|
||||
{
|
||||
unsigned int error_num= 0;
|
||||
@ -47,14 +46,7 @@ ob_convert_internal(char *to, uint32 to_length,
|
||||
wc= replaced_char;
|
||||
error_num++;
|
||||
} else {
|
||||
// Not enough characters
|
||||
if (!trim_incomplete_tail && (const uchar*) from < from_end) {
|
||||
error_num++;
|
||||
from++;
|
||||
wc= replaced_char;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
pbool go = TRUE;
|
||||
@ -79,15 +71,12 @@ ob_convert_internal(char *to, uint32 to_length,
|
||||
uint32
|
||||
ob_convert(char *to, uint32 to_length, const ObCharsetInfo *to_cs,
|
||||
const char *from, uint32 from_length,
|
||||
const ObCharsetInfo *from_cs,
|
||||
bool trim_incomplete_tail,
|
||||
const ob_wc_t replaced_char , uint *errors)
|
||||
const ObCharsetInfo *from_cs, const ob_wc_t replaced_char , 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,
|
||||
trim_incomplete_tail, replaced_char, errors);
|
||||
return ob_convert_internal(to, to_length, to_cs, from, from_length, from_cs, replaced_char, errors);
|
||||
} else {
|
||||
length= length2= OB_MIN(to_length, from_length);
|
||||
}
|
||||
@ -112,7 +101,7 @@ ob_convert(char *to, uint32 to_length, const ObCharsetInfo *to_cs,
|
||||
from_length-= copied_length;
|
||||
return copied_length + ob_convert_internal(to, to_length, to_cs,
|
||||
from, from_length, from_cs,
|
||||
trim_incomplete_tail, replaced_char, errors);
|
||||
replaced_char, errors);
|
||||
}
|
||||
*to++= *from++;
|
||||
length--;
|
||||
|
1
deps/oblib/src/lib/charset/ob_dtoa_os.cc
vendored
1
deps/oblib/src/lib/charset/ob_dtoa_os.cc
vendored
@ -2485,4 +2485,3 @@ ret1:
|
||||
return s0;
|
||||
}
|
||||
|
||||
#undef P
|
||||
|
42
deps/oblib/src/lib/checksum/ob_crc64.cpp
vendored
42
deps/oblib/src/lib/checksum/ob_crc64.cpp
vendored
@ -13,8 +13,6 @@
|
||||
#include <stdlib.h>
|
||||
#include "lib/checksum/ob_crc64.h"
|
||||
#include "lib/ob_define.h"
|
||||
#include "isa-l/crc64.h"
|
||||
#include "isa-l/crc.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -422,7 +420,8 @@ for RHEL4 support (GCC 3 doesn't support this instruction) */
|
||||
#define crc32_sse42_byte crc = __crc32cb(crc, (uint8_t)*buf); len--, buf++
|
||||
#endif /* defined(__GNUC__) && defined(__x86_64__) */
|
||||
|
||||
uint64_t crc64_sse42(uint64_t uCRC64, const char* buf, int64_t len)
|
||||
inline static uint64_t crc64_sse42(uint64_t uCRC64,
|
||||
const char *buf, int64_t len)
|
||||
{
|
||||
uint64_t crc = uCRC64;
|
||||
|
||||
@ -1103,14 +1102,6 @@ uint64_t fast_crc64_sse42_manually(uint64_t crc, const char *buf, int64_t len)
|
||||
return crc;
|
||||
}
|
||||
|
||||
//If the CPU is intel, ISA-L library for CRC can be used
|
||||
uint64_t ob_crc64_isal(uint64_t uCRC64, const char* buf, int64_t cb)
|
||||
{
|
||||
if (buf == NULL || cb <= 0){
|
||||
return uCRC64;
|
||||
}
|
||||
return crc32_iscsi((unsigned char*)(buf), cb, uCRC64);
|
||||
}
|
||||
|
||||
uint64_t crc64_sse42_dispatch(uint64_t crc, const char *buf, int64_t len)
|
||||
{
|
||||
@ -1119,29 +1110,14 @@ uint64_t crc64_sse42_dispatch(uint64_t crc, const char *buf, int64_t len)
|
||||
uint32_t b = 0;
|
||||
uint32_t c = 0;
|
||||
uint32_t d = 0;
|
||||
|
||||
uint32_t vendor_info[4];
|
||||
__asm__("mov $0x0, %eax\n\t");
|
||||
__asm__("cpuid\n\t");
|
||||
__asm__("mov %%ebx, %0\n\t":"=r" (vendor_info[0]));
|
||||
__asm__("mov %%edx, %0\n\t":"=r" (vendor_info[1]));
|
||||
__asm__("mov %%ecx, %0\n\t":"=r" (vendor_info[2]));
|
||||
vendor_info[3]='\0';
|
||||
|
||||
if (strcmp((char*)vendor_info, "GenuineIntel") == 0) {
|
||||
ob_crc64_sse42_func = &ob_crc64_isal;
|
||||
_OB_LOG(WARN, "Use ISAL for crc64 calculate");
|
||||
} else{
|
||||
asm("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(1));
|
||||
if ((c & (1 << 20)) != 0) {
|
||||
ob_crc64_sse42_func = &crc64_sse42;
|
||||
_OB_LOG(WARN, "Use CPU crc32 instructs for crc64 calculate");
|
||||
} else {
|
||||
ob_crc64_sse42_func = &fast_crc64_sse42_manually;
|
||||
_OB_LOG(WARN, "Use manual crc32 table lookup for crc64 calculate");
|
||||
}
|
||||
asm("cpuid": "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(1));
|
||||
if ((c & (1 << 20)) != 0) {
|
||||
ob_crc64_sse42_func = &crc64_sse42;
|
||||
_OB_LOG(INFO, "Use CPU crc32 instructs for crc64 calculate");
|
||||
} else {
|
||||
ob_crc64_sse42_func = &fast_crc64_sse42_manually;
|
||||
_OB_LOG(INFO, "Use manual crc32 table lookup for crc64 calculate");
|
||||
}
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
#if 1
|
||||
ob_crc64_sse42_func = &crc64_sse42;
|
||||
|
2
deps/oblib/src/lib/checksum/ob_crc64.h
vendored
2
deps/oblib/src/lib/checksum/ob_crc64.h
vendored
@ -68,8 +68,6 @@ inline uint64_t ob_crc64_sse42(const void *pv, int64_t cb)
|
||||
return (*ob_crc64_sse42_func)(0, static_cast<const char *>(pv), cb);
|
||||
}
|
||||
|
||||
uint64_t ob_crc64_isal(uint64_t uCRC64, const char* buf, int64_t cb);
|
||||
uint64_t crc64_sse42(uint64_t uCRC64, const char* buf, int64_t len);
|
||||
uint64_t crc64_sse42_manually(uint64_t crc, const char *buf, int64_t len);
|
||||
uint64_t fast_crc64_sse42_manually(uint64_t crc, const char *buf, int64_t len);
|
||||
|
||||
|
1
deps/oblib/src/lib/compress/ob_compressor.h
vendored
1
deps/oblib/src/lib/compress/ob_compressor.h
vendored
@ -40,7 +40,6 @@ public:
|
||||
int64_t &dst_data_size) = 0;
|
||||
virtual int get_max_overflow_size(const int64_t src_data_size,
|
||||
int64_t &max_overflow_size) const = 0;
|
||||
virtual void reset_mem() {}
|
||||
|
||||
virtual const char *get_compressor_name() const = 0;
|
||||
virtual ObCompressorType get_compressor_type() const = 0;
|
||||
|
@ -65,11 +65,6 @@ void ObZstdCtxAllocator::reuse()
|
||||
allocator_.reuse();
|
||||
}
|
||||
|
||||
void ObZstdCtxAllocator::reset()
|
||||
{
|
||||
allocator_.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* ----------------------------ObZstdCompressor---------------------------
|
||||
*/
|
||||
@ -152,14 +147,6 @@ int ObZstdCompressor::decompress(const char *src_buffer,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObZstdCompressor::reset_mem()
|
||||
{
|
||||
ObZstdCtxAllocator *zstd_allocator = GET_TSI_MULT(ObZstdCtxAllocator, 1);
|
||||
if (NULL != zstd_allocator) {
|
||||
zstd_allocator->reset();
|
||||
}
|
||||
}
|
||||
|
||||
const char *ObZstdCompressor::get_compressor_name() const
|
||||
{
|
||||
return all_compressor_name[ObCompressorType::ZSTD_COMPRESSOR];
|
||||
|
@ -31,7 +31,6 @@ public:
|
||||
void *alloc(size_t size);
|
||||
void free(void *addr);
|
||||
void reuse();
|
||||
void reset();
|
||||
private:
|
||||
ObArenaAllocator allocator_;
|
||||
};
|
||||
@ -55,7 +54,6 @@ public:
|
||||
ObCompressorType get_compressor_type() const;
|
||||
int get_max_overflow_size(const int64_t src_data_size,
|
||||
int64_t &max_overflow_size) const;
|
||||
void reset_mem();
|
||||
|
||||
};
|
||||
} // namespace zstd
|
||||
|
@ -66,11 +66,6 @@ void ObZstdCtxAllocator::reuse()
|
||||
allocator_.reuse();
|
||||
}
|
||||
|
||||
void ObZstdCtxAllocator::reset()
|
||||
{
|
||||
allocator_.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* ----------------------------ObZstdCompressor---------------------------
|
||||
*/
|
||||
@ -153,14 +148,6 @@ int ObZstdCompressor_1_3_8::decompress(const char *src_buffer,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObZstdCompressor_1_3_8::reset_mem()
|
||||
{
|
||||
ObZstdCtxAllocator *zstd_allocator = GET_TSI_MULT(ObZstdCtxAllocator, 1);
|
||||
if (NULL != zstd_allocator) {
|
||||
zstd_allocator->reset();
|
||||
}
|
||||
}
|
||||
|
||||
const char *ObZstdCompressor_1_3_8::get_compressor_name() const
|
||||
{
|
||||
return all_compressor_name[ObCompressorType::ZSTD_1_3_8_COMPRESSOR];
|
||||
|
@ -31,7 +31,6 @@ public:
|
||||
void *alloc(size_t size);
|
||||
void free(void *addr);
|
||||
void reuse();
|
||||
void reset();
|
||||
private:
|
||||
ObArenaAllocator allocator_;
|
||||
};
|
||||
@ -55,7 +54,6 @@ public:
|
||||
ObCompressorType get_compressor_type() const;
|
||||
int get_max_overflow_size(const int64_t src_data_size,
|
||||
int64_t &max_overflow_size) const;
|
||||
void reset_mem();
|
||||
|
||||
};
|
||||
} // namespace zstd_1_3_8
|
||||
|
10
deps/oblib/src/lib/container/ob_bitmap.cpp
vendored
10
deps/oblib/src/lib/container/ob_bitmap.cpp
vendored
@ -140,12 +140,10 @@ int ObBitmap::load_blocks_from_array(size_type *block_data, size_type num_bits)
|
||||
walk_ptr = walk_ptr->next_;
|
||||
}
|
||||
// Set bits in the same block after @valid_bits_ to false
|
||||
if (0 != (valid_bits_ & BLOCK_MOD_MASK)) {
|
||||
size_type inner_pos = valid_bits_;
|
||||
walk_ptr = find_block(valid_bits_, inner_pos);
|
||||
for (size_type i = bit_index(inner_pos); i < BITS_PER_BLOCK; ++i) {
|
||||
walk_ptr->bits_[block_index(inner_pos)] &= ~bit_mask(i);
|
||||
}
|
||||
size_type inner_pos = valid_bits_;
|
||||
walk_ptr = find_block(valid_bits_, inner_pos);
|
||||
for (size_type i = bit_index(inner_pos); i < BITS_PER_BLOCK; ++i) {
|
||||
walk_ptr->bits_[block_index(inner_pos)] &= ~bit_mask(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
15
deps/oblib/src/lib/hash/ob_array_hash_map.h
vendored
15
deps/oblib/src/lib/hash/ob_array_hash_map.h
vendored
@ -119,6 +119,21 @@ public:
|
||||
size_ = 0;
|
||||
}
|
||||
|
||||
int shrink_size(int64_t size)
|
||||
{
|
||||
LockGuard guard(lock_);
|
||||
int ret = OB_SUCCESS;
|
||||
if (size <= 0 || size > capacity_) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
COMMON_LOG(WARN, "invalid argument", K(size), K_(capacity));
|
||||
} else if (size * 2 <= capacity_) {
|
||||
capacity_ = size * 2;
|
||||
} else {
|
||||
capacity_ = size;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void print() const
|
||||
{
|
||||
COMMON_LOG(INFO, "array_hash dump begin:", K(this));
|
||||
|
307
deps/oblib/src/lib/hash/ob_ext_iter_hashset.h
vendored
Normal file
307
deps/oblib/src/lib/hash/ob_ext_iter_hashset.h
vendored
Normal file
@ -0,0 +1,307 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE 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 OCEANBASE_LIB_HASH_OB_EXT_ITER_HASHSET_H__
|
||||
#define OCEANBASE_LIB_HASH_OB_EXT_ITER_HASHSET_H__
|
||||
|
||||
#include "lib/hash/ob_iteratable_hashset.h" // ObIteratableHashSet
|
||||
#include "lib/utility/ob_print_utils.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
namespace hash
|
||||
{
|
||||
template <class K, uint64_t N, class Allocator> class ObExtIterHashSet;
|
||||
|
||||
///////////////////////////////////// ObExtIterHashSet Iterator /////////////////////////////////////
|
||||
template <class HashSet>
|
||||
class ObExtIterHashSetConstIterator
|
||||
{
|
||||
public:
|
||||
typedef typename HashSet::const_key_ref_t const_key_ref_t;
|
||||
typedef ObExtIterHashSetConstIterator<HashSet> SelfType;
|
||||
typedef typename HashSet::HashSetBucket BucketType;
|
||||
typedef typename HashSet::InnerHashSetIter InnerIter;
|
||||
|
||||
public:
|
||||
ObExtIterHashSetConstIterator(const HashSet *set, const BucketType *bucket, const InnerIter &iter)
|
||||
: hash_set_(set), bucket_(bucket), iter_(iter)
|
||||
{}
|
||||
|
||||
ObExtIterHashSetConstIterator(const SelfType &other)
|
||||
: hash_set_(other.hash_set_), bucket_(other.bucket_), iter_(other.iter_)
|
||||
{}
|
||||
|
||||
~ObExtIterHashSetConstIterator()
|
||||
{}
|
||||
|
||||
public:
|
||||
ObExtIterHashSetConstIterator &operator=(const SelfType &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
hash_set_ = other.hash_set_;
|
||||
bucket_ = other.bucket_;
|
||||
iter_ = other.iter_;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
ObExtIterHashSetConstIterator &operator=(SelfType &&other) = default;
|
||||
|
||||
bool operator==(const SelfType &other) const
|
||||
{
|
||||
return other.hash_set_ == hash_set_ && other.bucket_ == bucket_ && other.iter_ == iter_;
|
||||
}
|
||||
|
||||
bool operator!=(const SelfType &other) const
|
||||
{
|
||||
return other.hash_set_ != hash_set_ || other.bucket_ != bucket_ || other.iter_ != iter_;
|
||||
}
|
||||
|
||||
SelfType &operator++()
|
||||
{
|
||||
if (NULL == hash_set_ || NULL == bucket_) {
|
||||
LIB_LOG(ERROR, "err hash set, iter or bucket", K(hash_set_), K(bucket_));
|
||||
} else {
|
||||
// if current bucket is not null, fetch next one.
|
||||
if (iter_ != bucket_->hash_set_.end()) {
|
||||
++iter_;
|
||||
}
|
||||
|
||||
// if reach end of current bucket, step to the next bucket.
|
||||
if (iter_ == bucket_->hash_set_.end() && NULL != bucket_->next_) {
|
||||
bucket_ = bucket_->next_;
|
||||
iter_ = bucket_->hash_set_.begin();
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_key_ref_t operator*() const
|
||||
{
|
||||
if (NULL == hash_set_ || NULL == bucket_) {
|
||||
LIB_LOG(ERROR, "err hash set, iter or bucket", K(hash_set_), K(bucket_));
|
||||
}
|
||||
return *iter_;
|
||||
}
|
||||
|
||||
private:
|
||||
const HashSet *hash_set_;
|
||||
const BucketType *bucket_;
|
||||
InnerIter iter_;
|
||||
};
|
||||
|
||||
///////////////////////////////////// ObExtIterHashSet /////////////////////////////////////
|
||||
|
||||
template <class K, uint64_t N = 1031, class Allocator = ObIAllocator>
|
||||
class ObExtIterHashSet
|
||||
{
|
||||
public:
|
||||
typedef const K &const_key_ref_t;
|
||||
typedef ObIteratableHashSet<K, N> BaseHashSet;
|
||||
typedef ObExtIterHashSet<K, N, Allocator> SelfType;
|
||||
typedef ObExtIterHashSetConstIterator<SelfType> const_iterator_t;
|
||||
typedef typename BaseHashSet::const_iterator_t InnerHashSetIter;
|
||||
|
||||
struct HashSetBucket
|
||||
{
|
||||
BaseHashSet hash_set_;
|
||||
HashSetBucket *next_;
|
||||
|
||||
HashSetBucket() : hash_set_(), next_(NULL) {}
|
||||
~HashSetBucket() {}
|
||||
void reset()
|
||||
{
|
||||
hash_set_.reset();
|
||||
next_ = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
explicit ObExtIterHashSet(Allocator &allocator);
|
||||
virtual ~ObExtIterHashSet();
|
||||
|
||||
public:
|
||||
/**
|
||||
* @retval OB_SUCCESS insert successfully
|
||||
* @retval OB_HASH_EXIST key exists
|
||||
* @retval other ret failed
|
||||
*/
|
||||
int set_refactored(const K &key);
|
||||
/**
|
||||
* @retval OB_HASH_EXIST key exists
|
||||
* @retval OB_HASH_NOT_EXIST key not exists
|
||||
*/
|
||||
int exist_refactored(const K &key) const { return is_exist_(key) ? OB_HASH_EXIST : OB_HASH_NOT_EXIST; }
|
||||
|
||||
void reset();
|
||||
void clear() { reset(); }
|
||||
|
||||
const_iterator_t begin() const
|
||||
{
|
||||
return const_iterator_t(this, &buckets_, buckets_.hash_set_.begin());
|
||||
}
|
||||
|
||||
const_iterator_t end() const
|
||||
{
|
||||
return const_iterator_t(this, buckets_tail_, buckets_tail_->hash_set_.end());
|
||||
}
|
||||
|
||||
int64_t count() const { return count_; }
|
||||
|
||||
public:
|
||||
DECLARE_TO_STRING;
|
||||
|
||||
private:
|
||||
bool is_exist_(const K &key) const;
|
||||
bool is_full_() const { return count_ >= bucket_num_ * static_cast<int64_t>(N); }
|
||||
int add_bucket_();
|
||||
|
||||
private:
|
||||
int64_t count_; // count of object
|
||||
int64_t bucket_num_; // count of bucket
|
||||
Allocator &allocator_; // allocator
|
||||
HashSetBucket buckets_; // bucket lists
|
||||
HashSetBucket *buckets_tail_; // bucket lists tail
|
||||
|
||||
private:
|
||||
template <class HashSet>
|
||||
friend class ObExtIterHashSetConstIterator;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExtIterHashSet);
|
||||
};
|
||||
|
||||
template <class K, uint64_t N, class Allocator>
|
||||
ObExtIterHashSet<K, N, Allocator>::ObExtIterHashSet(Allocator &allocator) :
|
||||
count_(0),
|
||||
bucket_num_(1),
|
||||
allocator_(allocator),
|
||||
buckets_(),
|
||||
buckets_tail_(&buckets_)
|
||||
{}
|
||||
|
||||
template <class K, uint64_t N, class Allocator>
|
||||
ObExtIterHashSet<K, N, Allocator>::~ObExtIterHashSet()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
template <class K, uint64_t N, class Allocator>
|
||||
int ObExtIterHashSet<K, N, Allocator>::set_refactored(const K &key)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool exist = is_exist_(key);
|
||||
|
||||
if (exist) {
|
||||
ret = OB_HASH_EXIST;
|
||||
} else if (is_full_() && OB_FAIL(add_bucket_())) {
|
||||
LIB_LOG(WARN, "add_bucket_ fail", K(ret));
|
||||
} else {
|
||||
// keep inserting successful
|
||||
if (NULL == buckets_tail_) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LIB_LOG(WARN, "err bucket tail", K(ret));
|
||||
} else if (OB_FAIL(buckets_tail_->hash_set_.set_refactored(key))) {
|
||||
LIB_LOG(WARN, "set key into hash set fail", K(ret));
|
||||
} else {
|
||||
count_++;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <class K, uint64_t N, class Allocator>
|
||||
bool ObExtIterHashSet<K, N, Allocator>::is_exist_(const K &key) const
|
||||
{
|
||||
bool exist = false;
|
||||
const HashSetBucket *item = &buckets_;
|
||||
|
||||
while (! exist && NULL != item) {
|
||||
if (OB_HASH_EXIST == item->hash_set_.exist_refactored(key)) {
|
||||
exist = true;
|
||||
break;
|
||||
} else {
|
||||
item = item->next_;
|
||||
}
|
||||
}
|
||||
|
||||
return exist;
|
||||
}
|
||||
|
||||
template <class K, uint64_t N, class Allocator>
|
||||
int ObExtIterHashSet<K, N, Allocator>::add_bucket_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
HashSetBucket *bucket = (HashSetBucket *)allocator_.alloc(sizeof(HashSetBucket));
|
||||
if (NULL == bucket) {
|
||||
LIB_LOG(WARN, "allocate memory for bucket fail", "bucket_size", sizeof(HashSetBucket));
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
} else {
|
||||
new(bucket) HashSetBucket();
|
||||
|
||||
bucket->next_ = NULL;
|
||||
buckets_tail_->next_ = bucket;
|
||||
buckets_tail_ = bucket;
|
||||
|
||||
bucket_num_++;
|
||||
|
||||
LIB_LOG(DEBUG, "add bucket", K(bucket_num_), K(count_), K(bucket));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <class K, uint64_t N, class Allocator>
|
||||
void ObExtIterHashSet<K, N, Allocator>::reset()
|
||||
{
|
||||
HashSetBucket *bucket = buckets_.next_;
|
||||
|
||||
while (NULL != bucket) {
|
||||
HashSetBucket *next = bucket->next_;
|
||||
bucket->~HashSetBucket();
|
||||
allocator_.free((void*)bucket);
|
||||
|
||||
bucket = next;
|
||||
}
|
||||
bucket = NULL;
|
||||
|
||||
buckets_.reset();
|
||||
buckets_tail_ = &buckets_;
|
||||
bucket_num_ = 1;
|
||||
count_ = 0;
|
||||
}
|
||||
|
||||
template <class K, uint64_t N, class Allocator>
|
||||
int64_t ObExtIterHashSet<K, N, Allocator>::to_string(char *buf, const int64_t buf_len) const
|
||||
{
|
||||
int64_t pos = 0;
|
||||
J_ARRAY_START();
|
||||
const_iterator_t beg = begin();
|
||||
for (const_iterator_t it = beg;
|
||||
it != end();
|
||||
++it) {
|
||||
if (it != beg) {
|
||||
J_COMMA();
|
||||
}
|
||||
BUF_PRINTO(*it);
|
||||
}
|
||||
J_ARRAY_END();
|
||||
return pos;
|
||||
}
|
||||
} // namespace hash
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
#endif
|
164
deps/oblib/src/lib/hash/ob_fixed_hash.h
vendored
Normal file
164
deps/oblib/src/lib/hash/ob_fixed_hash.h
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE 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 OCEANBASE_HASH_OB_FIXED_HASH_H_
|
||||
#define OCEANBASE_HASH_OB_FIXED_HASH_H_
|
||||
|
||||
#include "lib/ob_define.h"
|
||||
#include "lib/queue/ob_link.h"
|
||||
#include "lib/hash/ob_hash.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
template<typename key_t>
|
||||
class FixedHash
|
||||
{
|
||||
public:
|
||||
typedef ObLink Link;
|
||||
struct node_t: public Link
|
||||
{
|
||||
node_t(): hash_(0), key_() {}
|
||||
explicit node_t(key_t key): key_(key) {
|
||||
hash_ = hash_map_calc_hash(key_);
|
||||
}
|
||||
~node_t() {}
|
||||
static uint64_t hash_map_calc_hash(key_t key)
|
||||
{
|
||||
return calc_hash(key) | 1;
|
||||
}
|
||||
|
||||
node_t* set(key_t key)
|
||||
{
|
||||
hash_ = hash_map_calc_hash(key);
|
||||
key_ = key;
|
||||
return this;
|
||||
}
|
||||
|
||||
bool is_dummy_node() {
|
||||
return 0 == (hash_ & 1);
|
||||
}
|
||||
|
||||
int compare(node_t* that)
|
||||
{
|
||||
int ret = 0;
|
||||
if (this->hash_ > that->hash_) {
|
||||
ret = 1;
|
||||
} else if (this->hash_ < that->hash_) {
|
||||
ret = -1;
|
||||
} else if (this->is_dummy_node()) {
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = common::compare(this->key_, that->key_);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
node_t* set_as_bucket(uint64_t idx)
|
||||
{
|
||||
hash_ = bitrev(idx);
|
||||
return this;
|
||||
}
|
||||
|
||||
uint64_t get_spk() { return bitrev(hash_); }
|
||||
uint64_t hash_;
|
||||
key_t key_;
|
||||
};
|
||||
|
||||
FixedHash(void* buf, int64_t size):
|
||||
nodes_((node_t*)buf), limit_(last2n(size/sizeof(node_t))) {
|
||||
init_buckets(nodes_, limit_);
|
||||
}
|
||||
~FixedHash() {}
|
||||
|
||||
int insert(key_t key, node_t* node) {
|
||||
node_t key_node(key);
|
||||
return ol_insert(get_pre(&key_node), node->set(key));
|
||||
}
|
||||
|
||||
int del(key_t key, node_t*& node) {
|
||||
node_t key_node(key);
|
||||
return ol_del(get_pre(&key_node), &key_node, node);
|
||||
}
|
||||
|
||||
int get(key_t key, node_t*& node) {
|
||||
node_t key_node(key);
|
||||
return ol_get(get_pre(&key_node), &key_node, node);
|
||||
}
|
||||
|
||||
node_t* next(node_t* node) {
|
||||
while(NULL != (node = next_node(node))
|
||||
&& node->is_dummy_node())
|
||||
;
|
||||
return node;
|
||||
}
|
||||
private:
|
||||
node_t* next_node(node_t* node) {
|
||||
node_t* next = NULL;
|
||||
if (NULL == node) {
|
||||
next = nodes_;
|
||||
} else if (is_last_bit_set((uint64_t)(next = (node_t*)ATOMIC_LOAD(&node->next_)))) {
|
||||
next = get_pre(node);
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
static uint64_t last2n(const uint64_t x)
|
||||
{
|
||||
return x == 0? 0 : (1UL << 63) >> (__builtin_clzll(x));
|
||||
}
|
||||
|
||||
static uint64_t bitrev(uint64_t x)
|
||||
{
|
||||
x = (((x & 0xaaaaaaaaaaaaaaaaUL) >> 1) | ((x & 0x5555555555555555UL) << 1));
|
||||
x = (((x & 0xccccccccccccccccUL) >> 2) | ((x & 0x3333333333333333UL) << 2));
|
||||
x = (((x & 0xf0f0f0f0f0f0f0f0UL) >> 4) | ((x & 0x0f0f0f0f0f0f0f0fUL) << 4));
|
||||
x = (((x & 0xff00ff00ff00ff00UL) >> 8) | ((x & 0x00ff00ff00ff00ffUL) << 8));
|
||||
x = (((x & 0xffff0000ffff0000UL) >> 16) | ((x & 0x0000ffff0000ffff) << 16));
|
||||
return((x >> 32) | (x << 32));
|
||||
}
|
||||
|
||||
static uint64_t get_idx(uint64_t spk, uint64_t bcnt)
|
||||
{
|
||||
return bcnt == 0? 0 : (spk & (bcnt - 1));
|
||||
}
|
||||
|
||||
node_t* get_pre(node_t* key_node)
|
||||
{
|
||||
return nodes_ + get_idx(key_node->get_spk(), limit_);
|
||||
}
|
||||
|
||||
static uint64_t get_bucket_pre_idx(uint64_t idx) {
|
||||
return idx & ~last2n(idx);
|
||||
}
|
||||
|
||||
static int init_buckets(node_t* nodes, int64_t limit) {
|
||||
int err = 0;
|
||||
new(nodes)node_t[limit];
|
||||
nodes[0].set_as_bucket(0);
|
||||
for(int64_t i = 1; 0 == err && i < limit; i++) {
|
||||
node_t* node = nodes + i;
|
||||
node->set_as_bucket(i);
|
||||
err = ol_insert(nodes + get_bucket_pre_idx(i), node);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
private:
|
||||
node_t* nodes_;
|
||||
int64_t limit_;
|
||||
};
|
||||
|
||||
}; // end namespace common
|
||||
}; // end namespace oceanbase
|
||||
#endif /* OCEANBASE_HASH_OB_FIXED_HASH_H_ */
|
4
deps/oblib/src/lib/hash/ob_hashmap.h
vendored
4
deps/oblib/src/lib/hash/ob_hashmap.h
vendored
@ -104,10 +104,6 @@ public:
|
||||
{
|
||||
return ht_.size();
|
||||
}
|
||||
int64_t bucket_count() const
|
||||
{
|
||||
return ht_.get_bucket_count();
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return 0 == ht_.size();
|
||||
|
2
deps/oblib/src/lib/hash/ob_hashtable.h
vendored
2
deps/oblib/src/lib/hash/ob_hashtable.h
vendored
@ -1331,8 +1331,6 @@ public:
|
||||
return size_;
|
||||
}
|
||||
|
||||
int64_t get_bucket_count() const { return bucket_num_; }
|
||||
|
||||
public:
|
||||
template<class _archive>
|
||||
int serialization(_archive &archive)
|
||||
|
16
deps/oblib/src/lib/hash/ob_linear_hash_map.h
vendored
16
deps/oblib/src/lib/hash/ob_linear_hash_map.h
vendored
@ -182,18 +182,10 @@ struct ShareMemMgrTag { };
|
||||
/* Don't use this mode unless you know what it means. */
|
||||
struct UniqueMemMgrTag { };
|
||||
|
||||
// avoid allocator destructed before HashMap
|
||||
template <typename Key, typename Value, typename MemMgrTag>
|
||||
struct ConstructGuard
|
||||
{
|
||||
public:
|
||||
ConstructGuard();
|
||||
};
|
||||
|
||||
template <typename Key, typename Value, typename MemMgrTag = ShareMemMgrTag>
|
||||
class ObLinearHashMap : public ConstructGuard<Key, Value, MemMgrTag>
|
||||
class ObLinearHashMap
|
||||
{
|
||||
friend class ConstructGuard<Key, Value, MemMgrTag>;
|
||||
private:
|
||||
/* Entry. */
|
||||
struct Node
|
||||
@ -2380,12 +2372,6 @@ bool ObLinearHashMap<Key, Value, MemMgrTag>::DoRemoveIfOnBkt<Function>::operator
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename Key, typename Value, typename MemMgrTag>
|
||||
ConstructGuard<Key, Value, MemMgrTag>::ConstructGuard()
|
||||
{
|
||||
auto& t = ObLinearHashMap<Key, Value, MemMgrTag>::HashMapMemMgrCore::get_instance();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
379
deps/oblib/src/lib/hash/ob_pre_alloc_link_hashmap.h
vendored
Normal file
379
deps/oblib/src/lib/hash/ob_pre_alloc_link_hashmap.h
vendored
Normal file
@ -0,0 +1,379 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE 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 SRC_LIBRARY_SRC_LIB_HASH_OB_MEMLESS_LINK_HASHMAP_H_
|
||||
#define SRC_LIBRARY_SRC_LIB_HASH_OB_MEMLESS_LINK_HASHMAP_H_
|
||||
|
||||
#include "lib/ob_define.h"
|
||||
#include "lib/hash/ob_hashutils.h"
|
||||
#include "lib/atomic/ob_atomic.h"
|
||||
#include "lib/utility/ob_print_utils.h"
|
||||
#include "lib/container/ob_array.h"
|
||||
#include "lib/lock/ob_bucket_lock.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
namespace hash
|
||||
{
|
||||
|
||||
// ObMemLessLinkHashMap is convenient for reuse of node.
|
||||
// there is a simple allocator in the map.
|
||||
// memory of node should be pre-allocated.
|
||||
// use of storage of table and meta block.
|
||||
template <class KEY, class ITEM>
|
||||
struct ObPreAllocLinkHashNode
|
||||
{
|
||||
explicit ObPreAllocLinkHashNode(ITEM &item): item_(item) {}
|
||||
virtual ~ObPreAllocLinkHashNode() { }
|
||||
virtual OB_INLINE bool equals(const ObPreAllocLinkHashNode &node) { return equals(node.get_key()); }
|
||||
virtual OB_INLINE bool equals(const KEY &key) { return get_key() == key; }
|
||||
//derived class should override static uint64_t hash(const uint64_t &key);
|
||||
|
||||
virtual const KEY &get_key() const = 0;
|
||||
VIRTUAL_TO_STRING_KV(KP(this), K_(item));
|
||||
|
||||
ITEM &item_;
|
||||
};
|
||||
|
||||
template <class KEY, class ITEM, class NODE, class ITEM_PROTECTOR>
|
||||
class ObPreAllocLinkHashMap
|
||||
{
|
||||
public:
|
||||
class ForeachFunctor
|
||||
{
|
||||
public:
|
||||
virtual int operator()(ITEM &item, bool &is_full) = 0;
|
||||
};
|
||||
|
||||
class EraseChecker
|
||||
{
|
||||
public:
|
||||
virtual int operator()(ITEM &item) = 0;
|
||||
};
|
||||
|
||||
class GetFunctor
|
||||
{
|
||||
public:
|
||||
virtual int operator()(ITEM &item) = 0;
|
||||
};
|
||||
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
explicit Iterator(ObPreAllocLinkHashMap &map)
|
||||
: items_(),
|
||||
item_idx_(0),
|
||||
bucket_pos_(0),
|
||||
map_(map)
|
||||
{
|
||||
}
|
||||
virtual ~Iterator() { release_items(); }
|
||||
int get_next(ITEM *&item)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
item = NULL;
|
||||
|
||||
while (OB_SUCC(ret)) {
|
||||
if (item_idx_ < items_.count()) {
|
||||
item = items_.at(item_idx_);
|
||||
++item_idx_;
|
||||
break;
|
||||
} else if (bucket_pos_ >= map_.buckets_count_) {
|
||||
ret = OB_ITER_END;
|
||||
} else {
|
||||
item_idx_ = 0;
|
||||
release_items();
|
||||
ObBucketRLockGuard guard(map_.buckets_lock_, bucket_pos_);
|
||||
if (NULL != map_.buckets_[bucket_pos_]) {
|
||||
NODE *node = map_.buckets_[bucket_pos_];
|
||||
while (OB_SUCC(ret) && NULL != node) {
|
||||
ITEM_PROTECTOR::hold(node->item_);
|
||||
if (OB_FAIL(items_.push_back(&node->item_))) {
|
||||
COMMON_LOG(WARN, "Failed to add item", K(ret));
|
||||
ITEM_PROTECTOR::release(node->item_);
|
||||
} else {
|
||||
node = node->next_;
|
||||
}
|
||||
}
|
||||
}
|
||||
++bucket_pos_;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
private:
|
||||
void release_items()
|
||||
{
|
||||
for (int64_t i = 0; i < items_.count(); ++i) {
|
||||
ITEM_PROTECTOR::release(*items_.at(i));
|
||||
}
|
||||
items_.reuse();
|
||||
}
|
||||
common::ObArray<ITEM *> items_;
|
||||
int64_t item_idx_;
|
||||
int64_t bucket_pos_;
|
||||
ObPreAllocLinkHashMap &map_;
|
||||
DISALLOW_COPY_AND_ASSIGN(Iterator);
|
||||
};
|
||||
|
||||
ObPreAllocLinkHashMap()
|
||||
: is_inited_(false),
|
||||
buckets_lock_(),
|
||||
count_(),
|
||||
buckets_(NULL),
|
||||
buckets_count_(1),
|
||||
allocator_()
|
||||
{
|
||||
}
|
||||
virtual ~ObPreAllocLinkHashMap()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
|
||||
void destroy()
|
||||
{
|
||||
for (uint64_t bucket_pos = 0; NULL != buckets_ && bucket_pos < buckets_count_; ++bucket_pos) {
|
||||
ObBucketRLockGuard bucket_guard(buckets_lock_, bucket_pos);
|
||||
NODE *cur = buckets_[bucket_pos];
|
||||
NODE *next = NULL;
|
||||
while (NULL != cur) {
|
||||
next = cur->next_;
|
||||
free_node(cur);
|
||||
cur = next;
|
||||
}
|
||||
}
|
||||
is_inited_ = false;
|
||||
buckets_lock_.destroy();
|
||||
count_ = 0;
|
||||
ob_free(buckets_);
|
||||
buckets_ = NULL;
|
||||
buckets_count_ = 1;
|
||||
}
|
||||
|
||||
int init(const int64_t buckets_count, const uint32_t latch_id, const lib::ObLabel &label)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObMemAttr mem_attr(OB_SERVER_TENANT_ID, label);
|
||||
const int64_t real_buckets_count = hash::cal_next_prime(buckets_count);
|
||||
|
||||
if (is_inited_) {
|
||||
ret = OB_INIT_TWICE;
|
||||
COMMON_LOG(WARN, "cannot init twice", K(ret));
|
||||
} else if (real_buckets_count <= 0 || buckets_count <= 0) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
COMMON_LOG(WARN, "invalid bucket count", K(ret), K(real_buckets_count), K(buckets_count));
|
||||
} else if (OB_FAIL(buckets_lock_.init(real_buckets_count, latch_id, label))) {
|
||||
COMMON_LOG(WARN, "failed to init buckets lock", K(ret));
|
||||
} else if (OB_ISNULL(buckets_ = reinterpret_cast<NODE**>(
|
||||
ob_malloc(sizeof(NODE*) * real_buckets_count, mem_attr)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
COMMON_LOG(WARN, "failed to alloc buckets", K(ret), K(real_buckets_count));
|
||||
} else {
|
||||
allocator_.set_label(label);
|
||||
MEMSET(buckets_, 0, sizeof(NODE*) * real_buckets_count);
|
||||
COMMON_LOG(INFO, "init hashmap", K(buckets_count), K(real_buckets_count),
|
||||
"buf_size", sizeof(NODE*) * real_buckets_count, K(latch_id), K(label));
|
||||
count_ = 0;
|
||||
buckets_count_ = real_buckets_count;
|
||||
is_inited_ = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t get_count() const { return ATOMIC_LOAD(&count_); }
|
||||
uint64_t get_buckets_count() const { return buckets_count_; }
|
||||
|
||||
NODE *alloc_node(ITEM &item)
|
||||
{
|
||||
return allocator_.alloc(item);
|
||||
}
|
||||
|
||||
void free_node(NODE *&node)
|
||||
{
|
||||
allocator_.free(node);
|
||||
node = NULL;
|
||||
}
|
||||
|
||||
int put(NODE &node)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
COMMON_LOG(WARN, "not inited", K(ret));
|
||||
} else {
|
||||
const uint64_t bucket_pos = NODE::hash(node.get_key()) % buckets_count_;
|
||||
ObBucketWLockGuard bucket_guard(buckets_lock_, bucket_pos);
|
||||
NODE *cur = buckets_[bucket_pos];
|
||||
while (NULL != cur) {
|
||||
if (cur->equals(node)) {
|
||||
break;
|
||||
} else {
|
||||
cur = cur->next_;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != cur) {
|
||||
ret = OB_HASH_EXIST;
|
||||
} else {
|
||||
node.next_ = buckets_[bucket_pos];
|
||||
buckets_[bucket_pos] = &node;
|
||||
ATOMIC_INC(&count_);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// delete node which has common key
|
||||
int erase(const KEY &key, ITEM *&del_item, EraseChecker *checker = NULL)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
del_item = NULL;
|
||||
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
COMMON_LOG(WARN, "not inited", K(ret));
|
||||
} else {
|
||||
const uint64_t bucket_pos = NODE::hash(key) % buckets_count_;
|
||||
ObBucketWLockGuard bucket_guard(buckets_lock_, bucket_pos);
|
||||
NODE *cur = buckets_[bucket_pos];
|
||||
NODE *prev = NULL;
|
||||
while (NULL != cur) {
|
||||
if (cur->equals(key)) {
|
||||
break;
|
||||
} else {
|
||||
prev = cur;
|
||||
cur = cur->next_;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == cur) {
|
||||
ret = OB_HASH_NOT_EXIST;
|
||||
} else if (NULL != checker && OB_FAIL((*checker)(cur->item_))) {
|
||||
// cannot erase now
|
||||
} else {
|
||||
if (NULL != prev) {
|
||||
prev->next_ = cur->next_;
|
||||
} else {
|
||||
buckets_[bucket_pos] = cur->next_;
|
||||
}
|
||||
cur->next_ = NULL;
|
||||
del_item = &cur->item_;
|
||||
free_node(cur);
|
||||
ATOMIC_DEC(&count_);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// delete node which has common key
|
||||
int erase(const KEY &key)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ITEM *del_item = NULL;
|
||||
if (OB_FAIL(erase(key, del_item))) {
|
||||
COMMON_LOG(WARN, "failed to erase ndoe", K(ret), K(key));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int exist(const KEY &key)
|
||||
{
|
||||
ITEM *item = NULL;
|
||||
int ret = get(key, item);
|
||||
if (OB_SUCCESS == ret) {
|
||||
ret = OB_HASH_EXIST;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get(const KEY &key, GetFunctor &functor)
|
||||
{
|
||||
ITEM *item = NULL;
|
||||
return get(key, item, &functor);
|
||||
}
|
||||
|
||||
int get(const KEY &key, ITEM *&item, GetFunctor *functor = NULL)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
item = NULL;
|
||||
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
COMMON_LOG(WARN, "not inited", K(ret));
|
||||
} else {
|
||||
const uint64_t bucket_pos = NODE::hash(key) % buckets_count_;
|
||||
ObBucketRLockGuard bucket_guard(buckets_lock_, bucket_pos);
|
||||
NODE *cur = buckets_[bucket_pos];
|
||||
while (NULL != cur) {
|
||||
if (cur->equals(key)) {
|
||||
break;
|
||||
} else {
|
||||
cur = cur->next_;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == cur) {
|
||||
ret = OB_HASH_NOT_EXIST;
|
||||
} else if (NULL != functor && OB_FAIL((*functor)(cur->item_))) {
|
||||
COMMON_LOG(WARN, "failed to do get functor", K(ret), K(*cur));
|
||||
} else {
|
||||
item = &cur->item_;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int foreach(ForeachFunctor &functor)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_full = false;
|
||||
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
COMMON_LOG(WARN, "not inited", K(ret));
|
||||
} else {
|
||||
for (uint64_t bucket_pos = 0; OB_SUCC(ret) && !is_full && bucket_pos < buckets_count_; ++bucket_pos) {
|
||||
ObBucketRLockGuard bucket_guard(buckets_lock_, bucket_pos);
|
||||
NODE *cur = buckets_[bucket_pos];
|
||||
while (OB_SUCC(ret) && NULL != cur && !is_full) {
|
||||
if (OB_FAIL(functor(cur->item_, is_full))) {
|
||||
COMMON_LOG(WARN, "failed to do foreach functor", K(ret));
|
||||
} else {
|
||||
cur = cur->next_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private:
|
||||
bool is_inited_;
|
||||
mutable common::ObBucketLock buckets_lock_;
|
||||
uint64_t count_;
|
||||
NODE **buckets_;
|
||||
uint64_t buckets_count_;
|
||||
SimpleAllocer<NODE> allocator_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObPreAllocLinkHashMap);
|
||||
};
|
||||
|
||||
|
||||
} // hash
|
||||
} // common
|
||||
} // oceanbase
|
||||
#endif /* SRC_LIBRARY_SRC_LIB_HASH_OB_MEMLESS_LINK_HASHMAP_H_ */
|
14
deps/oblib/src/lib/json_type/ob_json_base.cpp
vendored
14
deps/oblib/src/lib/json_type/ob_json_base.cpp
vendored
@ -63,8 +63,6 @@ int ObIJsonBase::add_if_missing(ObJsonBaseSortedVector &dup, ObJsonBaseVector &r
|
||||
if (OB_FAIL(res.push_back(this))) {
|
||||
LOG_WARN("fail to push_back value into result", K(ret), K(res.size()));
|
||||
}
|
||||
} else if (ret == OB_CONFLICT_VALUE) {
|
||||
ret = OB_SUCCESS; // confilict means found duplicated nodes, it is not an error.
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -239,9 +237,7 @@ int ObIJsonBase::find_child(const JsonPathIterator &cur_node, const JsonPathIter
|
||||
// If the path expression is already at the end, the current DOM is the res,
|
||||
// and it is added to the res
|
||||
if (cur_node == last_node) {
|
||||
if (OB_FAIL(add_if_missing(dup, res))) {
|
||||
LOG_WARN("fail to add node.", K(ret));
|
||||
}
|
||||
add_if_missing(dup, res);
|
||||
} else {
|
||||
ObJsonPathBasicNode *path_node = static_cast<ObJsonPathBasicNode *>(*cur_node);
|
||||
SMART_VAR (JsonPathIterator, next_node) {
|
||||
@ -1940,7 +1936,7 @@ int ObIJsonBase::to_number(ObIAllocator *allocator, number::ObNumber &number) co
|
||||
int ObIJsonBase::to_datetime(int64_t &value) const
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
int64_t datetime = 0;
|
||||
int64_t datetime;
|
||||
|
||||
switch (json_type()) {
|
||||
case ObJsonNodeType::J_DATETIME:
|
||||
@ -1989,7 +1985,7 @@ int ObIJsonBase::to_datetime(int64_t &value) const
|
||||
int ObIJsonBase::to_date(int32_t &value) const
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
int32_t date = 0;
|
||||
int32_t date;
|
||||
|
||||
switch (json_type()) {
|
||||
case ObJsonNodeType::J_DATETIME:
|
||||
@ -2036,7 +2032,7 @@ int ObIJsonBase::to_date(int32_t &value) const
|
||||
int ObIJsonBase::to_time(int64_t &value) const
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
int64_t time = 0;
|
||||
int64_t time;
|
||||
|
||||
switch (json_type()) {
|
||||
case ObJsonNodeType::J_TIME: {
|
||||
@ -2081,7 +2077,7 @@ int ObIJsonBase::to_time(int64_t &value) const
|
||||
int ObIJsonBase::to_bit(uint64_t &value) const
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
uint64_t bit = 0;
|
||||
uint64_t bit;
|
||||
const ObJsonNodeType j_type = json_type();
|
||||
ObDTMode dt_mode = 0;
|
||||
|
||||
|
21
deps/oblib/src/lib/json_type/ob_json_bin.cpp
vendored
21
deps/oblib/src/lib/json_type/ob_json_bin.cpp
vendored
@ -1322,16 +1322,11 @@ int ObJsonBin::deserialize_json_object_v0(const char *data, uint64_t length, ObJ
|
||||
} else {
|
||||
// TODO if with key dict, read key from dict
|
||||
// to consider, add option to controll need alloc or not
|
||||
void *key_buf = nullptr;
|
||||
if (key_len > 0) {
|
||||
key_buf = allocator_->alloc(key_len);
|
||||
if (key_buf == NULL) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("fail to alloc memory for data buf", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
void *key_buf = allocator_->alloc(key_len);
|
||||
if (key_buf == NULL) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("fail to alloc memory for data buf", K(ret));
|
||||
} else {
|
||||
MEMCPY(key_buf, data + key_offset, key_len);
|
||||
ObString key(key_len, reinterpret_cast<const char*>(key_buf));
|
||||
const char *val = data + value_offset;
|
||||
@ -2403,7 +2398,7 @@ int ObJsonBin::rebuild_with_meta(const char *data, uint64_t length, ObJsonBuffer
|
||||
old_val_entry += key_entry_size * count;
|
||||
}
|
||||
|
||||
uint64_t new_val_entry_offset = 0;
|
||||
uint64_t new_val_entry_offset;
|
||||
if (OB_FAIL(result.append(reinterpret_cast<const char*>(&new_header), OB_JSON_BIN_HEADER_LEN))) {
|
||||
LOG_WARN("failed to append header", K(ret));
|
||||
} else if (OB_FAIL(ObJsonVar::append_var(count, new_header.count_size_, result))) {
|
||||
@ -2845,7 +2840,7 @@ int ObJsonBin::insert_internal_v0(ObJBNodeMeta& meta, int64_t pos, const ObStrin
|
||||
meta_len += key_entry_size * count;
|
||||
}
|
||||
|
||||
uint64_t new_val_entry_offset = 0;
|
||||
uint64_t new_val_entry_offset;
|
||||
if (OB_FAIL(result.reserve(meta.obj_size_))) {
|
||||
LOG_WARN("failed to reserve mem", K(ret), K(meta.obj_size_));
|
||||
} else if (OB_FAIL(result.append(reinterpret_cast<const char*>(&new_header), OB_JSON_BIN_HEADER_LEN))) {
|
||||
@ -3305,7 +3300,7 @@ int ObJsonBin::remove_v0(size_t index)
|
||||
ObJsonNodeType node_type = this->json_type();
|
||||
ObJBVerType ver_type = this->get_vertype();
|
||||
// 1. move into element index, get used bytes
|
||||
uint64_t used_bytes = 0;
|
||||
uint64_t used_bytes;
|
||||
if (OB_FAIL(this->element(index))) {
|
||||
LOG_WARN("failed to get element ", K(index), K(ret));
|
||||
} else {
|
||||
|
@ -1049,7 +1049,7 @@ int ObJsonPath::parse_name_with_rapidjson(char*& str, uint64_t& len)
|
||||
ObJsonString *val = static_cast<ObJsonString *>(dom);
|
||||
len = val->value().length();
|
||||
str = static_cast<char*> (allocator_->alloc(len));
|
||||
if (len > 0 && OB_ISNULL(str)) {
|
||||
if (OB_ISNULL(str)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("fail to allocate memory for member_name.",
|
||||
K(ret), K(len), K(val->value()));
|
||||
|
@ -628,6 +628,9 @@ int ObJsonObject::add(const common::ObString &key, ObJsonNode *value)
|
||||
if (OB_ISNULL(value)) { // check param
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("param value is NULL", K(ret));
|
||||
} else if (key.empty()) {
|
||||
ret = OB_ERR_JSON_DOCUMENT_NULL_KEY;
|
||||
LOG_WARN("key is NULL", K(ret));
|
||||
} else {
|
||||
value->set_parent(this);
|
||||
ObJsonObjectPair pair(key, value);
|
||||
|
4
deps/oblib/src/lib/lock/cond.h
vendored
4
deps/oblib/src/lib/lock/cond.h
vendored
@ -18,8 +18,8 @@
|
||||
namespace obutil
|
||||
{
|
||||
template<class T> class ObMonitor;
|
||||
class ObUtilMutex;
|
||||
typedef ObUtilMutex Mutex;
|
||||
class Mutex;
|
||||
|
||||
class Cond
|
||||
{
|
||||
public:
|
||||
|
66
deps/oblib/src/lib/lock/mutex.cpp
vendored
66
deps/oblib/src/lib/lock/mutex.cpp
vendored
@ -14,7 +14,7 @@
|
||||
#include "lib/oblog/ob_log.h"
|
||||
namespace obutil
|
||||
{
|
||||
ObUtilMutex::ObUtilMutex()
|
||||
Mutex::Mutex()
|
||||
{
|
||||
const int rt = pthread_mutex_init(&_mutex, NULL);
|
||||
#ifdef _NO_EXCEPTION
|
||||
@ -29,7 +29,7 @@ ObUtilMutex::ObUtilMutex()
|
||||
#endif
|
||||
}
|
||||
|
||||
ObUtilMutex::~ObUtilMutex()
|
||||
Mutex::~Mutex()
|
||||
{
|
||||
const int rt = pthread_mutex_destroy(&_mutex);
|
||||
assert(rt == 0);
|
||||
@ -38,7 +38,30 @@ ObUtilMutex::~ObUtilMutex()
|
||||
}
|
||||
}
|
||||
|
||||
bool ObUtilMutex::trylock() const
|
||||
void Mutex::lock() const
|
||||
{
|
||||
const int rt = pthread_mutex_lock(&_mutex);
|
||||
#ifdef _NO_EXCEPTION
|
||||
assert( rt == 0 );
|
||||
if ( rt != 0 ) {
|
||||
if ( rt == EDEADLK ) {
|
||||
_OB_LOG(ERROR,"%s","ThreadLockedException ");
|
||||
} else {
|
||||
_OB_LOG(ERROR,"%s","ThreadSyscallException");
|
||||
}
|
||||
}
|
||||
#else
|
||||
if( rt != 0 ) {
|
||||
if(rt == EDEADLK) {
|
||||
throw ThreadLockedException(__FILE__, __LINE__);
|
||||
} else {
|
||||
throw ThreadSyscallException(__FILE__, __LINE__, rt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Mutex::trylock() const
|
||||
{
|
||||
const int rt = pthread_mutex_trylock(&_mutex);
|
||||
#ifdef _NO_EXCEPTION
|
||||
@ -62,34 +85,7 @@ bool ObUtilMutex::trylock() const
|
||||
return (rt == 0);
|
||||
}
|
||||
|
||||
void ObUtilMutex::lock() const
|
||||
{
|
||||
const int rt = pthread_mutex_lock(&_mutex);
|
||||
#ifdef _NO_EXCEPTION
|
||||
assert( rt == 0 );
|
||||
if ( rt != 0 ) {
|
||||
if ( rt == EDEADLK ) {
|
||||
_OB_LOG(ERROR,"%s","ThreadLockedException ");
|
||||
} else {
|
||||
_OB_LOG(ERROR,"%s","ThreadSyscallException");
|
||||
}
|
||||
}
|
||||
#else
|
||||
if( rt != 0 ) {
|
||||
if(rt == EDEADLK) {
|
||||
throw ThreadLockedException(__FILE__, __LINE__);
|
||||
} else {
|
||||
throw ThreadSyscallException(__FILE__, __LINE__, rt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObUtilMutex::lock(LockState&) const
|
||||
{
|
||||
}
|
||||
|
||||
void ObUtilMutex::unlock() const
|
||||
void Mutex::unlock() const
|
||||
{
|
||||
const int rt = pthread_mutex_unlock(&_mutex);
|
||||
#ifdef _NO_EXCEPTION
|
||||
@ -104,12 +100,16 @@ void ObUtilMutex::unlock() const
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObUtilMutex::unlock(LockState& state) const
|
||||
void Mutex::unlock(LockState& state) const
|
||||
{
|
||||
state.mutex = &_mutex;
|
||||
}
|
||||
|
||||
bool ObUtilMutex::will_unlock() const
|
||||
void Mutex::lock(LockState&) const
|
||||
{
|
||||
}
|
||||
|
||||
bool Mutex::will_unlock() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
15
deps/oblib/src/lib/lock/mutex.h
vendored
15
deps/oblib/src/lib/lock/mutex.h
vendored
@ -18,15 +18,15 @@
|
||||
|
||||
namespace obutil
|
||||
{
|
||||
class ObUtilMutex
|
||||
class Mutex
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ObLockT<ObUtilMutex> Lock;
|
||||
typedef ObTryLockT<ObUtilMutex> TryLock;
|
||||
typedef ObLockT<Mutex> Lock;
|
||||
typedef ObTryLockT<Mutex> TryLock;
|
||||
|
||||
ObUtilMutex();
|
||||
~ObUtilMutex();
|
||||
Mutex();
|
||||
~Mutex();
|
||||
|
||||
void lock() const;
|
||||
bool trylock() const;
|
||||
@ -35,8 +35,8 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
ObUtilMutex(const ObUtilMutex&);
|
||||
ObUtilMutex& operator=(const ObUtilMutex&);
|
||||
Mutex(const Mutex&);
|
||||
Mutex& operator=(const Mutex&);
|
||||
|
||||
struct LockState
|
||||
{
|
||||
@ -49,6 +49,5 @@ private:
|
||||
|
||||
friend class Cond;
|
||||
};
|
||||
typedef ObUtilMutex Mutex;
|
||||
}//end namespace
|
||||
#endif
|
||||
|
12
deps/oblib/src/lib/lock/ob_bucket_lock.cpp
vendored
12
deps/oblib/src/lib/lock/ob_bucket_lock.cpp
vendored
@ -119,7 +119,7 @@ int ObBucketLock::try_wrlock(const uint64_t bucket_idx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObBucketLock::rdlock(const uint64_t bucket_idx, const int64_t abs_timeout_us)
|
||||
int ObBucketLock::rdlock(const uint64_t bucket_idx)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
@ -128,13 +128,13 @@ int ObBucketLock::rdlock(const uint64_t bucket_idx, const int64_t abs_timeout_us
|
||||
} else if(OB_UNLIKELY(bucket_idx >= bucket_cnt_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
COMMON_LOG(WARN, "Invalid argument, ", K(bucket_idx), K_(bucket_cnt), K(ret));
|
||||
} else if (OB_FAIL(latches_[bucket_to_latch_idx(bucket_idx)].rdlock(latch_id_, abs_timeout_us))) {
|
||||
COMMON_LOG(WARN, "Fail to read lock latch, ", K(bucket_idx), K_(latch_id), K(abs_timeout_us), K(ret));
|
||||
} else if (OB_FAIL(latches_[bucket_to_latch_idx(bucket_idx)].rdlock(latch_id_))) {
|
||||
COMMON_LOG(WARN, "Fail to read lock latch, ", K(bucket_idx), K_(latch_id), K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObBucketLock::wrlock(const uint64_t bucket_idx, const int64_t abs_timeout_us)
|
||||
int ObBucketLock::wrlock(const uint64_t bucket_idx)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
@ -143,8 +143,8 @@ int ObBucketLock::wrlock(const uint64_t bucket_idx, const int64_t abs_timeout_us
|
||||
} else if(OB_UNLIKELY(bucket_idx >= bucket_cnt_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
COMMON_LOG(ERROR, "Invalid argument, ", K(bucket_idx), K_(bucket_cnt), K(ret));
|
||||
} else if (OB_FAIL(latches_[bucket_to_latch_idx(bucket_idx)].wrlock(latch_id_, abs_timeout_us))) {
|
||||
COMMON_LOG(WARN, "Fail to write lock latch, ", K(bucket_idx), K_(latch_id), K(abs_timeout_us), K(ret));
|
||||
} else if (OB_FAIL(latches_[bucket_to_latch_idx(bucket_idx)].wrlock(latch_id_))) {
|
||||
COMMON_LOG(WARN, "Fail to write lock latch, ", K(bucket_idx), K_(latch_id), K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
20
deps/oblib/src/lib/lock/ob_bucket_lock.h
vendored
20
deps/oblib/src/lib/lock/ob_bucket_lock.h
vendored
@ -34,8 +34,8 @@ public:
|
||||
void destroy();
|
||||
int try_rdlock(const uint64_t bucket_idx);
|
||||
int try_wrlock(const uint64_t bucket_idx);
|
||||
int rdlock(const uint64_t bucket_idx, const int64_t abs_timeout_us = INT64_MAX);
|
||||
int wrlock(const uint64_t bucket_idx, const int64_t abs_timeout_us = INT64_MAX);
|
||||
int rdlock(const uint64_t bucket_idx);
|
||||
int wrlock(const uint64_t bucket_idx);
|
||||
int unlock(const uint64_t bucket_idx);
|
||||
int try_wrlock_all();
|
||||
int try_rdlock_all();
|
||||
@ -68,7 +68,7 @@ private:
|
||||
class ObBucketRLockGuard final
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObBucketRLockGuard(ObBucketLock &lock, const uint64_t bucket_index)
|
||||
ObBucketRLockGuard(ObBucketLock &lock, const uint64_t bucket_index)
|
||||
: lock_(lock),
|
||||
index_(bucket_index),
|
||||
ret_(OB_SUCCESS),
|
||||
@ -109,7 +109,7 @@ private:
|
||||
class ObBucketWLockGuard final
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObBucketWLockGuard(ObBucketLock &lock, const uint64_t bucket_index)
|
||||
ObBucketWLockGuard(ObBucketLock &lock, const uint64_t bucket_index)
|
||||
: lock_(lock),
|
||||
index_(bucket_index),
|
||||
ret_(OB_SUCCESS),
|
||||
@ -150,7 +150,7 @@ private:
|
||||
class ObBucketWLockAllGuard final
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObBucketWLockAllGuard(ObBucketLock &lock)
|
||||
ObBucketWLockAllGuard(ObBucketLock &lock)
|
||||
: lock_(lock),
|
||||
ret_(OB_SUCCESS),
|
||||
lock_start_ts_(0)
|
||||
@ -189,7 +189,7 @@ private:
|
||||
class ObBucketTryWLockAllGuard final
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObBucketTryWLockAllGuard(ObBucketLock &lock)
|
||||
ObBucketTryWLockAllGuard(ObBucketLock &lock)
|
||||
: lock_(lock),
|
||||
ret_(OB_SUCCESS),
|
||||
lock_start_ts_(0)
|
||||
@ -234,7 +234,7 @@ private:
|
||||
class ObBucketTryRLockAllGuard final
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObBucketTryRLockAllGuard(ObBucketLock &lock)
|
||||
ObBucketTryRLockAllGuard(ObBucketLock &lock)
|
||||
: lock_(lock),
|
||||
ret_(OB_SUCCESS),
|
||||
lock_start_ts_(0)
|
||||
@ -279,7 +279,7 @@ private:
|
||||
class ObMultiBucketLockGuard final
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObMultiBucketLockGuard(ObBucketLock &lock, const bool is_write_lock);
|
||||
ObMultiBucketLockGuard(ObBucketLock &lock, const bool is_write_lock);
|
||||
~ObMultiBucketLockGuard();
|
||||
int lock_multi_buckets(ObIArray<uint64_t> &hash_array);
|
||||
private:
|
||||
@ -293,7 +293,7 @@ private:
|
||||
class ObBucketHashRLockGuard final
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObBucketHashRLockGuard(ObBucketLock &lock, const uint64_t hash_value)
|
||||
ObBucketHashRLockGuard(ObBucketLock &lock, const uint64_t hash_value)
|
||||
: guard_(lock, lock.get_bucket_idx(hash_value))
|
||||
{
|
||||
}
|
||||
@ -307,7 +307,7 @@ private:
|
||||
class ObBucketHashWLockGuard final
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObBucketHashWLockGuard(ObBucketLock &lock, const uint64_t hash_value)
|
||||
ObBucketHashWLockGuard(ObBucketLock &lock, const uint64_t hash_value)
|
||||
: guard_(lock, lock.get_bucket_idx(hash_value))
|
||||
{
|
||||
}
|
||||
|
4
deps/oblib/src/lib/lock/ob_drw_lock.h
vendored
4
deps/oblib/src/lib/lock/ob_drw_lock.h
vendored
@ -34,7 +34,7 @@ public:
|
||||
class RDLockGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] explicit RDLockGuard(DRWLock &rwlock): rwlock_(rwlock), ret_(OB_SUCCESS)
|
||||
explicit RDLockGuard(DRWLock &rwlock): rwlock_(rwlock), ret_(OB_SUCCESS)
|
||||
{
|
||||
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = rwlock_.rdlock()))) {
|
||||
COMMON_LOG(WARN, "Fail to read lock, ", K_(ret));
|
||||
@ -58,7 +58,7 @@ public:
|
||||
class WRLockGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] explicit WRLockGuard(DRWLock &rwlock): rwlock_(rwlock), ret_(OB_SUCCESS)
|
||||
explicit WRLockGuard(DRWLock &rwlock): rwlock_(rwlock), ret_(OB_SUCCESS)
|
||||
{
|
||||
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = rwlock_.wrlock()))) {
|
||||
COMMON_LOG(WARN, "Fail to write lock, ", K_(ret));
|
||||
|
6
deps/oblib/src/lib/lock/ob_latch.h
vendored
6
deps/oblib/src/lib/lock/ob_latch.h
vendored
@ -364,7 +364,7 @@ private:
|
||||
class ObLatchMutexGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObLatchMutexGuard(ObLatchMutex &lock, const uint32_t latch_id)
|
||||
ObLatchMutexGuard(ObLatchMutex &lock, const uint32_t latch_id)
|
||||
: lock_(lock), ret_(OB_SUCCESS)
|
||||
{
|
||||
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.lock(latch_id)))) {
|
||||
@ -390,7 +390,7 @@ private:
|
||||
class ObLatchRGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObLatchRGuard(ObLatch &lock, const uint32_t latch_id)
|
||||
ObLatchRGuard(ObLatch &lock, const uint32_t latch_id)
|
||||
: lock_(lock),
|
||||
ret_(OB_SUCCESS)
|
||||
{
|
||||
@ -418,7 +418,7 @@ private:
|
||||
class ObLatchWGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObLatchWGuard(ObLatch &lock, const uint32_t latch_id)
|
||||
ObLatchWGuard(ObLatch &lock, const uint32_t latch_id)
|
||||
: lock_(lock),
|
||||
ret_(OB_SUCCESS)
|
||||
{
|
||||
|
2
deps/oblib/src/lib/lock/ob_lock_guard.h
vendored
2
deps/oblib/src/lib/lock/ob_lock_guard.h
vendored
@ -25,7 +25,7 @@ template <typename LockT>
|
||||
class ObLockGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] explicit ObLockGuard(LockT &lock);
|
||||
explicit ObLockGuard(LockT &lock);
|
||||
~ObLockGuard();
|
||||
inline int get_ret() const { return ret_; }
|
||||
private:
|
||||
|
6
deps/oblib/src/lib/lock/ob_rwlock.h
vendored
6
deps/oblib/src/lib/lock/ob_rwlock.h
vendored
@ -23,7 +23,7 @@ template <class T>
|
||||
class ObLockGuardBase
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObLockGuardBase(const T& lock, bool block = true) : lock_(lock)
|
||||
ObLockGuardBase(const T& lock, bool block = true) : lock_(lock)
|
||||
{
|
||||
acquired_ = !(block ? lock_.lock() : lock_.trylock());
|
||||
}
|
||||
@ -87,7 +87,7 @@ private:
|
||||
class ObRLockGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObRLockGuard(const ObRWLock& rwlock, bool block = true) : guard_((*rwlock.rlock()), block) {}
|
||||
ObRLockGuard(const ObRWLock& rwlock, bool block = true) : guard_((*rwlock.rlock()), block) {}
|
||||
~ObRLockGuard(){}
|
||||
bool acquired() { return guard_.acquired(); }
|
||||
private:
|
||||
@ -97,7 +97,7 @@ private:
|
||||
class ObWLockGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ObWLockGuard(const ObRWLock& rwlock, bool block = true) : guard_((*rwlock.wlock()), block) {}
|
||||
ObWLockGuard(const ObRWLock& rwlock, bool block = true) : guard_((*rwlock.wlock()), block) {}
|
||||
~ObWLockGuard(){}
|
||||
bool acquired() { return guard_.acquired(); }
|
||||
private:
|
||||
|
7
deps/oblib/src/lib/lock/ob_spin_rwlock.h
vendored
7
deps/oblib/src/lib/lock/ob_spin_rwlock.h
vendored
@ -19,7 +19,6 @@
|
||||
#include "lib/ob_define.h"
|
||||
#include "lib/stat/ob_latch_define.h"
|
||||
#include "lib/lock/ob_latch.h"
|
||||
#include "lib/alloc/alloc_struct.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -35,12 +34,6 @@ public:
|
||||
~SpinRWLock()
|
||||
{
|
||||
}
|
||||
int init(const lib::ObMemAttr &mem_attr)
|
||||
{
|
||||
UNUSED(mem_attr);
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
void destroy() {}
|
||||
public:
|
||||
void set_latch_id(const uint32_t latch_id) { latch_id_ = latch_id; }
|
||||
inline bool try_rdlock() { return OB_SUCCESS == latch_.try_rdlock(latch_id_); }
|
||||
|
26
deps/oblib/src/lib/lock/ob_tc_rwlock.h
vendored
26
deps/oblib/src/lib/lock/ob_tc_rwlock.h
vendored
@ -54,13 +54,13 @@ public:
|
||||
enum { WRITE_MASK = 1<<31 };
|
||||
struct RLockGuard
|
||||
{
|
||||
[[nodiscard]] explicit RLockGuard(TCRWLock& lock): lock_(lock) { lock_.rdlock(); }
|
||||
explicit RLockGuard(TCRWLock& lock): lock_(lock) { lock_.rdlock(); }
|
||||
~RLockGuard() { lock_.rdunlock(); }
|
||||
TCRWLock& lock_;
|
||||
};
|
||||
struct RLockGuardWithTimeout
|
||||
{
|
||||
[[nodiscard]] explicit RLockGuardWithTimeout(TCRWLock &lock, const int64_t abs_timeout_us, int &ret): lock_(lock), need_unlock_(true)
|
||||
explicit RLockGuardWithTimeout(TCRWLock &lock, const int64_t abs_timeout_us, int &ret): lock_(lock), need_unlock_(true)
|
||||
{
|
||||
if (OB_FAIL(lock_.rdlock(abs_timeout_us))) {
|
||||
need_unlock_ = false;
|
||||
@ -80,13 +80,13 @@ public:
|
||||
};
|
||||
struct WLockGuard
|
||||
{
|
||||
[[nodiscard]] explicit WLockGuard(TCRWLock& lock): lock_(lock) { lock_.wrlock(); }
|
||||
explicit WLockGuard(TCRWLock& lock): lock_(lock) { lock_.wrlock(); }
|
||||
~WLockGuard() { lock_.wrunlock(); }
|
||||
TCRWLock& lock_;
|
||||
};
|
||||
struct WLockGuardWithTimeout
|
||||
{
|
||||
[[nodiscard]] explicit WLockGuardWithTimeout(TCRWLock &lock, const int64_t abs_timeout_us, int &ret): lock_(lock), need_unlock_(true)
|
||||
explicit WLockGuardWithTimeout(TCRWLock &lock, const int64_t abs_timeout_us, int &ret): lock_(lock), need_unlock_(true)
|
||||
{
|
||||
if (OB_FAIL(lock_.wrlock(abs_timeout_us))) {
|
||||
need_unlock_ = false;
|
||||
@ -106,7 +106,7 @@ public:
|
||||
};
|
||||
struct WLockGuardWithRetry
|
||||
{
|
||||
[[nodiscard]] explicit WLockGuardWithRetry(TCRWLock &lock, const int64_t abs_timeout_us) : lock_(lock)
|
||||
explicit WLockGuardWithRetry(TCRWLock &lock, const int64_t abs_timeout_us) : lock_(lock)
|
||||
{
|
||||
lock_.wrlock_with_retry(abs_timeout_us);
|
||||
}
|
||||
@ -115,7 +115,7 @@ public:
|
||||
};
|
||||
struct WLockGuardWithRetryInterval
|
||||
{
|
||||
[[nodiscard]] explicit WLockGuardWithRetryInterval(TCRWLock &lock,
|
||||
explicit WLockGuardWithRetryInterval(TCRWLock &lock,
|
||||
const int64_t try_thresold_us,
|
||||
const int64_t retry_interval_us)
|
||||
: lock_(lock)
|
||||
@ -287,7 +287,7 @@ private:
|
||||
class TCWLockGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] explicit TCWLockGuard(const TCRWLock &lock)
|
||||
explicit TCWLockGuard(const TCRWLock &lock)
|
||||
: lock_(const_cast<TCRWLock&>(lock)), ret_(OB_SUCCESS)
|
||||
{
|
||||
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.wrlock()))) {
|
||||
@ -313,7 +313,7 @@ private:
|
||||
class TCRLockGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] explicit TCRLockGuard(const TCRWLock &lock)
|
||||
explicit TCRLockGuard(const TCRWLock &lock)
|
||||
: lock_(const_cast<TCRWLock&>(lock)), ret_(OB_SUCCESS), slot_id_(0)
|
||||
{
|
||||
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.rdlock(INT64_MAX, slot_id_)))) {
|
||||
@ -342,7 +342,7 @@ typedef TCRWLock RWLock;
|
||||
class RWLock
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] struct RLockGuard
|
||||
struct RLockGuard
|
||||
{
|
||||
explicit RLockGuard(RWLock& lock): lock_(lock) { lock_.rdlock(); }
|
||||
~RLockGuard() { lock_.rdunlock(); }
|
||||
@ -350,7 +350,7 @@ public:
|
||||
};
|
||||
struct RLockGuardWithTimeout
|
||||
{
|
||||
[[nodiscard]] explicit RLockGuardWithTimeout(RWLock &lock, const int64_t abs_timeout_us, int &ret): lock_(lock), need_unlock_(true)
|
||||
explicit RLockGuardWithTimeout(RWLock &lock, const int64_t abs_timeout_us, int &ret): lock_(lock), need_unlock_(true)
|
||||
{
|
||||
if (OB_FAIL(lock_.rdlock(abs_timeout_us))) {
|
||||
need_unlock_ = false;
|
||||
@ -371,13 +371,13 @@ public:
|
||||
|
||||
struct WLockGuard
|
||||
{
|
||||
[[nodiscard]] explicit WLockGuard(RWLock& lock): lock_(lock) { lock_.wrlock(); }
|
||||
explicit WLockGuard(RWLock& lock): lock_(lock) { lock_.wrlock(); }
|
||||
~WLockGuard() { lock_.wrunlock(); }
|
||||
RWLock& lock_;
|
||||
};
|
||||
struct WLockGuardWithTimeout
|
||||
{
|
||||
[[nodiscard]] explicit WLockGuardWithTimeout(RWLock &lock, const int64_t abs_timeout_us, int &ret): lock_(lock), need_unlock_(true)
|
||||
explicit WLockGuardWithTimeout(RWLock &lock, const int64_t abs_timeout_us, int &ret): lock_(lock), need_unlock_(true)
|
||||
{
|
||||
if (OB_FAIL(lock_.wrlock(abs_timeout_us))) {
|
||||
need_unlock_ = false;
|
||||
@ -397,7 +397,7 @@ public:
|
||||
};
|
||||
struct WLockGuardWithRetry
|
||||
{
|
||||
[[nodiscard]] explicit WLockGuardWithRetry(RWLock &lock, const int64_t abs_timeout_us) : lock_(lock)
|
||||
explicit WLockGuardWithRetry(RWLock &lock, const int64_t abs_timeout_us) : lock_(lock)
|
||||
{
|
||||
lock_.wrlock_with_retry(abs_timeout_us);
|
||||
}
|
||||
|
2
deps/oblib/src/lib/lock/threadmutex.h
vendored
2
deps/oblib/src/lib/lock/threadmutex.h
vendored
@ -52,7 +52,7 @@ protected:
|
||||
class ThreadGuard
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] ThreadGuard(ThreadMutex *mutex)
|
||||
ThreadGuard(ThreadMutex *mutex)
|
||||
{
|
||||
mutex_ = NULL;
|
||||
if (mutex) {
|
||||
|
@ -27,6 +27,7 @@ class MySQLResultWrapper
|
||||
{
|
||||
public:
|
||||
//see this for template virtual function
|
||||
//http://cxh.me/2014/07/01/nvi-usage-of-virtual-template/
|
||||
DEFINE_ALLOCATOR_WRAPPER
|
||||
MySQLResultWrapper() {}
|
||||
virtual ~MySQLResultWrapper() {}
|
||||
|
@ -66,7 +66,6 @@ public:
|
||||
}
|
||||
|
||||
virtual sqlclient::ObISQLConnectionPool *get_pool() = 0;
|
||||
virtual sqlclient::ObISQLConnection *get_connection() = 0;
|
||||
|
||||
virtual bool is_oracle_mode() const = 0;
|
||||
|
||||
|
@ -86,8 +86,6 @@ public:
|
||||
bool is_from_pl = false) = 0;
|
||||
virtual int execute_write(const uint64_t tenant_id, const char *sql,
|
||||
int64_t &affected_rows, bool is_user_sql = false) = 0;
|
||||
virtual int execute_write(const uint64_t tenant_id, const ObString &sql,
|
||||
int64_t &affected_rows, bool is_user_sql = false) = 0;
|
||||
|
||||
// transaction interface
|
||||
virtual int start_transaction(const uint64_t &tenant_id, bool with_snap_shot = false) = 0;
|
||||
|
@ -118,6 +118,7 @@ int ObMySQLConnection::connect(const char *user, const char *pass, const char *d
|
||||
const static int MAX_IP_BUFFER_LEN = 32;
|
||||
char host[MAX_IP_BUFFER_LEN];
|
||||
host[0] = '\0';
|
||||
// https://baike.baidu.com/item/mysql_real_connect/4007597
|
||||
// if db is NULL, the default database is used.
|
||||
if (OB_ISNULL(user) || OB_ISNULL(pass) /*|| OB_ISNULL(db)*/) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
@ -371,13 +372,6 @@ int ObMySQLConnection::switch_tenant(const uint64_t tenant_id)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObMySQLConnection::execute_write(const uint64_t tenant_id, const ObString &sql,
|
||||
int64_t &affected_rows, bool is_user_sql)
|
||||
{
|
||||
UNUSEDx(tenant_id, sql, affected_rows, is_user_sql);
|
||||
return OB_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int ObMySQLConnection::execute_write(const uint64_t tenant_id, const char *sql,
|
||||
int64_t &affected_rows, bool is_user_sql)
|
||||
{
|
||||
|
@ -72,8 +72,6 @@ public:
|
||||
virtual int execute_read(const int64_t cluster_id, const uint64_t tenant_id, const ObString &sql,
|
||||
ObISQLClient::ReadResult &res, bool is_user_sql = false,
|
||||
bool is_from_pl = false) override;
|
||||
virtual int execute_write(const uint64_t tenant_id, const ObString &sql,
|
||||
int64_t &affected_rows, bool is_user_sql = false) override;
|
||||
virtual int execute_write(const uint64_t tenant_id, const char *sql,
|
||||
int64_t &affected_rows, bool is_user_sql = false) override;
|
||||
|
||||
|
@ -161,9 +161,9 @@ int ObMySQLConnectionPool::set_db_param(const char *db_user, const char *db_pass
|
||||
} else if (OB_UNLIKELY(w_len <= 0) || OB_UNLIKELY(w_len > OB_MAX_USER_NAME_LENGTH)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("fill db user error", KCSTRING(db_user), K(ret));
|
||||
} else if (FALSE_IT(w_len = snprintf(db_pass_, OB_MAX_PASSWORD_BUF_LENGTH, "%s", db_pass))) {
|
||||
} else if (FALSE_IT(w_len = snprintf(db_pass_, OB_MAX_PASS_WORD_LENGTH, "%s", db_pass))) {
|
||||
// impossible
|
||||
} else if (OB_UNLIKELY(w_len < 0) || OB_UNLIKELY(w_len >= OB_MAX_PASSWORD_BUF_LENGTH)) {
|
||||
} else if (OB_UNLIKELY(w_len < 0) || OB_UNLIKELY(w_len >= OB_MAX_PASS_WORD_LENGTH)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("fill db password error", KCSTRING(db_pass), K(ret));
|
||||
} else if (FALSE_IT(w_len = snprintf(db_name_, OB_MAX_DATABASE_NAME_BUF_LENGTH, "%s", db_name))) {
|
||||
@ -180,7 +180,7 @@ int ObMySQLConnectionPool::set_db_param(const ObString &db_user, const ObString
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(db_user.length() > OB_MAX_USER_NAME_LENGTH)
|
||||
|| OB_UNLIKELY(db_pass.length() > OB_MAX_PASSWORD_LENGTH)
|
||||
|| OB_UNLIKELY(db_pass.length() > OB_MAX_PASS_WORD_LENGTH)
|
||||
|| OB_UNLIKELY(db_name.length() > OB_MAX_DATABASE_NAME_LENGTH)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("db param buffer is not enough", K(db_user), K(db_pass), K(db_name), K(ret));
|
||||
|
@ -207,6 +207,7 @@ private:
|
||||
int get_server_pool_(const ObAddr &addr, ObServerConnectionPool *&pool);
|
||||
int purge_tenant_server_pool_map_(const ObIArray<uint64_t> &tenant_array);
|
||||
protected:
|
||||
static const int64_t OB_MAX_PASS_WORD_LENGTH = 64;
|
||||
static const int MAX_SERVER_GONE_INTERVAL = 1000 * 1000 * 1; // 1 sec
|
||||
|
||||
bool is_updated_;
|
||||
@ -220,7 +221,7 @@ protected:
|
||||
volatile int64_t busy_conn_count_;
|
||||
|
||||
char db_user_[OB_MAX_USER_NAME_BUF_LENGTH];
|
||||
char db_pass_[OB_MAX_PASSWORD_BUF_LENGTH];
|
||||
char db_pass_[OB_MAX_PASS_WORD_LENGTH];
|
||||
char db_name_[OB_MAX_DATABASE_NAME_BUF_LENGTH];
|
||||
char init_sql_[OB_MAX_SQL_LENGTH];
|
||||
ObConnPoolConfigParam config_;
|
||||
|
@ -132,13 +132,13 @@ int ObMySQLPreparedResult::get_int(const int64_t col_idx, int64_t &int_val) cons
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_LIKELY(col_idx >= 0) && OB_LIKELY(col_idx < result_column_count_)) {
|
||||
// currently not support auto type convertion
|
||||
if (enum_field_types::MYSQL_TYPE_LONGLONG == bind_[col_idx].buffer_type) {
|
||||
if (MYSQL_TYPE_LONGLONG == bind_[col_idx].buffer_type) {
|
||||
int_val = *(reinterpret_cast<int64_t *>(bind_[col_idx].buffer));
|
||||
} else {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid type, forget to call bind_type_and_buf() first",
|
||||
"real type", bind_[col_idx].buffer_type,
|
||||
"expected type", enum_field_types::MYSQL_TYPE_LONGLONG, K(ret));
|
||||
"expected type", MYSQL_TYPE_LONGLONG, K(ret));
|
||||
}
|
||||
} else {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
@ -152,14 +152,14 @@ int ObMySQLPreparedResult::get_varchar(const int64_t col_idx, ObString &varchar_
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_LIKELY(col_idx >= 0) && OB_LIKELY(col_idx < result_column_count_)) {
|
||||
// currently not support auto type convertion
|
||||
if (enum_field_types::MYSQL_TYPE_VAR_STRING == bind_[col_idx].buffer_type) {
|
||||
if (MYSQL_TYPE_VAR_STRING == bind_[col_idx].buffer_type) {
|
||||
varchar_val.assign(static_cast<char *>(bind_[col_idx].buffer),
|
||||
static_cast<int32_t>(*bind_[col_idx].length));
|
||||
} else {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid type, forget to call bind_type_and_buf() first",
|
||||
"real type", bind_[col_idx].buffer_type,
|
||||
"expected type", enum_field_types::MYSQL_TYPE_VAR_STRING, K(ret));
|
||||
"expected type", MYSQL_TYPE_VAR_STRING, K(ret));
|
||||
}
|
||||
} else {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
|
@ -163,7 +163,7 @@ int ObMySQLPreparedStatement::bind_param_int(const int64_t col_idx, int64_t *in_
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
unsigned long res_len = 0;
|
||||
if (OB_FAIL(param_.bind_param(col_idx, enum_field_types::MYSQL_TYPE_LONGLONG,
|
||||
if (OB_FAIL(param_.bind_param(col_idx, MYSQL_TYPE_LONGLONG,
|
||||
reinterpret_cast<char *>(in_int_val), sizeof(int64_t), res_len))) {
|
||||
LOG_WARN("fail to bind int result", K(col_idx), K(ret));
|
||||
}
|
||||
@ -174,7 +174,7 @@ int ObMySQLPreparedStatement::bind_param_varchar(const int64_t col_idx, char *in
|
||||
unsigned long &in_str_len)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(param_.bind_param(col_idx, enum_field_types::MYSQL_TYPE_VAR_STRING,
|
||||
if (OB_FAIL(param_.bind_param(col_idx, MYSQL_TYPE_VAR_STRING,
|
||||
in_str_val, 0, in_str_len))) {
|
||||
LOG_WARN("fail to bind int result", K(col_idx), K(ret));
|
||||
}
|
||||
@ -185,7 +185,7 @@ int ObMySQLPreparedStatement::bind_result_int(const int64_t col_idx, int64_t *ou
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
unsigned long res_len = 0;
|
||||
if (OB_FAIL(result_.bind_result(col_idx, enum_field_types::MYSQL_TYPE_LONGLONG,
|
||||
if (OB_FAIL(result_.bind_result(col_idx, MYSQL_TYPE_LONGLONG,
|
||||
reinterpret_cast<char *>(out_buf), sizeof(int64_t), res_len))) {
|
||||
LOG_WARN("fail to bind int result", K(col_idx), K(ret));
|
||||
}
|
||||
@ -196,7 +196,7 @@ int ObMySQLPreparedStatement::bind_result_varchar(const int64_t col_idx, char *o
|
||||
unsigned long &res_len)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(result_.bind_result(col_idx,enum_field_types::MYSQL_TYPE_VAR_STRING,
|
||||
if (OB_FAIL(result_.bind_result(col_idx, MYSQL_TYPE_VAR_STRING,
|
||||
out_buf, buf_len, res_len))) {
|
||||
LOG_WARN("fail to bind int result", K(col_idx), K(ret));
|
||||
}
|
||||
|
@ -138,14 +138,14 @@ int ObCommonSqlProxy::write(const uint64_t tenant_id, const char *sql, int64_t &
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObCommonSqlProxy::write(const uint64_t tenant_id, const ObString sql,
|
||||
int ObCommonSqlProxy::write(const uint64_t tenant_id, const char *sql,
|
||||
int64_t &affected_rows, int64_t compatibility_mode, const ObSessionParam *param /* = nullptr*/)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_user_sql = false;
|
||||
int64_t start = ::oceanbase::common::ObTimeUtility::current_time();
|
||||
ObISQLConnection *conn = NULL;
|
||||
if (OB_UNLIKELY(sql.empty())) {
|
||||
if (OB_ISNULL(sql)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("empty sql");
|
||||
} else if (OB_FAIL(acquire(tenant_id, conn))) {
|
||||
@ -155,7 +155,7 @@ int ObCommonSqlProxy::write(const uint64_t tenant_id, const ObString sql,
|
||||
LOG_WARN("connection can not be NULL");
|
||||
} else if (!is_active()) { // check client active after connection acquired
|
||||
ret = OB_INACTIVE_SQL_CLIENT;
|
||||
LOG_WARN("in active sql client", K(ret), K(sql));
|
||||
LOG_WARN("in active sql client", K(ret), KCSTRING(sql));
|
||||
}
|
||||
int64_t old_compatibility_mode;
|
||||
int64_t old_sql_mode = 0;
|
||||
@ -203,7 +203,7 @@ int ObCommonSqlProxy::write(const uint64_t tenant_id, const ObString sql,
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(conn->execute_write(tenant_id, sql, affected_rows, is_user_sql))) {
|
||||
LOG_WARN("execute sql failed", K(ret), K(conn), K(start), K(sql));
|
||||
LOG_WARN("execute sql failed", K(ret), K(conn), K(start), KCSTRING(sql));
|
||||
} else if (old_compatibility_mode != compatibility_mode
|
||||
&& OB_FAIL(conn->set_session_variable("ob_compatibility_mode", old_compatibility_mode))) {
|
||||
LOG_WARN("fail to recover inner connection sql mode", K(ret));
|
||||
@ -220,7 +220,7 @@ int ObCommonSqlProxy::write(const uint64_t tenant_id, const ObString sql,
|
||||
}
|
||||
}
|
||||
close(conn, ret);
|
||||
LOG_TRACE("execute sql with sql mode", K(sql), K(compatibility_mode), K(ret));
|
||||
LOG_TRACE("execute sql with sql mode", KCSTRING(sql), K(compatibility_mode), K(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -109,13 +109,12 @@ public:
|
||||
using ObISQLClient::read;
|
||||
// execute update sql
|
||||
virtual int write(const uint64_t tenant_id, const char *sql, int64_t &affected_rows) override;
|
||||
int write(const uint64_t tenant_id, const ObString sql, int64_t &affected_rows, int64_t compatibility_mode,
|
||||
int write(const uint64_t tenant_id, const char *sql, int64_t &affected_rows, int64_t compatibility_mode,
|
||||
const ObSessionParam *session_param = nullptr);
|
||||
using ObISQLClient::write;
|
||||
|
||||
bool is_inited() const { return NULL != pool_; }
|
||||
virtual sqlclient::ObISQLConnectionPool *get_pool() override { return pool_; }
|
||||
virtual sqlclient::ObISQLConnection *get_connection() override { return NULL; }
|
||||
sqlclient::ObISQLConnectionPool *get_pool() override { return pool_; }
|
||||
|
||||
// can only use assign() to copy to prevent passing ObCommonSqlProxy by value unintentionally.
|
||||
void assign(const ObCommonSqlProxy &proxy) { *this = proxy; }
|
||||
|
23
deps/oblib/src/lib/mysqlclient/ob_mysql_result.h
vendored
23
deps/oblib/src/lib/mysqlclient/ob_mysql_result.h
vendored
@ -108,7 +108,7 @@
|
||||
{ \
|
||||
if (skip_null_error) \
|
||||
{ \
|
||||
SQL_LOG(TRACE, "null value, ignore", "column_name", #column_name); \
|
||||
SQL_LOG(INFO, "null value, ignore", "column_name", #column_name); \
|
||||
(obj).set_##column_name(default_value); \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
@ -152,7 +152,7 @@
|
||||
{ \
|
||||
if (skip_null_error) \
|
||||
{ \
|
||||
SQL_LOG(TRACE, "null value, ignore", K(column_name)); \
|
||||
SQL_LOG(INFO, "null value, ignore", K(column_name)); \
|
||||
field = static_cast<type>(default_value); \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
@ -298,7 +298,7 @@
|
||||
{ \
|
||||
if (skip_null_error) \
|
||||
{ \
|
||||
SQL_LOG(TRACE, "null value, ignore", "column_name", #column_name); \
|
||||
SQL_LOG(INFO, "null value, ignore", "column_name", #column_name); \
|
||||
(obj).set_##column_name(static_cast<type>(default_value)); \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
@ -361,7 +361,7 @@
|
||||
{ \
|
||||
if (skip_null_error) \
|
||||
{ \
|
||||
SQL_LOG(TRACE, "null value, ignore", "column_name", #column_name); \
|
||||
SQL_LOG(INFO, "null value, ignore", "column_name", #column_name); \
|
||||
(obj).set_##column_name(static_cast<type>(default_value)); \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
@ -452,7 +452,7 @@
|
||||
{ \
|
||||
if (skip_null_error) \
|
||||
{ \
|
||||
SQL_LOG(TRACE, "null value, ignore", "column_name", #column_name); \
|
||||
SQL_LOG(INFO, "null value, ignore", "column_name", #column_name); \
|
||||
(obj).set_##column_name(static_cast<type>(default_value)); \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
@ -651,7 +651,7 @@
|
||||
{ \
|
||||
if (skip_null_error) \
|
||||
{ \
|
||||
SQL_LOG(TRACE, "null value, ignore", "column_name", #column_name); \
|
||||
SQL_LOG(INFO, "null value, ignore", "column_name", #column_name); \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
else \
|
||||
@ -719,7 +719,7 @@
|
||||
{ \
|
||||
if (skip_null_error) \
|
||||
{ \
|
||||
SQL_LOG(TRACE, "null value, ignore", "column_name", #column_name); \
|
||||
SQL_LOG(INFO, "null value, ignore", "column_name", #column_name); \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
else \
|
||||
@ -834,7 +834,7 @@
|
||||
{ \
|
||||
if (skip_null_error) \
|
||||
{ \
|
||||
SQL_LOG(TRACE, "null value, ignore", "column_name", #column_name); \
|
||||
SQL_LOG(INFO, "null value, ignore", "column_name", #column_name); \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
else \
|
||||
@ -1061,7 +1061,7 @@
|
||||
if (OB_ERR_NULL_VALUE == ret \
|
||||
|| OB_SIZE_OVERFLOW == ret \
|
||||
|| OB_INVALID_ARGUMENT == ret) { \
|
||||
SQL_LOG(TRACE, "get column failed, so set default value", K(ret), "obj", #obj); \
|
||||
SQL_LOG(WARN, "get column failed, so set default value", K(ret), "obj", #obj); \
|
||||
ret = OB_SUCCESS; \
|
||||
obj = default_value; \
|
||||
} else { \
|
||||
@ -1146,7 +1146,7 @@
|
||||
{ \
|
||||
if (skip_null_error) \
|
||||
{ \
|
||||
SQL_LOG(TRACE, "null value, ignore", "column_name", #column_name); \
|
||||
SQL_LOG(INFO, "null value, ignore", "column_name", #column_name); \
|
||||
(obj).set_##column_name(static_cast<uint64_t>(default_value)); \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
@ -1187,7 +1187,7 @@
|
||||
{ \
|
||||
if (skip_null_error) \
|
||||
{ \
|
||||
SQL_LOG(TRACE, "null value, ignore", "column_name", #column_name); \
|
||||
SQL_LOG(INFO, "null value, ignore", "column_name", #column_name); \
|
||||
(obj).set_##column_name(static_cast<uint64_t>(default_value)); \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
@ -1258,6 +1258,7 @@ class ObMySQLResult
|
||||
{
|
||||
public:
|
||||
//see this for template virtual function
|
||||
//http://cxh.me/2014/07/01/nvi-usage-of-virtual-template/
|
||||
DEFINE_ALLOCATOR_WRAPPER
|
||||
ObMySQLResult();
|
||||
virtual ~ObMySQLResult();
|
||||
|
@ -24,8 +24,7 @@ namespace common
|
||||
using namespace sqlclient;
|
||||
|
||||
ObMySQLTransaction::ObMySQLTransaction(bool enable_query_stash)
|
||||
:ObSingleConnectionProxy(),
|
||||
start_time_(0),
|
||||
:start_time_(0),
|
||||
in_trans_(false),
|
||||
enable_query_stash_(enable_query_stash)
|
||||
{
|
||||
|
@ -202,6 +202,7 @@ int ObServerConnectionPool::init_dblink(uint64_t dblink_id, const ObAddr &server
|
||||
cluster_str.length(), cluster_str.ptr());
|
||||
}
|
||||
(void)snprintf(db_pass_, sizeof(db_pass_), "%.*s", db_pass.length(), db_pass.ptr());
|
||||
// https://baike.baidu.com/item/mysql_real_connect/4007597
|
||||
// if db is NULL, the default database is used.
|
||||
if (!db_name.empty()) {
|
||||
(void)snprintf(db_name_, sizeof(db_name_), "%.*s", db_name.length(), db_name.ptr());
|
||||
|
@ -71,6 +71,7 @@ int ObSingleConnectionProxy::connect(const uint64_t tenant_id, ObISQLClient *sql
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int ObSingleConnectionProxy::read(ReadResult &res,
|
||||
const uint64_t tenant_id, const char *sql)
|
||||
{
|
||||
|
@ -44,8 +44,8 @@ public:
|
||||
using ObISQLClient::write;
|
||||
|
||||
int connect(const uint64_t tenant_id, ObISQLClient *sql_client);
|
||||
sqlclient::ObISQLConnection *get_connection() { return conn_; }
|
||||
virtual sqlclient::ObISQLConnectionPool *get_pool() override { return pool_; }
|
||||
virtual sqlclient::ObISQLConnection *get_connection() override { return conn_; }
|
||||
|
||||
virtual bool is_oracle_mode() const override { return oracle_mode_; }
|
||||
// in some situation, it allows continuation of SQL execution after failure in transaction,
|
||||
|
2
deps/oblib/src/lib/ob_define.h
vendored
2
deps/oblib/src/lib/ob_define.h
vendored
@ -309,7 +309,6 @@ const int64_t OB_SERVER_TYPE_LENGTH = 64;
|
||||
const int64_t OB_MAX_HOSTNAME_LENGTH = 60;
|
||||
const int64_t OB_MAX_USERNAME_LENGTH = 32;
|
||||
const int64_t OB_MAX_PASSWORD_LENGTH = 128;
|
||||
const int64_t OB_MAX_PASSWORD_BUF_LENGTH = OB_MAX_PASSWORD_LENGTH + 1;
|
||||
// After each sha1 is 41 characters, the incremental backup is up to 64 times, and the maximum password required for recovery is 64*(41+1)=2,688
|
||||
const int64_t OB_MAX_PASSWORD_ARRAY_LENGTH = 4096;
|
||||
const int64_t OB_MAX_ERROR_MSG_LEN = 512;
|
||||
@ -775,7 +774,6 @@ const char *const OB_DIAG_TENANT_NAME = "diag";
|
||||
//for sync ddl (ClusterID_TenantID_SchemaVersion)
|
||||
const char *const OB_DDL_ID_VAR_NAME = "__oceanbase_ddl_id";
|
||||
const int64_t OB_MAX_DDL_ID_STR_LENGTH = 64;
|
||||
const int64_t OB_MAX_DDL_SINGLE_REPLICA_BUILD_TIMEOUT = 7L * 24L * 60L * 60L * 1000L * 1000L; // 7days
|
||||
|
||||
// The default user name of the standby database to log in to the main database
|
||||
const char *const OB_STANDBY_USER_NAME = "__oceanbase_inner_standby_user";
|
||||
|
16
deps/oblib/src/lib/ob_name_id_def.h
vendored
16
deps/oblib/src/lib/ob_name_id_def.h
vendored
@ -197,7 +197,8 @@ DEF_NAME(id, "id")
|
||||
DEF_NAME(part_end_trans, "partition end transaction")
|
||||
DEF_NAME(left_time, "left time")
|
||||
DEF_NAME(is_rollback, "is rollback")
|
||||
DEF_NAME(log_sync_succ_cb, "on_log_sync_success")
|
||||
DEF_NAME(iter_cb, "iter cb")
|
||||
DEF_NAME(on_succ_cb, "on_sync_log_success")
|
||||
DEF_NAME(leader_takeover, "leader takeover")
|
||||
DEF_NAME(leader_active, "leader active")
|
||||
DEF_NAME(leader_revoke, "leader revoke")
|
||||
@ -229,7 +230,7 @@ DEF_NAME(id, "id")
|
||||
DEF_NAME(submit_log_cb, "submit log callback")
|
||||
DEF_NAME(submit_commit, "submit commit")
|
||||
DEF_NAME(submit_abort, "submit abort")
|
||||
DEF_NAME(push_max_commit_version, "push max commit version")
|
||||
DEF_NAME(update_trans_version, "update transaction version")
|
||||
DEF_NAME(prepare, "prepare")
|
||||
DEF_NAME(ctx_ref, "transaction context reference")
|
||||
DEF_NAME(on_submit_log_succ_cb, "on submit log succ cb")
|
||||
@ -467,6 +468,7 @@ DEF_NAME(id, "id")
|
||||
DEF_NAME(replay_start_working_log, "replay start working log")
|
||||
DEF_NAME(replay_rollback_to, "replay rollback to")
|
||||
DEF_NAME(replay_active_info, "replay active info")
|
||||
DEF_NAME(scn_val, "value of scn")
|
||||
// perf event
|
||||
DEF_NAME(S_scan_iter, "storage: scan iterator")
|
||||
DEF_NAME(pc_fast_gen_stmt_key_end, "plan cache: fast genarate stmt_key")
|
||||
@ -567,15 +569,6 @@ DEF_NAME(id, "id")
|
||||
DEF_NAME(update_start_check_row, "update_start_check_row")
|
||||
DEF_NAME(update_end_check_row, "update_end_check_row")
|
||||
|
||||
DEF_NAME_PAIR(get_das_id, "get_das_id")
|
||||
DEF_NAME_PAIR(do_local_das_task, "do_local_das_task")
|
||||
DEF_NAME_PAIR(do_remote_das_task, "do_remote_das_task")
|
||||
DEF_NAME_PAIR(rescan_das_task, "rescan_das_task")
|
||||
DEF_NAME_PAIR(das_rpc_process, "das_rpc_process")
|
||||
DEF_NAME_PAIR(close_das_task, "close_das_task")
|
||||
DEF_NAME_PAIR(fetch_das_extra_result, "fetch_das_extra_result")
|
||||
DEF_NAME_PAIR(fetch_das_result_process, "fetch_das_result_process")
|
||||
|
||||
DEF_NAME(before_calculate_row, "before_calculate_row")
|
||||
DEF_NAME(end_calculate_row, "end_calculate_row")
|
||||
DEF_NAME(row, "row")
|
||||
@ -748,7 +741,6 @@ DEF_NAME(id, "id")
|
||||
// pc: plan cache
|
||||
// E: executor
|
||||
DEF_NAME_PAIR(S_table_scan, "storage: table scan")
|
||||
DEF_NAME_PAIR(S_table_rescan, "storage: table rescan")
|
||||
DEF_NAME_PAIR(S_revert_iter, "storage: revert iterator")
|
||||
DEF_NAME_PAIR(S_delete_rows, "storage: delete rows")
|
||||
DEF_NAME_PAIR(S_delete_row, "storage: delete row")
|
||||
|
@ -407,13 +407,24 @@ public:
|
||||
return blk_size;
|
||||
}
|
||||
|
||||
static ObFixedClassAllocator<T> *get(const char* label = "ConcurObjPool")
|
||||
static ObFixedClassAllocator<T> *get(const lib::ObLabel &label = common::ObModIds::OB_CONCURRENCY_OBJ_POOL)
|
||||
{
|
||||
static ObFixedClassAllocator<T> instance(sizeof(T),
|
||||
ObMemAttr(common::OB_SERVER_TENANT_ID, label),
|
||||
choose_blk_size(sizeof(T)),
|
||||
common::get_cpu_count());
|
||||
return &instance;
|
||||
ObFixedClassAllocator<T> *instance = NULL;
|
||||
while (OB_UNLIKELY(once_ < 2)) {
|
||||
if (ATOMIC_BCAS(&once_, 0, 1)) {
|
||||
instance = new (std::nothrow) ObFixedClassAllocator(sizeof(T),
|
||||
ObMemAttr(common::OB_SERVER_TENANT_ID, label),
|
||||
choose_blk_size(sizeof(T)),
|
||||
common::get_cpu_count());
|
||||
if (OB_LIKELY(NULL != instance)) {
|
||||
instance_ = instance;
|
||||
(void)ATOMIC_BCAS(&once_, 1, 2);
|
||||
} else {
|
||||
(void)ATOMIC_BCAS(&once_, 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (ObFixedClassAllocator<T> *)instance_;
|
||||
}
|
||||
|
||||
void *alloc()
|
||||
@ -430,6 +441,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
static volatile int64_t once_;
|
||||
static volatile ObFixedClassAllocator<T> *instance_;
|
||||
|
||||
private:
|
||||
ObSliceAlloc allocator_;
|
||||
};
|
||||
@ -720,6 +735,10 @@ template<class T>
|
||||
volatile int64_t ObClassAllocator<T>::once_ = 0;
|
||||
template<class T>
|
||||
volatile ObClassAllocator<T> *ObClassAllocator<T>::instance_ = NULL;
|
||||
template<class T>
|
||||
volatile int64_t ObFixedClassAllocator<T>::once_ = 0;
|
||||
template<class T>
|
||||
volatile ObFixedClassAllocator<T> *ObFixedClassAllocator<T>::instance_ = NULL;
|
||||
|
||||
template <class T>
|
||||
struct OPNum
|
||||
@ -813,7 +832,7 @@ inline void call_destructor(T *ptr) {
|
||||
({ \
|
||||
type *ret = NULL; \
|
||||
common::ObFixedClassAllocator<type> *instance = \
|
||||
common::ObFixedClassAllocator<type>::get(#type); \
|
||||
common::ObFixedClassAllocator<type>::get(common::OPNum<type>::LABEL); \
|
||||
if (OB_LIKELY(NULL != instance)) { \
|
||||
void *tmp = instance->alloc(); \
|
||||
if (OB_LIKELY(NULL != tmp)) { \
|
||||
@ -828,7 +847,7 @@ inline void call_destructor(T *ptr) {
|
||||
OLD_STATIC_ASSERT((std::is_default_constructible<type>::value), "type is not default constructible"); \
|
||||
type *ret = NULL; \
|
||||
common::ObFixedClassAllocator<type> *instance = \
|
||||
common::ObFixedClassAllocator<type>::get(#type); \
|
||||
common::ObFixedClassAllocator<type>::get(common::OPNum<type>::LABEL); \
|
||||
if (OB_LIKELY(NULL != instance)) { \
|
||||
void *tmp = instance->alloc(); \
|
||||
if (OB_LIKELY(NULL != tmp)) { \
|
||||
@ -841,7 +860,7 @@ inline void call_destructor(T *ptr) {
|
||||
#define op_free(ptr) \
|
||||
({ \
|
||||
common::ObFixedClassAllocator<__typeof__(*ptr)> *instance = \
|
||||
common::ObFixedClassAllocator<__typeof__(*ptr)>::get(); \
|
||||
common::ObFixedClassAllocator<__typeof__(*ptr)>::get(common::OPNum<__typeof__(*ptr)>::LABEL); \
|
||||
if (OB_LIKELY(NULL != instance)) { \
|
||||
instance->free(ptr); \
|
||||
} \
|
||||
|
7
deps/oblib/src/lib/oblog/ob_log.cpp
vendored
7
deps/oblib/src/lib/oblog/ob_log.cpp
vendored
@ -337,8 +337,6 @@ ProbeAction probe_str2action(const char *str)
|
||||
action = ProbeAction::PROBE_BT;
|
||||
} else if (0 == strcmp(str, "abort")) {
|
||||
action = ProbeAction::PROBE_ABORT;
|
||||
} else if (0 == strcmp(str, "disable")) {
|
||||
action = ProbeAction::PROBE_DISABLE;
|
||||
}
|
||||
return action;
|
||||
}
|
||||
@ -355,10 +353,6 @@ const char *probe_action2str(ProbeAction action)
|
||||
str = "abort";
|
||||
break;
|
||||
}
|
||||
case ProbeAction::PROBE_DISABLE: {
|
||||
str = "disable";
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
str = "none";
|
||||
break;
|
||||
@ -389,7 +383,6 @@ int ObLogger::set_probe(char *str)
|
||||
auto &probe = probes_[probe_cnt_++];
|
||||
probe.action_ = action;
|
||||
strncpy(probe.file_, file, sizeof probe.file_);
|
||||
probe.file_[sizeof probe.file_ - 1] = '\0';
|
||||
probe.line_ = atoi(line);
|
||||
char location[256];
|
||||
snprintf(location, sizeof location, "%s:%s", file, line);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user