oceanbase-ce/diff.patch
2024-04-26 11:54:39 +08:00

1015 lines
37 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

diff --git a/.secignore b/.secignore
index 1085ab2..d951c07 100644
--- a/.secignore
+++ b/.secignore
@@ -188,6 +188,8 @@
http://helloworld.com/*
http://1.1.1.1:8080/*
https://mirrors.aliyun.com/*
+ https://mirrors.oceanbase.com/*
+ http://mirrors.oceanbase.com/*
https://bixense.com/clicolors/
martin.gieseking@uos.de
jloup@gzip.org
diff --git a/cmake/RPM.cmake b/cmake/RPM.cmake
index f0cec90..5771ba3 100644
--- a/cmake/RPM.cmake
+++ b/cmake/RPM.cmake
@@ -64,27 +64,31 @@ set(CPACK_RPM_SPEC_MORE_DEFINE
if (OB_BUILD_OPENSOURCE)
set(CPACK_RPM_PACKAGE_REQUIRES "jq, systemd")
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/oceanbase-service.sh.template
- ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/oceanbase-service.sh
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/oceanbase-service.sh.template
+ ${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/oceanbase-service.sh
@ONLY)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/telemetry.sh.template
- ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/telemetry.sh
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/telemetry.sh.template
+ ${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/telemetry.sh
@ONLY)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_install.sh.template
- ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_install.sh
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/pre_install.sh.template
+ ${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/pre_install.sh
@ONLY)
- set(CPACK_RPM_SERVER_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_install.sh)
+ set(CPACK_RPM_SERVER_PRE_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/pre_install.sh)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/post_install.sh.template
+ ${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/post_install.sh
+ @ONLY)
+ set(CPACK_RPM_SERVER_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/post_install.sh)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/pre_uninstall.sh.template
- ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/pre_uninstall.sh
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/pre_uninstall.sh.template
+ ${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/pre_uninstall.sh
@ONLY)
- set(CPACK_RPM_SERVER_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/pre_uninstall.sh)
+ set(CPACK_RPM_SERVER_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/pre_uninstall.sh)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_uninstall.sh.template
- ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_uninstall.sh
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/post_uninstall.sh.template
+ ${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/post_uninstall.sh
@ONLY)
- set(CPACK_RPM_SERVER_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_uninstall.sh)
+ set(CPACK_RPM_SERVER_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tools/systemd/profile/post_uninstall.sh)
endif()
## TIPS
@@ -134,14 +138,15 @@ install(
if (OB_BUILD_OPENSOURCE)
install(FILES
- tools/rpm/systemd/profile/oceanbase.cnf
- tools/rpm/systemd/profile/oceanbase-pre.json
- tools/rpm/systemd/profile/oceanbase.service
- tools/rpm/systemd/profile/oceanbase-service.sh
- tools/rpm/systemd/profile/post_install.sh
- tools/rpm/systemd/profile/post_uninstall.sh
- tools/rpm/systemd/profile/pre_uninstall.sh
- tools/rpm/systemd/profile/telemetry.sh
+ tools/systemd/profile/oceanbase.cnf
+ tools/systemd/profile/oceanbase-pre.json
+ tools/systemd/profile/oceanbase.service
+ tools/systemd/profile/oceanbase-service.sh
+ tools/systemd/profile/pre_install.sh
+ tools/systemd/profile/post_install.sh
+ tools/systemd/profile/post_uninstall.sh
+ tools/systemd/profile/pre_uninstall.sh
+ tools/systemd/profile/telemetry.sh
DESTINATION profile
COMPONENT server)
endif()
@@ -230,171 +235,6 @@ install(FILES
DESTINATION include
COMPONENT sql-parser)
-## oceanbsae-table
-install(FILES
- deps/oblib/src/common/data_buffer.h
- deps/oblib/src/common/ob_accuracy.h
- deps/oblib/src/common/ob_action_flag.h
- deps/oblib/src/common/ob_common_utility.h
- deps/oblib/src/common/ob_range.h
- deps/oblib/src/common/ob_region.h
- deps/oblib/src/common/ob_role.h
- deps/oblib/src/common/ob_string_buf.h
- deps/oblib/src/common/ob_string_buf.ipp
- deps/oblib/src/common/ob_timeout_ctx.h
- deps/oblib/src/common/ob_zerofill_info.h
- deps/oblib/src/common/ob_zone.h
- deps/oblib/src/common/object/ob_obj_type.h
- deps/oblib/src/common/object/ob_object.h
- deps/oblib/src/common/rowkey/ob_rowkey.h
- deps/oblib/src/common/rowkey/ob_rowkey_info.h
- deps/oblib/src/lib/alloc/abit_set.h
- deps/oblib/src/lib/alloc/alloc_assist.h
- deps/oblib/src/lib/alloc/alloc_func.h
- deps/oblib/src/lib/alloc/alloc_struct.h
- deps/oblib/src/lib/alloc/block_set.h
- deps/oblib/src/lib/alloc/ob_malloc_allocator.h
- deps/oblib/src/lib/alloc/ob_tenant_ctx_allocator.h
- deps/oblib/src/lib/alloc/object_mgr.h
- deps/oblib/src/lib/alloc/object_set.h
- deps/oblib/src/lib/allocator/ob_allocator.h
- deps/oblib/src/lib/allocator/ob_cached_allocator.h
- deps/oblib/src/lib/allocator/ob_concurrent_fifo_allocator.h
- deps/oblib/src/lib/allocator/ob_fifo_allocator.h
- deps/oblib/src/lib/allocator/ob_lf_fifo_allocator.h
- deps/oblib/src/lib/allocator/ob_malloc.h
- deps/oblib/src/lib/allocator/ob_mod_define.h
- deps/oblib/src/lib/allocator/ob_pcounter.h
- deps/oblib/src/lib/allocator/ob_pooled_allocator.h
- deps/oblib/src/lib/allocator/ob_retire_station.h
- deps/oblib/src/lib/allocator/ob_small_allocator.h
- deps/oblib/src/lib/allocator/ob_tc_malloc.h
- deps/oblib/src/lib/allocator/page_arena.h
- deps/oblib/src/lib/atomic/ob_atomic.h
- deps/oblib/src/lib/atomic/ob_atomic_reference.h
- deps/oblib/src/lib/charset/ob_charset.h
- deps/oblib/src/lib/charset/ob_config.h
- deps/oblib/src/lib/charset/ob_ctype.h
- deps/oblib/src/lib/charset/ob_mysql_global.h
- deps/oblib/src/lib/checksum/ob_crc64.h
- deps/oblib/src/lib/container/ob_array.h
- deps/oblib/src/lib/container/ob_array_helper.h
- deps/oblib/src/lib/container/ob_array_iterator.h
- deps/oblib/src/lib/container/ob_array_serialization.h
- deps/oblib/src/lib/container/ob_array_wrap.h
- deps/oblib/src/lib/container/ob_bit_set.h
- deps/oblib/src/lib/container/ob_fixed_array.h
- deps/oblib/src/lib/container/ob_iarray.h
- deps/oblib/src/lib/container/ob_se_array.h
- deps/oblib/src/lib/container/ob_vector.h
- deps/oblib/src/lib/container/ob_vector.ipp
- deps/oblib/src/lib/core_local/ob_core_local_storage.h
- deps/oblib/src/lib/file/config.h
- deps/oblib/src/lib/file/ob_string_util.h
- deps/oblib/src/lib/hash/mprotect.h
- deps/oblib/src/lib/hash/ob_array_index_hash_set.h
- deps/oblib/src/lib/hash/ob_hashmap.h
- deps/oblib/src/lib/hash/ob_hashset.h
- deps/oblib/src/lib/hash/ob_hashtable.h
- deps/oblib/src/lib/hash/ob_hashutils.h
- deps/oblib/src/lib/hash/ob_iteratable_hashmap.h
- deps/oblib/src/lib/hash/ob_linear_hash_map.h
- deps/oblib/src/lib/hash/ob_placement_hashutils.h
- deps/oblib/src/lib/hash/ob_pointer_hashmap.h
- deps/oblib/src/lib/hash/ob_serialization.h
- deps/oblib/src/lib/hash_func/murmur_hash.h
- deps/oblib/src/lib/hash_func/ob_hash_func.h
- deps/oblib/src/lib/json/ob_yson.h
- deps/oblib/src/lib/json/ob_yson_encode.h
- deps/oblib/src/lib/list/ob_dlink_node.h
- deps/oblib/src/lib/list/ob_dlist.h
- deps/oblib/src/lib/list/ob_list.h
- deps/oblib/src/lib/lock/cond.h
- deps/oblib/src/lib/lock/ob_lock.h
- deps/oblib/src/lib/lock/ob_monitor.h
- deps/oblib/src/lib/lock/mutex.h
- deps/oblib/src/lib/lock/ob_bucket_lock.h
- deps/oblib/src/lib/lock/ob_drw_lock.h
- deps/oblib/src/lib/lock/ob_latch.h
- deps/oblib/src/lib/lock/ob_lock_guard.h
- deps/oblib/src/lib/lock/ob_mutex.h
- deps/oblib/src/lib/lock/ob_small_spin_lock.h
- deps/oblib/src/lib/lock/ob_spin_lock.h
- deps/oblib/src/lib/lock/ob_spin_rwlock.h
- deps/oblib/src/lib/lock/ob_thread_cond.h
- deps/oblib/src/lib/lock/ob_rwlock.h
- deps/oblib/src/lib/metrics/ob_counter.h
- deps/oblib/src/lib/net/ob_addr.h
- deps/oblib/src/lib/net/ob_net_util.h
- deps/oblib/src/lib/number/ob_number_v2.h
- deps/oblib/src/lib/ob_date_unit_type.h
- deps/oblib/src/lib/ob_define.h
- deps/oblib/src/lib/ob_errno.h
- deps/oblib/src/lib/ob_name_def.h
- deps/oblib/src/lib/ob_name_id_def.h
- deps/oblib/src/lib/oblog/ob_log.h
- deps/oblib/src/lib/oblog/ob_log_module.h
- deps/oblib/src/lib/oblog/ob_log_print_kv.h
- deps/oblib/src/lib/oblog/ob_trace_log.h
- deps/oblib/src/lib/profile/ob_atomic_event.h
- deps/oblib/src/lib/queue/ob_dedup_queue.h
- deps/oblib/src/lib/queue/ob_fixed_queue.h
- deps/oblib/src/lib/queue/ob_link.h
- deps/oblib/src/lib/random/ob_random.h
- deps/oblib/src/lib/resource/achunk_mgr.h
- deps/oblib/src/lib/resource/ob_cache_washer.h
- deps/oblib/src/lib/resource/ob_resource_mgr.h
- deps/oblib/src/lib/stat/ob_latch_define.h
- deps/oblib/src/lib/string/ob_fixed_length_string.h
- deps/oblib/src/lib/string/ob_string.h
- deps/oblib/src/lib/string/ob_strings.h
- deps/oblib/src/lib/thread_local/ob_tsi_factory.h
- deps/oblib/src/lib/thread_local/ob_tsi_utils.h
- deps/oblib/src/lib/time/Time.h
- deps/oblib/src/lib/time/ob_time_utility.h
- deps/oblib/src/lib/timezone/ob_time_convert.h
- deps/oblib/src/lib/timezone/ob_timezone_info.h
- deps/oblib/src/lib/trace/ob_seq_event_recorder.h
- deps/oblib/src/lib/trace/ob_trace_event.h
- deps/oblib/src/lib/utility/ob_hang_fatal_error.h
- deps/oblib/src/lib/utility/ob_macro_utils.h
- deps/oblib/src/lib/utility/ob_print_kv.h
- deps/oblib/src/lib/utility/ob_print_utils.h
- deps/oblib/src/lib/utility/ob_rate_limiter.h
- deps/oblib/src/lib/utility/ob_serialization_helper.h
- deps/oblib/src/lib/utility/ob_template_utils.h
- deps/oblib/src/lib/utility/ob_unify_serialize.h
- deps/oblib/src/lib/utility/serialization.h
- deps/oblib/src/lib/utility/utility.h
- deps/oblib/src/lib/wait_event/ob_wait_class.h
- deps/oblib/src/lib/wait_event/ob_wait_event.h
- src/share/config/ob_common_config.h
- src/share/config/ob_config.h
- src/share/config/ob_config_helper.h
- src/share/mysql_errno.h
- src/share/object/ob_obj_cast.h
- src/share/partition_table/ob_partition_location.h
- src/share/table/ob_table.h
- src/share/table/ob_table_rpc_proxy.h
- src/share/table/ob_table_rpc_struct.h
- src/libtable/src/libobtable.h
- src/libtable/src/ob_table.h
- src/libtable/src/ob_hkv_table.h
- src/libtable/src/ob_pstore.h
- src/libtable/src/ob_table_service_client.h
- src/libtable/src/ob_table_service_config.h
- src/libtable/src/ob_table_define.h
- DESTINATION include
- 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
- DESTINATION examples
- COMPONENT table)
-
if (OB_BUILD_LIBOBTABLE)
if (ENABLE_THIN_LTO)
@@ -406,14 +246,6 @@ if (OB_BUILD_LIBOBTABLE)
COMMAND_EXPAND_LISTS)
list(APPEND BITCODE_TO_ELF_LIST libobtable_static_to_elf)
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)
endif()
if(OB_BUILD_OPENSOURCE)
diff --git a/deps/init/dep_create.sh b/deps/init/dep_create.sh
index ad5f149..4ad0adb 100644
--- a/deps/init/dep_create.sh
+++ b/deps/init/dep_create.sh
@@ -80,6 +80,9 @@ function get_os_release() {
fedora)
version_ge "33" && compat_centos7 && return
;;
+ openEuler)
+ version_ge "20" && compat_centos9 && return
+ ;;
opensuse-leap)
version_ge "15" && compat_centos7 && return
;;
@@ -106,10 +109,18 @@ function get_os_release() {
version_ge "8.0" && compat_centos8 && return
version_ge "7.0" && compat_centos7 && return
;;
+ anolis)
+ version_ge "23.0" && compat_centos9 && return
+ version_ge "8.0" && compat_centos8 && return
+ version_ge "7.0" && compat_centos7 && return
+ ;;
centos)
version_ge "8.0" && OS_RELEASE=8 && return
version_ge "7.0" && OS_RELEASE=7 && return
;;
+ openEuler)
+ version_ge "20" && compat_centos9 && return
+ ;;
ubuntu)
version_ge "22.04" && compat_centos9 && return
version_ge "16.04" && compat_centos7 && return
diff --git a/deps/init/oceanbase.el7.aarch64.deps b/deps/init/oceanbase.el7.aarch64.deps
index 56c510d..1397b9c 100644
--- a/deps/init/oceanbase.el7.aarch64.deps
+++ b/deps/init/oceanbase.el7.aarch64.deps
@@ -1,12 +1,12 @@
[target-default]
os=7
arch=aarch64
-repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/7/aarch64/
+repo=https://mirrors.oceanbase.com/oceanbase/development-kit/el/7/aarch64/
[target-community]
os=7
arch=aarch64
-repo=http://mirrors.aliyun.com/oceanbase/community/stable/el/7/aarch64/
+repo=https://mirrors.oceanbase.com/oceanbase/community/stable/el/7/aarch64/
[deps]
diff --git a/deps/init/oceanbase.el7.x86_64.deps b/deps/init/oceanbase.el7.x86_64.deps
index e86e501..5b83a69 100644
--- a/deps/init/oceanbase.el7.x86_64.deps
+++ b/deps/init/oceanbase.el7.x86_64.deps
@@ -1,13 +1,13 @@
[target-default]
os=7
arch=x86_64
-repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/7/x86_64/
+repo=https://mirrors.oceanbase.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/
+repo=https://mirrors.oceanbase.com/oceanbase/community/stable/el/7/x86_64/
[deps]
diff --git a/deps/init/oceanbase.el8.aarch64.deps b/deps/init/oceanbase.el8.aarch64.deps
index 2b8612c..919cd33 100644
--- a/deps/init/oceanbase.el8.aarch64.deps
+++ b/deps/init/oceanbase.el8.aarch64.deps
@@ -1,12 +1,12 @@
[target-default]
os=8
arch=aarch64
-repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/8/aarch64/
+repo=https://mirrors.oceanbase.com/oceanbase/development-kit/el/8/aarch64/
[target-community]
os=8
arch=aarch64
-repo=http://mirrors.aliyun.com/oceanbase/community/stable/el/8/aarch64/
+repo=https://mirrors.oceanbase.com/oceanbase/community/stable/el/8/aarch64/
[deps]
diff --git a/deps/init/oceanbase.el8.x86_64.deps b/deps/init/oceanbase.el8.x86_64.deps
index bda5fcc..db3c8a1 100644
--- a/deps/init/oceanbase.el8.x86_64.deps
+++ b/deps/init/oceanbase.el8.x86_64.deps
@@ -1,12 +1,12 @@
[target-default]
os=8
arch=x86_64
-repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/8/x86_64/
+repo=https://mirrors.oceanbase.com/oceanbase/development-kit/el/8/x86_64/
[target-community]
os=8
arch=x86_64
-repo=http://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/
+repo=https://mirrors.oceanbase.com/oceanbase/community/stable/el/8/x86_64/
[deps]
diff --git a/deps/init/oceanbase.el9.aarch64.deps b/deps/init/oceanbase.el9.aarch64.deps
index 136767c..07d4b9a 100644
--- a/deps/init/oceanbase.el9.aarch64.deps
+++ b/deps/init/oceanbase.el9.aarch64.deps
@@ -1,17 +1,17 @@
[target-default]
os=9
arch=aarch64
-repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/8/aarch64/
+repo=https://mirrors.oceanbase.com/oceanbase/development-kit/el/8/aarch64/
[target-community]
os=9
arch=aarch64
-repo=http://mirrors.aliyun.com/oceanbase/community/stable/el/8/aarch64/
+repo=https://mirrors.oceanbase.com/oceanbase/community/stable/el/8/aarch64/
[target-apr-el9]
os=9
arch=aarch64
-repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/9/aarch64/
+repo=https://mirrors.oceanbase.com/oceanbase/development-kit/el/9/aarch64/
[deps]
devdeps-gtest-1.8.0-132022101316.el8.aarch64.rpm
@@ -46,8 +46,9 @@ obdevtools-gcc9-9.3.0-52022092914.el8.aarch64.rpm
obdevtools-llvm-11.0.1-312022092921.el8.aarch64.rpm
[tools-deps]
-devdeps-oblogmsg-1.0-52022113019.el8.aarch64.rpm
+devdeps-oblogmsg-1.0-142024012415.el8.aarch64.rpm
devdeps-rocksdb-6.22.1.1-52022100420.el8.aarch64.rpm
+obshell-4.2.2.0-122024022614.el8.aarch64.rpm target=community
[test-utils]
ob-deploy-1.6.0-41.el8.aarch64.rpm target=community
diff --git a/deps/init/oceanbase.el9.x86_64.deps b/deps/init/oceanbase.el9.x86_64.deps
index e9712b3..a359e80 100644
--- a/deps/init/oceanbase.el9.x86_64.deps
+++ b/deps/init/oceanbase.el9.x86_64.deps
@@ -1,17 +1,17 @@
[target-default]
os=9
arch=x86_64
-repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/8/x86_64/
+repo=https://mirrors.oceanbase.com/oceanbase/development-kit/el/8/x86_64/
[target-community]
os=9
arch=x86_64
-repo=http://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/
+repo=https://mirrors.oceanbase.com/oceanbase/community/stable/el/8/x86_64/
[target-apr-el9]
os=9
arch=x86_64
-repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/9/x86_64/
+repo=https://mirrors.oceanbase.com/oceanbase/development-kit/el/9/x86_64/
[deps]
devdeps-gtest-1.8.0-132022101316.el8.x86_64.rpm
@@ -47,8 +47,9 @@ 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-52022113019.el8.x86_64.rpm
+devdeps-oblogmsg-1.0-142024012415.el8.x86_64.rpm
devdeps-rocksdb-6.22.1.1-52022100420.el8.x86_64.rpm
+obshell-4.2.2.0-122024022614.el8.x86_64.rpm target=community
[test-utils]
ob-deploy-1.6.0-41.el8.x86_64.rpm target=community
diff --git a/tools/rpm/systemd/README-CN.md b/tools/rpm/systemd/README-CN.md
deleted file mode 100644
index 2af52a9..0000000
--- a/tools/rpm/systemd/README-CN.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# 通过yum和systemd的方式安装OceanBase数据库
-如果你想在linux rpm平台上部署oceanbase可以使用yum进行单节点安装并通过systemd进行简单管理
-
-**注意**
-
-- 该方法仅能用做学习研究或测试使用;
-- 千万不要使用此方法用于带有重要数据的场景,比如生产环境。
-
-## 安装方法
-现在暂时只支持RPM平台系统可以通过以下指令进行安装和启动
-```bash
-yum install oceanbase-ce
-systemctl start oceanbase
-```
-可以通过以下指令将oceanbase服务设置为开机自启动
-```bash
-systemctl enable oceanbase
-```
-
-## systemd介绍
-Systemd提供了自动化管理oceanbase的启动和停止可以通过systemctl指令对oceanbase进行管理控制例如
-```bash
-systemctl {start|stop|restart|status} oceanbase
-```
-
-## 通过systemd配置oceanbase
-systemd提供了配置文件`/etc/oceanbase.cnf`,可以在启动前修改配置进行带参启动
diff --git a/tools/rpm/systemd/README.md b/tools/rpm/systemd/README.md
deleted file mode 100644
index 89bb399..0000000
--- a/tools/rpm/systemd/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# Installing OceanBase Database via yum and systemd
-If you want to deploy OceanBase on a Linux RPM platform, you can use yum for single-node installation and simple management with systemd.
-
-**WARNING**
-
-- The installation method is just used for study or test;
-- You should not deploy it with important data as it is not used in production environment.
-
-## Installation Method
-Now systemd only support RPM platform and you can install and run oceanbase service using the following command:
-```bash
-yum install oceanbase-ce
-systemctl start oceanbase
-```
-You can set the OceanBase service to start automatically on boot using the following command:
-```bash
-systemctl enable oceanbase
-```
-
-## Overview of systemd
-Systemd provides automatic oceanbase startup and shutdown. It also enables manual server management using the systemctl command. For example:
-```bash
-systemctl {start|stop|restart|status} oceanbase
-```
-
-## Oceanbase configuration by systemd
-Systemd provide `/etc/oceanbase.cnf` to config oceanbase before startup.
diff --git a/tools/rpm/systemd/profile/post_install.sh.template b/tools/rpm/systemd/profile/post_install.sh.template
deleted file mode 100644
index 94df4dc..0000000
--- a/tools/rpm/systemd/profile/post_install.sh.template
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-echo "execute post install script"
-prefix=@CPACK_PACKAGING_INSTALL_PREFIX@
-
-# prepare the systemd service unit
-cp -f $prefix/profile/oceanbase.service /etc/systemd/system/oceanbase.service
-chmod 644 /etc/systemd/system/oceanbase.service
-chmod +x $prefix/profile/oceanbase-service.sh
-cp -f $prefix/profile/oceanbase.cnf /etc/oceanbase.cnf
-systemctl daemon-reload
-
-# telemetry
-/bin/bash $prefix/profile/telemetry.sh $1 >/dev/null 2>&1
\ No newline at end of file
diff --git a/tools/rpm/systemd/profile/post_uninstall.sh.template b/tools/rpm/systemd/profile/post_uninstall.sh.template
deleted file mode 100644
index 0b3666c..0000000
--- a/tools/rpm/systemd/profile/post_uninstall.sh.template
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-echo "execute post uninstall script"
-prefix=@CPACK_PACKAGING_INSTALL_PREFIX@
-
-rm -rf $prefix/.meta $prefix/log_obshell
\ No newline at end of file
diff --git a/tools/systemd/README-CN.md b/tools/systemd/README-CN.md
new file mode 100644
index 0000000..3911528
--- /dev/null
+++ b/tools/systemd/README-CN.md
@@ -0,0 +1,54 @@
+# 通过软件源安装 OceanBase 数据库
+如果你想在Linux rpm或deb平台上部署OceanBase可以使用yum或apt进行单节点安装并通过systemd进行简单管理
+
+**注意**
+
+- 该方法仅能用做学习研究或测试使用;
+- 千万不要使用此方法用于带有重要数据的场景,比如生产环境。
+
+## 通过 YUM 仓库安装 OceanBase
+配置yum源安装OceanBase会自动安装所需依赖
+```bash
+yum install -y yum-utils
+yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
+yum install -y oceanbase-ce
+```
+
+## 通过 APT 仓库安装 OceanBase
+配置apt源安装OceanBase会自动安装所需依赖
+```bash
+apt update
+apt install -y lsb-release wget gnupg2 mysql-client curl
+wget http://mirrors.oceanbase.com/oceanbase/oceanbase_deb.pub && apt-key add oceanbase_deb.pub
+echo "deb http://mirrors.oceanbase.com/oceanbase/community/stable/$(lsb_release -is | awk '{print tolower($0)}')/$(lsb_release -cs)/$(dpkg --print-architecture)/ ./" | tee -a /etc/apt/sources.list.d/oceanbase.list
+apt update
+apt install -y oceanbase-ce
+```
+
+## 依赖列表说明:
+| 组件 | 版本 |
+|-------|-------|
+| oceanbase-ce-libs | 与oceanbase-ce相同版本 |
+| jq | / |
+| oniguruma | / |
+| curl | / |
+
+# 启动方法
+可以通过以下指令进行启动:
+```bash
+systemctl start oceanbase
+```
+
+可以通过以下指令将oceanbase服务设置为开机自启动
+```bash
+systemctl enable oceanbase
+```
+
+## systemd介绍
+Systemd提供了自动化管理oceanbase的启动和停止可以通过systemctl指令对oceanbase进行管理控制例如
+```bash
+systemctl {start|stop|restart|status} oceanbase
+```
+
+## 通过systemd配置OceanBase
+systemd提供了配置文件`/etc/oceanbase.cnf`,可以在启动前修改配置进行带参启动
diff --git a/tools/systemd/README.md b/tools/systemd/README.md
new file mode 100644
index 0000000..2d0832f
--- /dev/null
+++ b/tools/systemd/README.md
@@ -0,0 +1,53 @@
+# Installing OceanBase Database via yum/apt
+If you want to deploy OceanBase on a Linux RPM platform, you can use yum/apt for single-node installation and simple management with systemd.
+
+**WARNING**
+
+- The installation method is just used for study or test;
+- You should not deploy it with important data as it is not used in production environment.
+
+## Installing OceanBase via yum
+Config yum repo then install OceanBase, it will automatically install the required dependencies.
+```bash
+yum install -y yum-utils
+yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
+yum install -y oceanbase-ce
+```
+
+## Installing OceanBase via apt
+Config apt repo then install OceanBase, it will automatically install the required dependencies.
+```bash
+apt update
+apt install -y lsb-release wget gnupg2 mysql-client curl
+wget http://mirrors.oceanbase.com/oceanbase/oceanbase_deb.pub && apt-key add oceanbase_deb.pub
+echo "deb http://mirrors.oceanbase.com/oceanbase/community/stable/$(lsb_release -is | awk '{print tolower($0)}')/$(lsb_release -cs)/$(dpkg --print-architecture)/ ./" | tee -a /etc/apt/sources.list.d/oceanbase.list
+apt update
+apt install -y oceanbase-ce
+```
+
+## Dependencies list
+| dependency | version |
+|-------|-------|
+| oceanbase-ce-libs | same version with oceanbase-ce |
+| jq | / |
+| oniguruma | / |
+| curl | / |
+
+# Startup Method
+You can install and run OceanBase service using the following command:
+```bash
+systemctl start oceanbase
+```
+You can set the OceanBase service to start automatically on boot using the following command:
+```bash
+systemctl enable oceanbase
+```
+
+## Overview of systemd
+Systemd provides automatic OceanBase startup and shutdown. It also enables manual server management using the systemctl command. For example:
+```bash
+systemctl {start|stop|restart|status} oceanbase
+```
+
+## Oceanbase configuration by systemd
+Systemd provide `/etc/oceanbase.cnf` to config OceanBase before startup.
diff --git a/tools/rpm/systemd/profile/oceanbase-pre.json b/tools/systemd/profile/oceanbase-pre.json
similarity index 100%
rename from tools/rpm/systemd/profile/oceanbase-pre.json
rename to tools/systemd/profile/oceanbase-pre.json
diff --git a/tools/rpm/systemd/profile/oceanbase-service.sh.template b/tools/systemd/profile/oceanbase-service.sh.template
similarity index 85%
rename from tools/rpm/systemd/profile/oceanbase-service.sh.template
rename to tools/systemd/profile/oceanbase-service.sh.template
index c726e6d..04184ee 100644
--- a/tools/rpm/systemd/profile/oceanbase-service.sh.template
+++ b/tools/systemd/profile/oceanbase-service.sh.template
@@ -2,12 +2,14 @@
DATE=`date '+%Y-%m-%d %H:%M:%S'`
cnf_file='/etc/oceanbase.cnf'
-ip=`hostname -i`
+ip=`hostname -I | awk '/^[0-9]/ {print $1; exit}'`
port=2886
url="http://localhost"
prefix=@CPACK_PACKAGING_INSTALL_PREFIX@
unix_socket="$prefix/run/obshell.sock"
obshell="$prefix/bin/obshell"
+etc_folder="$prefix/etc"
+current_user=`whoami`
report=3
function prepare_config_json {
@@ -43,6 +45,11 @@ function prepare_config_json {
sed -i "s|HOSTIP|${ip}|g" $json_file
}
+function prepare_env {
+ echo "change etc owner to ${current_user}"
+ chown $current_user:$current_user "${etc_folder}"
+}
+
function do_reload_observer {
echo "Not support reload now"
}
@@ -72,8 +79,8 @@ function check_obagent_process {
echo "obshell process with PID $pid is not running."
$obshell admin start --ip $ip --port $port
if [ $? -ne 0 ]; then
- echo "start ob_agent failed"
- exit
+ echo "start ob_shell failed"
+ exit 1
fi
fi
else
@@ -103,10 +110,10 @@ function check_trace {
state=$(echo "$response" | jq -r '.data.state')
echo "the response state is $state"
if [ "x$state" = "xSUCCEED" ]; then
- echo "request successfully"
+ echo "$content request successfully"
break
elif [ "x$state" = "xFAILED" ]; then
- echo "request failed"
+ echo "$content request failed"
exit 1
else
count=$((count + 1))
@@ -123,8 +130,8 @@ function check_trace {
function start_obshell {
$obshell admin start --ip $ip --port $port > /dev/null 2>&1
if [ $? -ne 0 ]; then
- echo "start ob_agent failed"
- exit
+ echo "start ob_shell failed"
+ exit 1
fi
}
@@ -169,19 +176,10 @@ function do_config_observer {
check_trace $trace "config observer" 3 3
}
-function deploy_observer {
- echo "oceanbase service deployed at ${DATE}"
- prepare_config_json
- start_obshell
- do_config_observer
-}
-
-function start_observer {
- systemd-notify --ready
+function do_start_observer {
# check observer status
response=$(curl --silent -H "Content-Type: application/json" -X GET --unix-socket $unix_socket $url/api/v1/status)
identity=$(echo "$response" | jq -r '.data.agent.identity')
- systemd-notify "STATUS=Service is running"
if [ "x$identity" = "xCLUSTER AGENT" ]; then
echo "The observer is already bootstrap, please start it immediately"
response=$(curl --silent -H "Content-Type: application/json" -X POST -d '{
@@ -222,41 +220,40 @@ function start_observer {
echo "The observer has been installed before"
fi
- systemd-notify --status="Service is ready"
-
if [ -f $prefix/run/observer.pid ]; then
pid=$(cat $prefix/run/observer.pid)
- while true; do
- if [ ! -d "/proc/$pid" ]; then
- echo "Observer process with PID $pid has exited."
- break
- fi
+ if [ ! -d "/proc/$pid" ]; then
+ echo "Observer process with PID $pid has exited."
+ break
+ fi
- echo "Observer process with PID $pid is still running."
- # check observer state
- response=$(curl --silent -H "Content-Type: application/json" -X GET -d '{
- "scope":
- {
- "type":"global",
- "target":[]
- },
- "force": true
- }' --unix-socket $unix_socket $url/api/v1/status)
- ob_state=$(echo "$response" | jq -r '.data.obState')
- if [ "x$ob_state" = "x1" ]; then
- echo "The agent dose not know the observer password"
- echo "1. Please set environment: export OB_ROOT_PASSWORD={root_passowrd}"
- echo "2. Kill all the obshell process"
- echo "3. Restart the agent process: $prefix/bin/obshell admin start --ip $ip --port $port"
- fi
- sleep 30
- done
+ # check observer state
+ response=$(curl --silent -H "Content-Type: application/json" -X GET --unix-socket $unix_socket $url/api/v1/status)
+ ob_state=$(echo "$response" | jq -r '.data.obState')
+ if [ "x$ob_state" = "x1" ]; then
+ echo "The agent dose not know the observer password"
+ echo "1. Please set environment: export OB_ROOT_PASSWORD={root_passowrd}"
+ echo "2. Kill all the obshell process"
+ echo "3. Restart the agent process: $prefix/bin/obshell admin start --ip $ip --port $port"
+ fi
else
echo "observer PID file not found."
exit 1
fi
}
+function start_observer {
+ /bin/bash $prefix/profile/telemetry.sh $report "10" >/dev/null 2>&1
+ prepare_config_json
+ prepare_env
+ if check_daemon_process; then
+ echo "The agent service is exist"
+ else
+ start_obshell
+ fi
+ do_start_observer
+}
+
function stop_observer {
check_obagent_process
response=$(curl --silent -H "Content-Type: application/json" -X POST -d '{
@@ -274,7 +271,6 @@ function stop_observer {
fi
trace=$(echo "$response" | jq -r '.data.id')
check_trace $trace "stop observer" 20 6
- systemd-notify --status='STOPPING=1'
}
function reload_observer {
@@ -285,15 +281,7 @@ function reload_observer {
if [ "x$1" = "xstart" ]; then
echo "oceanbase service started at ${DATE}"
- /bin/bash $prefix/profile/telemetry.sh $report "10" >/dev/null 2>&1
- prepare_config_json
- if check_daemon_process; then
- echo "The agent service is exist"
- else
- start_obshell
- fi
start_observer
-
elif [ "x$1" = "xstop" ]; then
echo "oceanbase service stopped at ${DATE}"
stop_observer
@@ -306,7 +294,7 @@ elif [ "x$1" = "xdestroy" ]; then
$obshell admin stop > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "stop obshell failed"
- exit
+ exit 1
fi
fi
diff --git a/tools/rpm/systemd/profile/oceanbase.cnf b/tools/systemd/profile/oceanbase.cnf
similarity index 100%
rename from tools/rpm/systemd/profile/oceanbase.cnf
rename to tools/systemd/profile/oceanbase.cnf
diff --git a/tools/rpm/systemd/profile/oceanbase.service b/tools/systemd/profile/oceanbase.service
similarity index 52%
rename from tools/rpm/systemd/profile/oceanbase.service
rename to tools/systemd/profile/oceanbase.service
index bc3b05f..7e135fa 100644
--- a/tools/rpm/systemd/profile/oceanbase.service
+++ b/tools/systemd/profile/oceanbase.service
@@ -3,11 +3,22 @@ Description=oceanbase
[Service]
User=root
-Type=notify
+Type=forking
KillMode=none
ExecStart=/bin/bash /home/admin/oceanbase/profile/oceanbase-service.sh start
ExecStop=/bin/bash /home/admin/oceanbase/profile/oceanbase-service.sh stop
ExecReload=/bin/bash /home/admin/oceanbase/profile/oceanbase-service.sh reload
+PIDFile=/home/admin/oceanbase/run/observer.pid
+TimeoutSec=2000
+TimeoutStopSec=300
+Restart=on-failure
+RestartSec=10
+SuccessExitStatus=SIGKILL
+SendSIGKILL=no
+LimitNOFILE=infinity
+LimitNPROC=infinity
+LimitCORE=infinity
+LimitSTACK=infinity
[Install]
WantedBy=multi-user.target
\ No newline at end of file
diff --git a/tools/systemd/profile/post_install.sh.template b/tools/systemd/profile/post_install.sh.template
new file mode 100644
index 0000000..21ad989
--- /dev/null
+++ b/tools/systemd/profile/post_install.sh.template
@@ -0,0 +1,20 @@
+#!/bin/bash
+echo "execute post install script"
+prefix=@CPACK_PACKAGING_INSTALL_PREFIX@
+
+# prepare the systemd service unit
+cp -f $prefix/profile/oceanbase.service /etc/systemd/system/oceanbase.service
+chmod 644 /etc/systemd/system/oceanbase.service
+chmod +x $prefix/profile/oceanbase-service.sh
+cp -f $prefix/profile/oceanbase.cnf /etc/oceanbase.cnf
+systemctl daemon-reload
+
+# telemetry
+/bin/bash $prefix/profile/telemetry.sh $1 >/dev/null 2>&1
+
+GREEN='\033[32m'
+NC="\033[0m"
+echo -e "${GREEN}To configure OceanBase${NC} : edit /etc/oceanbase.cnf"
+echo -e "${GREEN}To start OceanBase${NC} : systemctl start oceanbase"
+echo -e "${GREEN}To enable OceanBase auto reboot ${NC} : systemctl enable oceanbase"
+echo -e "${GREEN}To get more infomation${NC} : https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000640297"
\ No newline at end of file
diff --git a/tools/systemd/profile/post_uninstall.sh.template b/tools/systemd/profile/post_uninstall.sh.template
new file mode 100644
index 0000000..65e826f
--- /dev/null
+++ b/tools/systemd/profile/post_uninstall.sh.template
@@ -0,0 +1,24 @@
+#!/bin/bash
+echo "execute post uninstall script"
+prefix=@CPACK_PACKAGING_INSTALL_PREFIX@
+json_file=$prefix/profile/oceanbase.json
+GREEN='\033[32m'
+NC="\033[0m"
+
+if [ $1 -eq 0 ]; then
+ rm -rf $prefix/.meta $prefix/log_obshell
+
+ # prepare clean script
+ echo "find $prefix/ -mindepth 1 -maxdepth 1 ! -name lib -exec rm -rf {} +" > $prefix/oceanbase_clean.sh
+
+ if [ -f "$json_file" ] && [ -s "$json_file" ]; then
+ redo_dir=$(cat "$json_file" | jq -r '.oceanbase_ce.server.observerConfig.redo_dir')
+ echo "rm -rf $redo_dir" >> $prefix/oceanbase_clean.sh
+ data_dir=$(cat "$json_file" | jq -r '.oceanbase_ce.server.observerConfig.data_dir')
+ echo "rm -rf $data_dir" >> $prefix/oceanbase_clean.sh
+ echo "echo OK" >> $prefix/oceanbase_clean.sh
+ fi
+
+ echo "Clean oceanbase script can clean ob all configuration files and all data files."
+ echo -e "${GREEN}To clean OceanBase${NC} : bash $prefix/oceanbase_clean.sh"
+fi
\ No newline at end of file
diff --git a/tools/systemd/profile/pre_install.sh.template b/tools/systemd/profile/pre_install.sh.template
new file mode 100644
index 0000000..b87b154
--- /dev/null
+++ b/tools/systemd/profile/pre_install.sh.template
@@ -0,0 +1,11 @@
+#!/bin/bash
+echo "execute pre install script"
+version=@OceanBase_CE_VERSION@
+
+if [ "$1" -gt 1 ]; then
+ parent_name=$(cat /proc/$PPID/comm)
+ if [[ "$parent_name" != "ocp_mgragent" ]]; then
+ echo "The upgrade of the oceanbase $version is not allowed." >&2
+ exit 1
+ fi
+fi
\ No newline at end of file
diff --git a/tools/rpm/systemd/profile/pre_uninstall.sh.template b/tools/systemd/profile/pre_uninstall.sh.template
similarity index 84%
rename from tools/rpm/systemd/profile/pre_uninstall.sh.template
rename to tools/systemd/profile/pre_uninstall.sh.template
index 23c699d..5c50bde 100644
--- a/tools/rpm/systemd/profile/pre_uninstall.sh.template
+++ b/tools/systemd/profile/pre_uninstall.sh.template
@@ -1,5 +1,4 @@
#!/bin/bash
-
echo "execute pre uninstall script"
prefix=@CPACK_PACKAGING_INSTALL_PREFIX@
diff --git a/tools/rpm/systemd/profile/telemetry.sh.template b/tools/systemd/profile/telemetry.sh.template
similarity index 100%
rename from tools/rpm/systemd/profile/telemetry.sh.template
rename to tools/systemd/profile/telemetry.sh.template
diff --git a/tools/systemd/profile/telemetry.sh.template.rej b/tools/systemd/profile/telemetry.sh.template.rej
new file mode 100644
index 0000000..96945a4
--- /dev/null
+++ b/tools/systemd/profile/telemetry.sh.template.rej
@@ -0,0 +1,10 @@
+diff a/tools/systemd/profile/telemetry.sh.template b/tools/systemd/profile/telemetry.sh.template (rejected hunks)
+@@ -4,7 +4,7 @@ url="https://openwebapi.oceanbase.com/api/web/oceanbase/report"
+ type=@CPACK_PACKAGE_NAME@
+ version=@CPACK_PACKAGE_VERSION@
+ release=@CPACK_RPM_PACKAGE_RELEASE@
+-ip=$(hostname -i)
++ip=$(hostname -I | awk '/^[0-9]/ {print $1; exit}')
+ hostHash=$(echo -n "$ip" | sha1sum | awk '{print $1}')
+ osName=$(cat /etc/os-release | grep "^ID=" | cut -f2 -d=)
+ osRelease=$(cat /etc/os-release | grep "^VERSION_ID=" | cut -f2 -d=)