From 04640acc9bfef271cec413f38b01e0de61ff9b89 Mon Sep 17 00:00:00 2001
From: laokz <zhangkai@iscas.ac.cn>
Date: Tue, 26 Nov 2024 10:46:48 +0800
Subject: [PATCH] add riscv64 patch

Also add missed condition of packaging mysql_config-%{__isa_bits}.
---
 add-riscv64-support.patch | 853 ++++++++++++++++++++++++++++++++++++++
 greatsql.spec             |  10 +-
 2 files changed, 862 insertions(+), 1 deletion(-)
 create mode 100644 add-riscv64-support.patch

diff --git a/add-riscv64-support.patch b/add-riscv64-support.patch
new file mode 100644
index 0000000..aebf683
--- /dev/null
+++ b/add-riscv64-support.patch
@@ -0,0 +1,853 @@
+From 4b4dda1680186c8f66fd011123fe292d42fbdbf1 Mon Sep 17 00:00:00 2001
+From: sammmmy <843683531@qq.com>
+Date: Mon, 30 Sep 2024 20:32:57 +0800
+Subject: [PATCH 1/2] add riscv64 support
+
+---
+ ...36\345\275\222\346\265\213\350\257\225.md" | 244 +++++++++
+ storage/ndb/include/portlib/mt-asm.h          |  13 +
+ ...57\221\345\256\211\350\243\205GreatSQL.md" | 513 ++++++++++++++++++
+ 3 files changed, 770 insertions(+)
+ create mode 100644 "GreatSQL 8.0.32-25\345\234\250openEuler riscv64\344\270\255\345\256\214\346\210\220MTR\345\233\236\345\275\222\346\265\213\350\257\225.md"
+ create mode 100644 "\345\234\250OpenEuler RISC-V\347\216\257\345\242\203\344\270\213\346\272\220\347\240\201\347\274\226\350\257\221\345\256\211\350\243\205GreatSQL.md"
+
+diff --git "a/GreatSQL 8.0.32-25\345\234\250openEuler riscv64\344\270\255\345\256\214\346\210\220MTR\345\233\236\345\275\222\346\265\213\350\257\225.md" "b/GreatSQL 8.0.32-25\345\234\250openEuler riscv64\344\270\255\345\256\214\346\210\220MTR\345\233\236\345\275\222\346\265\213\350\257\225.md"
+new file mode 100644
+index 00000000000..ba68d2665b5
+--- /dev/null
++++ "b/GreatSQL 8.0.32-25\345\234\250openEuler riscv64\344\270\255\345\256\214\346\210\220MTR\345\233\236\345\275\222\346\265\213\350\257\225.md"	
+@@ -0,0 +1,244 @@
++# GreatSQL 8.0.32-25在openEuler riscv64中完成MTR回归测试
++
++## 1. 测试目的与思路
++
++本测试开展于将GreatSQL 8.0.32-25通过源码编译移植到openEuler riscv64环境之后,旨在测试GreatSQL是否成功移植,基本功能是否正常,能否跑过常规的MTR测例。
++
++MTR测例有pass、fail、skipped、disabled四种情况,其中只有fail用例会导致测试终止。测试开展思路是在OpenEuler x86上安装GreatSQL 8.0.32-25作为对比环境,运行多个相同的测试用例集。如果两台机器都因为相同的fail用例而停止,且completed tests数量相同、restarted/reinitialized次数相同、skipped用例数量相同、fail用例的错误日志内容相同,则说明不是riscv架构的原因,删除fail用例继续执行即可。
++
++在实际测试过程中,我们发现在x86中的所有fail用例在riscv64也同样fail了,但是riscv64相比x86有少量额外fail和pass的用例,两环境通过用例的总数相近,分别是6904和6875。所以认为GreatSQL在openEuler riscv64环境中成功移植,能跑过常规的MTR测例。
++
++## 2. 测试环境与命令
++
++### 2.1 准备openEuler x86 24.03环境
++
++参考[VMware虚拟机安装openEuler系统](https://blog.csdn.net/m0_74451345/article/details/136060845)。
++
++### 2.2 使用RPM安装GreatSQL 8.0.32-25
++
++参考[手册](https://greatsql.cn/docs/8.0.32-25/4-install-guide/2-install-with-rpm.html),在[欧拉目录](https://repo.huaweicloud.com/openeuler/openEuler-24.03-LTS/everything/x86_64/Packages/)安装8个greatsql的rpm包,注意一定要安装greatsql-test包,这样才包含mysql-test组件。
++
++安装过程中如果出现找不到libssl.so.1.1和libcrypto.so.1.1的问题,可通过软链接解决。如果出现了系统升级相关的报错,无需理会。
++
++使用`systemctl status mysqld`启动时,如果因为内存带下进程被杀,把innodb的参数注释或调小即可。注意每次重启服务清空/data/GreatSQL/*。
++
++### 2.3 运行MTR
++
++x86在/usr/share/mysql-test目录,riscv在/usr/local/GreatSQL-8.0.32-25/mysql-test目录,运行`./mtr --record --nowarnings --big-test`:
++
++- --big-test:执行标记为 `big` 的用例,也就是同时覆盖非 big + big。这是因为标记为 big 的 case 较大、耗时较长,默认不会执行。
++- --record:是否记录 results 结果,让其自动生成 `.results` 文件。
++- --nowarnings:忽略 warnings 错误。
++
++因为用例数目众多容易超时,建议依次测试每个用例集,修改mtr文件的`@DEFAULT_SUITES`即可。
++
++### 2.4 测试信息
++
++本节描述被测对象的版本信息和测试的时间及测试轮次,包括依赖的硬件。
++
++| 被测软件版本       | 系统版本        | 硬件信息 | 硬件配置信息  | 测试起始时间 | 测试结束时间 |
++| ------------------ | --------------- | -------- | ------------- | ------------ | ------------ |
++| GreatSQL-8.0.32-25 | openEuler 24.03 | x86      | 8核心 32G内存 | 2024-09-11   | 2024-09-30   |
++|                    | openEuler 23.09 | riscv64  | 8核心 16G内存 |              |              |
++
++## 3. 测试结果
++
++### 3.1 概述
++
++本次对`GreatSQL-8.0.32-25`版本进行回归测试,共执行测试用例9507个。其中x86中通过6904个,riscv64中通过6875个。
++
++### 3.2 总览
++
++|                                 | x86 pass用例数 | riscv pass用例数 | x86 test文件个数 | riscv64 test文件个数 | riscv额外fail的用例数 | riscv额外fail的用例                                 |                                                     |                                      |                                   |                                |                                   |                        |
++| ------------------------------- | -------------- | ---------------- | ---------------- | -------------------- | --------------------- | --------------------------------------------------- | --------------------------------------------------- | ------------------------------------ | --------------------------------- | ------------------------------ | --------------------------------- | ---------------------- |
++| auth_sec                        | 1184           | 500              | 114              | 113                  | 1                     | plugin_auth_caching_sha2_password_digest_rounds_max |                                                     |                                      |                                   |                                |                                   |                        |
++| binlog                          |                |                  | 171              | 169                  | 2                     | binlog_reset_master_delete_file_failure             | percona_binlog_unsafe_limit                         |                                      |                                   |                                |                                   |                        |
++| binlog_nogtid                   |                |                  | 60               | 60                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| collations                      |                |                  | 32               | 32                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| connection_control              |                |                  | 9                | 9                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| encryption                      |                |                  | 10               | 10                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| funcs_2                         |                |                  | 3                | 3                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| gcol                            |                |                  | 36               | 36                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| gis                             |                |                  | 69               | 69                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| information_schema              |                | 152              | 9                | 9                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| innodb_fts                      |                |                  | 66               | 66                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| innodb_gis                      |                |                  | 41               | 40                   | 1                     | rtree_compress2                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| innodb_undo                     |                |                  | 39               | 39                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| innodb_zip                      |                |                  | 28               | 28                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| interactive_utilities           |                |                  | 3                | 3                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| json                            |                |                  | 19               | 19                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| opt_trace                       |                |                  | 28               | 28                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| parts                           |                | 86               | 95               | 90                   | 7                     | partition_alter1_1_2_innodb                         | partition_alter1_2_innodb                           | partition_alter4_innodb              | partition_alter2_2_2_innodb       | part_supported_sql_func_innodb | partition_alter4_innodb           | partition_basic_innodb |
++| query_rewrite_plugins           |                | 38               | 38               | 38                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| secondary_engine                |                | 36               | 19               | 19                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| service_status_var_registration |                |                  | 5                | 5                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| service_sys_var_registration    |                |                  | 9                | 9                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| service_udf_registration        |                |                  | 9                | 9                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| test_service_sql_api            |                | 94               | 25               | 25                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| test_services                   |                |                  | 15               | 15                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| component_keyring_file          |                |                  | 60               | 60                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| audit_log                       |                |                  | 22               | 22                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| binlog_57_decryption            |                |                  | 2                | 2                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| percona-pam-for-mysql           |                | 16               | 2                | 0(没有该文件夹)    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| data_masking                    |                |                  | 14               | 14                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| procfs                          |                |                  | 1                | 1                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| rocksdb_sys_vars                |                |                  | 170              | 170                  |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| rocksdb_stress                  |                |                  | 3                | 3                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| rpl_encryption                  |                | 35               | 3                | 3                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| tokudb_add_index                |                |                  | 29               | 29                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| tokudb_perfschema               |                |                  | 3                | 3                    |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| audit_null                      |                |                  | 14               | 14                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| engines/iuds                    |                |                  | 16               | 16                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| funcs_1                         |                | 108              | 121              | 121                  |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| jp                              |                | 112              | 111              | 111                  |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| stress                          |                | 3                | 5                | 2                    | 3                     | ddl_innodb                                          | ddl_memory                                          | ddl_myisam                           |                                   |                                |                                   |                        |
++| group_replication               | 473            | 472              | 831              | 830                  | 1                     | gr_ssl_mode_tls_source_incompatible_certificates    |                                                     |                                      |                                   |                                |                                   |                        |
++| federated                       | 300            | 9                | 14               | 14                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| engines/funcs                   |                | 289              | 291              | 288                  | 3                     | ta_add_column_first                                 | ta_add_column                                       | ta_add_column_middle                 |                                   |                                |                                   |                        |
++| clone                           | 88             | 88               | 79               | 79                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| binlog_gtid                     |                |                  | 74               | 74                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| tokudb_parts                    |                |                  | 54               | 54                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| tokudb_bugs                     |                |                  | 125              | 125                  |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| tokudb_alter_table              |                |                  | 69               | 69                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| tokudb                          | 1              | 1                | 276              | 276                  |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| tokudb_rpl                      |                |                  | 70               | 70                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| sysschema                       | 840            | 88               | 90               | 90                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| sys_vars                        |                | 751              | 841              | 839                  | 2                     | myisam_data_pointer_size_func                       | persisted_sysvars_with_aliases                      |                                      |                                   |                                |                                   |                        |
++| rpl_nogtid                      | 421            | 235              | 187              | 181                  | 6                     | rpl_mixed_mixing_engines                            | rpl_stm_mixing_engines                              | rpl_non_direct_mixed_mixing_engines  | rpl_non_direct_row_mixing_engines | rpl_row_mixing_engines         | rpl_non_direct_stm_mixing_engines |                        |
++| rpl_gtid                        |                | 180              | 227              | 226                  | 1                     | mysqldump_bug33630199                               |                                                     |                                      |                                   |                                |                                   |                        |
++| rpl                             | 930            | 927              | 681              | 678                  | 3                     | rpl_semi_sync_alias                                 | rpl_shutdown_with_optimize_for_static_plugin_config | rpl_deprecations                     |                                   |                                |                                   |                        |
++| rocksdb_rpl                     | 1              | 1                | 52               | 52                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| rocksdb                         | 1              |                  | 330              | 330                  |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| perfschema                      | 613            | 613              | 749              | 749                  |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| parallel_query                  |                |                  | 42               | 42                   |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| main                            | 1319           | 1314             | 1649             | 1644                 | 5                     | percona_encryption_udf_dh_4096_ext                  | percona_encryption_udf_dsa_9984_ext                 | percona_encryption_udf_rsa_16384_ext | ds_mrr-big                        | greedy_optimizer               |                                   |                        |
++| innodb                          | 433            | 428              | 875              | 868                  | 6                     | analyze_table                                       | bug54330                                            | histogram                            | innochecksum_1                    | end_range_check                | innodb_autoextend_table_ddl       |                        |
++| x                               | 300            | 299              | 322              | 322                  |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++| 总通过数                        | 6904           | 6875             |                  |                      |                       |                                                     |                                                     |                                      |                                   |                                |                                   |                        |
++
++### 3.3 x86中fail的用例
++
++共失败51个用例。
++
++| 用例集                       | 错误用例                                                | 数量 |
++| ---------------------------- | ------------------------------------------------------- | ---- |
++| binlog_gtid                  | bug93631                                                | 1    |
++| clone                        | remote_basic_replace                                    | 3    |
++|                              | remote_dml_replace                                      |      |
++|                              | remote_dml_upgrade                                      |      |
++| group_replication            | gr_clone_integration_error_fallback                     | 18   |
++|                              | gr_clone_integration_basics_with_ssl_mysql              |      |
++|                              | gr_clone_integration_clone_operations_on_running_member |      |
++|                              | gr_clone_integration_different_recovery_user            |      |
++|                              | gr_clone_integration_no_privileges                      |      |
++|                              | gr_clone_integration_purged_donor                       |      |
++|                              | gr_clone_with_consistency_after                         |      |
++|                              | gr_recovery_endpoints_iterate_list_clone                |      |
++|                              | gr_recovery_endpoints_no_fallback                       |      |
++|                              | gr_clone_applier_reset                                  |      |
++|                              | gr_clone_integration_recovery_priv_user_preservation    |      |
++|                              | gr_recovery_endpoints_ipv6_ipv4                         |      |
++|                              | gr_start_gr_credential_options_clone                    |      |
++|                              | gr_autorejoin_with_clone_while_recovery_locked          |      |
++|                              | gr_clone_integration_basics                             |      |
++|                              | gr_clone_integration_clone_on_server_start              |      |
++|                              | gr_recovery_endpoints_multiple_valid                    |      |
++|                              | gr_view_changes                                         |      |
++| x                            | notices_gr_single_primary                               | 3    |
++|                              | connection_unixsocket_invalid                           |      |
++|                              | resource_groups                                         |      |
++| audit_null                   | audit_plugin_2                                          | 3    |
++|                              | authentication_abort                                    |      |
++|                              | authentication_abort_ps                                 |      |
++| binlog_nogtid                | binlog_persist_only_variables                           | 2    |
++|                              | binlog_persist_variables                                |      |
++| service_sys_var_registration | sys_var_service_errors                                  | 1    |
++| test_services                | test_host_application_signal_plugin                     | 1    |
++| component_keyring_file       | migration                                               | 1    |
++| rpl                          | rpl_flush_logs                                          | 4    |
++|                              | percona_bug1008278                                      |      |
++|                              | rpl_cloned_slave_relay_log_info                         |      |
++|                              | rpl_slave_start_after_clone                             |      |
++| rpl_gtid                     | rpl_pump                                                | 2    |
++|                              | rpl_gtid_only_start_replica_after_clone                 |      |
++| rpl_nogtid                   | rpl_binlog_sql_mode                                     | 2    |
++|                              | rpl_assign_gtids_to_anonymous_transactions_clone        |      |
++| sys_vars                     | lc_time_names_basic                                     | 2    |
++|                              | log_error_services_basic                                |      |
++| rocksdb                      | show_table_status                                       | 3    |
++|                              | rocksdb_icp                                             |      |
++|                              | rocksdb_icp_rev                                         |      |
++| main                         | admin_interface                                         | 4    |
++|                              | percona_encryption_udf_dh_4096                          |      |
++|                              | multiaddress_bind                                       |      |
++|                              | parser-big-64bit                                        |      |
++| innodb                       | innodb_bug14704286                                      | 1    |
++
++### 3.4 riscv64额外fail的用例
++
++共失败41个用例。
++
++| 用例集            | 错误用例                                            | 数量 |
++| ----------------- | --------------------------------------------------- | ---- |
++| binlog            | binlog_reset_master_delete_file_failure             | 2    |
++|                   | percona_binlog_unsafe_limit                         |      |
++| auth_sec          | plugin_auth_caching_sha2_password_digest_rounds_max | 1    |
++| stress            | ddl_myisam                                          | 1    |
++| innodb_gis        | rtree_compress2                                     | 1    |
++| parts             | partition_alter1_1_2_innodb                         | 7    |
++|                   | partition_alter1_2_innodb                           |      |
++|                   | partition_alter4_innodb                             |      |
++|                   | partition_alter2_2_2_innodb                         |      |
++|                   | part_supported_sql_func_innodb                      |      |
++|                   | partition_alter4_innodb                             |      |
++|                   | partition_basic_innodb                              |      |
++| stress            | ddl_innodb                                          | 2    |
++|                   | ddl_memory                                          |      |
++| group_replication | gr_ssl_mode_tls_source_incompatible_certificates    | 1    |
++| engines.funcs     | ta_add_column_first                                 | 3    |
++|                   | ta_add_column                                       |      |
++|                   | ta_add_column_middle                                |      |
++| sys_vars          | myisam_data_pointer_size_func                       | 2    |
++|                   | persisted_sysvars_with_aliases                      |      |
++| rpl_gtid          | mysqldump_bug33630199                               | 1    |
++| rpl_nogtid        | rpl_mixed_mixing_engines                            | 6    |
++|                   | rpl_stm_mixing_engines                              |      |
++|                   | rpl_non_direct_mixed_mixing_engines                 |      |
++|                   | rpl_non_direct_row_mixing_engines                   |      |
++|                   | rpl_row_mixing_engines                              |      |
++|                   | rpl_non_direct_stm_mixing_engines                   |      |
++| rpl               | rpl_semi_sync_alias                                 | 3    |
++|                   | rpl_shutdown_with_optimize_for_static_plugin_config |      |
++|                   | rpl_deprecations                                    |      |
++| innodb            | analyze_table                                       | 6    |
++|                   | bug54330                                            |      |
++|                   | histogram                                           |      |
++|                   | innochecksum_1                                      |      |
++|                   | end_range_check                                     |      |
++|                   | innodb_autoextend_table_ddl                         |      |
++| main              | percona_encryption_udf_dh_4096_ext                  | 5    |
++|                   | percona_encryption_udf_dsa_9984_ext                 |      |
++|                   | percona_encryption_udf_rsa_16384_ext                |      |
++|                   | ds_mrr-big                                          |      |
++|                   | greedy_optimizer                                    |      |
++
++### 3.5 分析
++
++观察实验结果,我们发现一个test文件一般对应一个测试用例,但也可能一个test文件包含多个测试用例,比如rpl中通过用例数大于文件数;此外x86和riscv64通过用例的差值并不等于riscv64中额外fail的用例,这说明对于相同的用例,可能在一个环境中skip/disabled但没有fail,在另一个环境中pass了。
++
++fail用例的出错原因大多因为配置不完整,本测试基于单机器,没有配置好master/slave主从节点,但部分测试与主从复制有关,有对应的master/slave.opt文件;此外还包含本身预期失败的用例,目的是验证测试框架对异常测例的识别能力。对于riscv64额外报错的用例,我们尚在排查,报错如Cannot connect to mysql group replication instance、Can't connect to local MySQL server through socket,大概率和配置文件有关。
++
++### 3.6 测试结论
++
++本次MTR测试共执行用例9507个。其中x86中通过6904个,riscv64中通过了6875个,是x86的99.5%。虽然暂时有额外的出错用例未排查出出错原因,但比例很小,不影响大部分基本功能的使用,所以认为通过。
++
++## 4. 参考
++
++[GreatSQL 8.0.25-16通过MTR回归测试](https://gitee.com/src-openeuler/greatsql/blob/master/greatsql-802516-mtr-passed.md)
++
++[MySQL Test Run 测试框架介绍](https://mp.weixin.qq.com/s/JA5hfaZuRMPFa7LmLUvfbQ)
++
++[Introduction to the MySQL Test Framework](https://dev.mysql.com/doc/dev/mysql-server/latest/PAGE_INTRODUCTION.html)
++
++
++
+diff --git a/storage/ndb/include/portlib/mt-asm.h b/storage/ndb/include/portlib/mt-asm.h
+index 418b8d9c711..f64ea6fab3a 100644
+--- a/storage/ndb/include/portlib/mt-asm.h
++++ b/storage/ndb/include/portlib/mt-asm.h
+@@ -83,6 +83,19 @@ cpu_pause()
+ }
+ #endif
+ 
++#elif defined(__riscv)
++
++#define NDB_HAVE_MB
++#define NDB_HAVE_RMB
++#define NDB_HAVE_WMB
++
++#define RISCV_FENCE(p, s) \
++	__asm__ __volatile__ ("fence " #p "," #s : : : "memory")
++
++#define mb()		RISCV_FENCE(iorw,iorw)
++#define rmb()		RISCV_FENCE(ir,ir)
++#define wmb()	RISCV_FENCE(ow,ow)
++
+ #elif defined(__sparc__)
+ 
+ #define NDB_HAVE_MB
+diff --git "a/\345\234\250OpenEuler RISC-V\347\216\257\345\242\203\344\270\213\346\272\220\347\240\201\347\274\226\350\257\221\345\256\211\350\243\205GreatSQL.md" "b/\345\234\250OpenEuler RISC-V\347\216\257\345\242\203\344\270\213\346\272\220\347\240\201\347\274\226\350\257\221\345\256\211\350\243\205GreatSQL.md"
+new file mode 100644
+index 00000000000..3d4ce63d0c9
+--- /dev/null
++++ "b/\345\234\250OpenEuler RISC-V\347\216\257\345\242\203\344\270\213\346\272\220\347\240\201\347\274\226\350\257\221\345\256\211\350\243\205GreatSQL.md"	
+@@ -0,0 +1,513 @@
++# 在OpenEuler RISC-V环境下源码编译安装GreatSQL
++
++本文介绍如何在OpenEuler RISC-V环境下源码编译安装GreatSQL,并通过常规的MTR测试用例。
++
++## 1. **准备**openEuler RISC-V 23.09 环境
++
++根据[安装指导](https://docs.openeuler.org/zh/docs/23.09/docs/Installation/riscv_qemu.html),使用Qemu安装openEuler RISC-V 23.09(含全量软件源)。运行环境如下:
++
++```shell
++$ lscpu
++Architecture: riscv64
++  Byte Order: Little Endian
++CPU(s): 8
++  On-line CPU(s) list:0-7
++NUMA:
++  NUMA node(s): 1
++  NUMA node0 CPU(s):0-7
++$ cat /etc/os-release
++NAME="openEuler"
++VERSION="23.09"
++ID="openEuler"
++VERSION_ID="23.09"
++PRETTY_NAME="openEuler 23.09"
++ANSI_COLOR="0;31"
++```
++
++## 2. 编译前准备工作
++
++提前安装必要的一些基础包
++
++```shell
++$ dnf makecache
++$ dnf install -y automake bison bison-devel boost-devel bzip2 bzip2-devel clang cmake cmake3 diffutils expat-devel file flex gcc gcc-c++ git jemalloc jemalloc-devel graphviz libaio-devel libarchive libcurl-devel libevent-devel libffi-devel libicu-devel libssh libtirpc libtirpc-devel libtool libxml2-devel libzstd libzstd-devel lz4-devel lz4-static make ncurses-devel ncurses-libs net-tools numactl numactl-devel numactl-libs openldap-clients openldap-devel openssl openssl-devel pam pam-devel perl perl-Env perl-JSON perl-Memoize perl-Time-HiRes pkg-config psmisc re2-devel readline-devel snappy-devel tar time unzip vim wget zlib-devel
++```
++
++然后进入/opt文件夹,使用curl下载boost/patchelf//rpcsvc-proto三个依赖包和greatesql-8.0.32-25源码包,并解压到当前文件夹:
++
++```shell
++$ curl -o boost_1_77_0.tar.gz -L https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz  
++$ tar zxvf boost_1_77_0.tar.gz
++$ curl -o patchelf-0.14.5.tar.gz -L https://github.com/NixOS/patchelf/releases/download/0.14.5/patchelf-0.14.5.tar.gz
++$ tar zxvf patchelf-0.14.5.tar.gz && cd patchelf-0.14.5 && ./bootstrap.sh && ./configure && make && make install
++$ curl -o rpcsvc-proto-1.4.tar.gz -L https://github.com/thkukuk/rpcsvc-proto/releases/download/v1.4/rpcsvc-proto-1.4.tar.gz
++$ tar zxvf rpcsvc-proto-1.4.tar.gz && cd rpcsvc-proto-1.4/ && ./configure && make && make install
++$ curl -o greatsql-8.0.32-25.tar.xz -L https://product.greatdb.com/GreatSQL-8.0.32-25/greatsql-8.0.32-25.tar.xz
++$ tar Jcvf greatsql-8.0.32-25.tar.xz
++```
++
++确定glibc和gcc版本:
++
++```shell
++$ gcc --version
++gcc (GCC) 12.3.1 (openEuler 12.3.1-16.oe2309) 
++Copyright (C) 2022 Free Software Foundation, Inc.
++This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++$ ldd --version
++ldd (GNU libc) 2.38
++Copyright (C) 2022 Free Software Foundation, Inc.
++This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++```
++
++## 3. 编译GreatSQL
++
++在开始编译前,需要修改一处GreatSQL源码,使用FENCE指令添加[RISCV的内存屏障](https://blog.csdn.net/u011011827/article/details/124563277#RISCVCPU_135):
++
++```c
++$ vim /opt/greatsql-8.0.32-25/storage/ndb/include/portlib/mt-asm.h
++#if defined(HAVE_PAUSE_INSTRUCTION) // 第68行
++...
++#else // 第76行
++...
++#endif // 第84行
++// 添加以下代码
++#elif defined(__riscv)
++
++#define NDB_HAVE_MB
++#define NDB_HAVE_RMB
++#define NDB_HAVE_WMB
++
++#define RISCV_FENCE(p, s) \
++	__asm__ __volatile__ ("fence " #p "," #s : : : "memory")
++
++#define mb()		RISCV_FENCE(iorw,iorw)
++#define rmb()		RISCV_FENCE(ir,ir)
++#define wmb()		RISCV_FENCE(ow,ow)
++
++#elif defined(__sparc__) // 第99行
++```
++
++随后源码编译二进制文件包:
++
++```shell
++$ cd /opt/greatsql-8.0.32-25 && \
++rm -fr bld && \
++mkdir bld && \
++cd bld && \
++cmake .. -DBOOST_INCLUDE_DIR=/opt/boost_1_77_0 \
++-DLOCAL_BOOST_DIR=/opt/boost_1_77_0 \
++-DCMAKE_INSTALL_PREFIX=/usr/local/GreatSQL-8.0.32-25 \
++-DWITH_ZLIB=bundled \
++-DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release \
++-DWITH_TOKUDB=OFF \
++-DWITH_ROCKSDB=OFF \
++-DCOMPILATION_COMMENT="GreatSQL (GPL)" \
++-DMAJOR_VERSION=8 \
++-DMINOR_VERSION=0 \
++-DPATCH_VERSION=32 \
++-DWITH_UNIT_TESTS=OFF \
++-DWITH_NDBCLUSTER=OFF \
++-DWITH_SSL=system \
++-DWITH_SYSTEMD=ON \
++-DWITH_AUTHENTICATION_LDAP=OFF \
++&& make -j16 VERBOSE=1 && make install
++```
++
++参数 *-j16* 设定为并行编译的逻辑CPU数量,可以指定为比逻辑CPU总数少一点,不要把所有CPU都跑满。如果并行产生难以解决的报错,那就使用`make`串行编译。
++
++编译完成后,就会将二进制文件安装到 */usr/local/GreatSQL-8.0.32-25* 目录下。
++
++因为openEuler RISC-V安装时空间默认大小为20G,在`make install`时会有内存不足的问题,注意需要进行虚拟机扩容。
++
++## 4.  安装GreatSQL
++
++### 4.1 配置GreatSQL systemd服务
++
++```ini
++$ vim /lib/systemd/system/greatsql.service
++
++[Unit]
++Description=GreatSQL Server
++Documentation=man:mysqld(8)
++Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
++After=network.target
++After=syslog.target
++[Install]
++WantedBy=multi-user.target
++[Service]
++
++# some limits
++# file size
++LimitFSIZE=infinity
++# cpu time
++LimitCPU=infinity
++# virtual memory size
++LimitAS=infinity
++# open files
++LimitNOFILE=65535
++# processes/threads
++LimitNPROC=65535
++# locked memory
++LimitMEMLOCK=infinity
++# total threads (user+kernel)
++TasksMax=infinity
++TasksAccounting=false
++
++User=mysql
++Group=mysql
++#如果是GreatSQL 5.7版本,此处需要改成simple模式,否则可能服务启用异常
++#如果是GreatSQL 8.0版本则可以使用notify模式
++#Type=simple
++Type=notify
++TimeoutSec=0
++PermissionsStartOnly=true
++ExecStartPre=/usr/local/GreatSQL-8.0.32/bin/mysqld_pre_systemd
++ExecStart=/usr/local/GreatSQL-8.0.32-25/bin/mysqld $MYSQLD_OPTS
++EnvironmentFile=-/etc/sysconfig/mysql
++LimitNOFILE = 10000
++Restart=on-failure
++RestartPreventExitStatus=1
++Environment=MYSQLD_PARENT_PID=1
++PrivateTmp=false
++```
++
++务必确认文件中目录及文件名是否正确。
++
++执行命令`systemctl daemon-reload`重载systemd,加入 `greatsql` 服务,如果没问题就不会报错。
++
++### 4.2 编辑GreatSQL全局配置文件 `/etc/my.cnf`
++
++参考my.cnf模板[my.cnf for GreatSQL 8.0.32-25](https://gitee.com/GreatSQL/GreatSQL-Doc/blob/master/docs/my.cnf-example-greatsql-8.0.32-25),并根据实际情况做些适当调整。本次使用的服务器内存有限,所以修改了*basedir/datadir/innodb_buffer_pool_size* 等几个选项,不然启动GreatSQL会因闪退等问题而失败。
++
++```ini
++[client]
++socket    = /data/GreatSQL/mysql.sock
++[mysql]
++loose-skip-binary-as-hex
++prompt = "(\\D)[\\u@GreatSQL][\\d]>"
++no-auto-rehash
++[mysqld]
++user    = mysql
++port    = 3306
++server_id = 3306
++basedir = /usr/local/GreatSQL-8.0.32-25
++datadir    = /data/GreatSQL
++socket    = /data/GreatSQL/mysql.sock
++pid-file = mysql.pid
++character-set-server = UTF8MB4
++skip_name_resolve = 1
++#若你的MySQL数据库主要运行在境外,请务必根据实际情况调整本参数
++default_time_zone = "+8:00"
++bind_address = "0.0.0.0"
++
++#performance setttings
++lock_wait_timeout = 3600
++open_files_limit    = 65535
++back_log = 1024
++max_connections = 1024
++max_connect_errors = 1000000
++table_open_cache = 2048
++table_definition_cache = 2048
++sort_buffer_size = 4M
++join_buffer_size = 4M
++read_buffer_size = 8M
++read_rnd_buffer_size = 4M
++bulk_insert_buffer_size = 64M
++thread_cache_size = 768
++interactive_timeout = 600
++wait_timeout = 600
++tmp_table_size = 96M
++max_heap_table_size = 96M
++max_allowed_packet = 64M
++net_buffer_shrink_interval = 180
++#GIPK
++loose-sql_generate_invisible_primary_key = ON
++
++#log settings
++log_timestamps = SYSTEM
++log_error = /data/GreatSQL/error.log
++log_error_verbosity = 3
++slow_query_log = 1
++log_slow_extra = 1
++slow_query_log_file = /data/GreatSQL/slow.log
++#设置slow log文件大小1G及总文件数10
++max_slowlog_size = 1073741824
++max_slowlog_files = 10
++long_query_time = 0.01
++log_queries_not_using_indexes = 1
++log_throttle_queries_not_using_indexes = 60
++min_examined_row_limit = 100
++log_slow_admin_statements = 1
++log_slow_slave_statements = 1
++log_slow_verbosity = FULL
++log_bin = /data/GreatSQL/binlog
++binlog_format = ROW
++sync_binlog = 1
++binlog_cache_size = 4M
++max_binlog_cache_size = 6G
++max_binlog_size = 1G
++#控制binlog总大小,避免磁盘空间被撑爆
++binlog_space_limit = 100G #这里改小了
++binlog_rows_query_log_events = 1
++binlog_expire_logs_seconds = 604800
++binlog_checksum = CRC32
++gtid_mode = ON
++enforce_gtid_consistency = TRUE
++
++#myisam settings
++key_buffer_size = 16K #这里改小了
++myisam_sort_buffer_size = 128M
++
++#replication settings
++relay_log_recovery = 1
++slave_parallel_type = LOGICAL_CLOCK
++#并行复制线程数可以设置为逻辑CPU数量的2倍
++slave_parallel_workers = 64
++binlog_transaction_dependency_tracking = WRITESET
++slave_preserve_commit_order = 1
++slave_checkpoint_period = 2
++
++#启用InnoDB并行查询优化功能
++loose-force_parallel_execute = OFF
++#设置每个SQL语句的并行查询最大并发度
++loose-parallel_default_dop = 8
++#设置系统中总的并行查询线程数,可以和最大逻辑CPU数量一样
++loose-parallel_max_threads = 64
++#并行执行时leader线程和worker线程使用的总内存大小上限,可以设置物理内存的5-10%左右
++loose-parallel_memory_limit = 2G #这里改小了
++
++#parallel load data
++loose-gdb_parallel_load_chunk_size = 4M
++
++#rapid engine
++loose-rapid_memory_limit = 12G
++loose-rapid_worker_threads = 32
++loose-rapid_hash_table_memory_limit = 30
++loose-secondary_engine_parallel_load_workers = 16
++
++#mgr settings
++loose-plugin_load_add = 'mysql_clone.so'
++loose-plugin_load_add = 'group_replication.so'
++loose-group_replication_group_name = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa1"
++#MGR本地节点IP:PORT,请自行替换
++loose-group_replication_local_address = "172.16.16.10:33061"
++#MGR集群所有节点IP:PORT,请自行替换
++loose-group_replication_group_seeds = '172.16.16.10:33061,72.16.16.12:33061,72.16.16.12:33061'
++loose-group_replication_start_on_boot = ON
++loose-group_replication_bootstrap_group = OFF
++loose-group_replication_exit_state_action = READ_ONLY
++loose-group_replication_flow_control_mode = "DISABLED"
++loose-group_replication_single_primary_mode = ON   
++loose-group_replication_enforce_update_everywhere_checks=0
++loose-group_replication_majority_after_mode = ON
++loose-group_replication_communication_max_message_size = 10M
++loose-group_replication_arbitrator = 0
++loose-group_replication_single_primary_fast_mode = 1
++loose-group_replication_request_time_threshold = 100
++loose-group_replication_primary_election_mode = GTID_FIRST
++loose-group_replication_unreachable_majority_timeout = 0
++loose-group_replication_member_expel_timeout = 5
++loose-group_replication_autorejoin_tries = 288
++loose-group_replication_recovery_get_public_key = ON
++
++#mgr vip
++loose-plugin_load_add = 'greatdb_ha.so'
++loose-greatdb_ha_enable_mgr_vip = 0
++loose-greatdb_ha_mgr_vip_nic = 'eth0'
++loose-greatdb_ha_mgr_vip_ip = '172.16.0.252'
++loose-greatdb_ha_mgr_vip_mask = '255.255.255.0'
++loose-greatdb_ha_port = 33062
++loose-greatdb_ha_mgr_read_vip_ips = "172.16.0.251"
++#loose-greatdb_ha_mgr_read_vip_ips = "172.16.0.251,172.16.0.252"
++loose-greatdb_ha_mgr_read_vip_floating_type = "TO_ANOTHER_SECONDARY"
++loose-greatdb_ha_send_arp_packge_times = 5
++report_host = 172.16.0.10
++report_port = 3306
++
++#MGR切主后是否断开旧Priamry节点上的所有应用连接
++loose-greatdb_ha_mgr_exit_primary_kill_connection_mode = 0
++
++#innodb settings
++innodb_buffer_pool_size = 56M #这里改小了
++innodb_buffer_pool_instances = 8
++innodb_data_file_path = ibdata1:12M:autoextend
++innodb_flush_log_at_trx_commit = 1
++#innodb_log_buffer_size = 32M
++#innodb_log_file_size = 2G
++innodb_log_files_in_group = 3
++#innodb_redo_log_capacity = 6G
++innodb_doublewrite_files = 2
++#innodb_max_undo_log_size = 4G
++# 根据您的服务器IOPS能力适当调整
++# 一般配普通SSD盘的话,可以调整到 10000 - 20000
++# 配置高端PCIe SSD卡的话,则可以调整的更高,比如 50000 - 80000
++innodb_io_capacity = 4000
++innodb_io_capacity_max = 8000
++innodb_open_files = 65534
++#提醒:当需要用CLONE加密特性时,不要选用O_DIRECT模式,否则会比较慢
++innodb_flush_method = O_DIRECT
++innodb_lru_scan_depth = 4000
++innodb_lock_wait_timeout = 10
++innodb_rollback_on_timeout = 1
++innodb_print_all_deadlocks = 1
++#innodb_online_alter_log_max_size = 4G
++innodb_print_ddl_logs = 1
++innodb_status_file = 1
++innodb_status_output = 0
++innodb_status_output_locks = 1
++innodb_sort_buffer_size = 64M
++innodb_adaptive_hash_index = 0
++#开启NUMA支持
++innodb_numa_interleave = ON
++innodb_spin_wait_delay = 20
++innodb_print_lock_wait_timeout_info = 1
++#自动杀掉超过5分钟不活跃事务,避免行锁被长时间持有
++kill_idle_transaction = 300
++#异步清理大表
++innodb_data_file_async_purge = ON
++
++#innodb monitor settings
++#innodb_monitor_enable = "module_innodb,module_server,module_dml,module_ddl,module_trx,module_os,module_purge,module_log,module_lock,module_buffer,module_index,module_ibuf_system,module_buffer_page,module_adaptive_hash"
++
++#pfs settings
++performance_schema = 1
++#performance_schema_instrument = '%memory%=on'
++performance_schema_instrument = '%lock%=on'
++```
++
++### 4.3 新建mysql用户
++
++```shell
++$ /sbin/groupadd mysql
++$ /sbin/useradd -g mysql mysql -d /dev/null -s /sbin/nologin
++```
++
++### 4.4 新建datadir
++
++新建数据库主目录,并修改权限模式及属主:
++
++```shell
++$ mkdir -p /data/GreatSQL 
++$ chown -R mysql:mysql /data/GreatSQL
++$ chmod -R 700 /data/GreatSQL
++```
++
++## 5. 启动GreatSQL
++
++执行启动命令:`systemctl start greatsql`
++
++如果有报错,可用systemctl status greatsql 或journalctl 查看服务有关信息进行排错;如果有文件找不到的情况,可以手动加符号链接解决;修改后使用`systemctl restart greatsql`命令重启服务,注意datadir(如/data/GreatSQL)要清空。
++
++检查服务是否已启动,以及进程状态,正常启动的输出如下:
++
++```shell
++$ systemctl status greatsql
++● greatsql.service - GreatSQL Server
++   Loaded: loaded (/usr/lib/systemd/system/greatsql.service; disabled; vendor preset: disabled)
++   Active: active (running) since Wed 2024-08-13 07:58:14 CST; 9s ago
++     Docs: man:mysqld(8)
++           http://dev.mysql.com/doc/refman/en/using-systemd.html
++  Process: 21411 ExecStartPre=/usr/local/GreatSQL-8.0.32-25/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
++ Main PID: 21519 (mysqld)
++   Memory: 616.6M
++   CGroup: /system.slice/greatsql.service
++           └─21519 /usr/local/GreatSQL-8.0.32-25/bin/mysqld
++
++Aug 13 07:56:56 openeuler-riscv64 systemd[1]: Starting GreatSQL Server...
++Aug 13 07:58:14 openeuler-riscv64 systemd[1]: Started GreatSQL Server.
++```
++
++## 6. 登入GreatSQL与基本使用
++
++首次登入GreatSQL前,需要先找到初始化时随机生成的root密码:
++
++```shell
++$ grep root /data/GreatSQL/error.log
++[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: hl3XhIux8I>;
++```
++
++其中的 **hl3XhIux8I>;** 就是初始化时随机生成的密码,在登入GreatSQL时输入该密码:
++
++```shell
++$ mysql -uroot -p'hl3XhIux8I>;'
++mysql: [Warning] Using a password on the command line interface can be insecure.
++Welcome to the MySQL monitor.  Commands end with ; or \g.
++Your MySQL connection id is 12
++Server version: 8.0.32-25
++
++Copyright (c) 2021-2023 GreatDB Software Co., Ltd
++Copyright (c) 2009-2023 Percona LLC and/or its affiliates
++Copyright (c) 2000, 2023, Oracle and/or its affiliates.
++
++Oracle is a registered trademark of Oracle Corporation and/or its
++affiliates. Other names may be trademarks of their respective
++owners.
++
++Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
++
++[root@GreatSQL][(none)]>\s
++ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
++mysql>
++```
++
++首次登入立刻提醒该密码已过期,需要修改,执行类似下面的命令修改即可:
++
++```shell
++[root@GreatSQL][(none)]>ALTER USER USER() IDENTIFIED BY 'GreatSQL-8032~%';
++Query OK, 0 rows affected (0.21 sec)
++```
++
++之后就可以用这个新密码再次登入GreatSQL了。
++
++修改完root密码后,应尽快创建普通用户,用于数据库的日常使用,减少超级用户root的使用频率,避免误操作意外删除重要数据。
++
++```shell
++#创建一个新用户GreatSQL,只允许从192.168.0.0/16网络连入,密码是 GreatSQL-2022
++[root@GreatSQL][(none)]>CREATE USER GreatSQL@'192.168.0.0/16' IDENTIFIED BY 'GreatSQL-2022';
++Query OK, 0 rows affected (0.39 sec)
++
++#创建一个新的用户库,并对GreatSQL用户授予读写权限
++[root@GreatSQL][(none)]>CREATE DATABASE GreatSQL;
++Query OK, 1 row affected (0.15 sec)
++
++[root@GreatSQL][(none)]>GRANT ALL ON GreatSQL.* TO GreatSQL@'192.168.0.0/16';
++Query OK, 0 rows affected (0.07 sec)
++```
++
++切换到普通用户GreatSQL登入,创建测试表,写入数据:
++
++```shell
++$ mysql -h192.168.1.10 -uGreatSQL -p'GreatSQL-2022'
++...
++# 切换到GreatSQL数据库下
++[root@GreatSQL][(none)]>use GreatSQL;
++Database changed
++
++# 创建新表
++[root@GreatSQL][(GreatSQL)]>CREATE TABLE t1(id INT PRIMARY KEY);
++Query OK, 0 rows affected (0.68 sec)
++
++# 写入测试数据
++[root@GreatSQL][(GreatSQL)]>INSERT INTO t1 SELECT RAND()*1024;
++Query OK, 1 row affected (0.19 sec)
++Records: 1  Duplicates: 0  Warnings: 0
++
++# 查询数据
++[root@GreatSQL][(GreatSQL)]>SELECT * FROM t1;
+++-----+
++| id  |
+++-----+
++| 203 |
+++-----+
++1 row in set (0.01 sec)
++```
++
++成功。
++
++## 7. 参考文件
++
++1. [欧拉openEuler系统中使用二进制包安装GreatSQL](https://greatsql.cn/docs/8.0.32-25/4-install-guide/3-3-openeuler-install.html)
++2. [二进制包安装](https://greatsql.cn/docs/8.0.32-25/3-quick-start/3-2-quick-start-with-tarball.html)
++3. [在麒麟OS+龙芯环境下源码编译安装GreatSQL](https://gitee.com/GreatSQL/GreatSQL-Doc/blob/master/docs/build-greatsql-with-source-under-kylin-and-loongson.md#1)
++
++4. [openEuler、龙蜥Anolis、统信UOS系统下编译GreatSQL二进制包](https://gitee.com/GreatSQL/GreatSQL-Doc/blob/master/docs/build-greatsql-under-openeuler-anolis-uos.md)
+\ No newline at end of file
+-- 
+Gitee
+
+
+From 0b357fee5332e690b2084a99ea307e3f16c5dcbb Mon Sep 17 00:00:00 2001
+From: Sammmmy <843683531@qq.com>
+Date: Mon, 30 Sep 2024 12:52:35 +0000
+Subject: [PATCH 2/2] =?UTF-8?q?update=20storage/ndb/include/portlib/mt-asm?=
+ =?UTF-8?q?.h.=20=E4=BF=AE=E6=94=B9=E7=BC=A9=E8=BF=9B?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Sammmmy <843683531@qq.com>
+---
+ storage/ndb/include/portlib/mt-asm.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/storage/ndb/include/portlib/mt-asm.h b/storage/ndb/include/portlib/mt-asm.h
+index f64ea6fab3a..6697188eaf5 100644
+--- a/storage/ndb/include/portlib/mt-asm.h
++++ b/storage/ndb/include/portlib/mt-asm.h
+@@ -94,7 +94,7 @@ cpu_pause()
+ 
+ #define mb()		RISCV_FENCE(iorw,iorw)
+ #define rmb()		RISCV_FENCE(ir,ir)
+-#define wmb()	RISCV_FENCE(ow,ow)
++#define wmb()	    RISCV_FENCE(ow,ow)
+ 
+ #elif defined(__sparc__)
+ 
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0e758944..33c161bd 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -734,6 +734,7 @@ SET(KNOWN_64BIT_ARCHITECTURES
+   s390x
+   x86_64
+   sw_64
++  riscv64
+ )
+ 
+ # Include the platform-specific file. To allow exceptions, this code
+-- 
+Gitee
+
diff --git a/greatsql.spec b/greatsql.spec
index 5560c9c..932d810 100644
--- a/greatsql.spec
+++ b/greatsql.spec
@@ -32,7 +32,7 @@
 %global greatsql_version 26
 %global revision a68b3034c3d
 %global tokudb_backup_version %{mysql_version}-%{greatsql_version}
-%global rpm_release 2
+%global rpm_release 3
 
 %global release %{greatsql_version}.%{rpm_release}%{?dist}
 
@@ -124,6 +124,7 @@ SOURCE90:       filter-provides.sh
 SOURCE91:       filter-requires.sh
 SOURCE11:       mysqld.cnf
 Patch0:         mysql-5.7-sharedlib-rename.patch
+Patch1:         add-riscv64-support.patch
 BuildRequires:  cmake >= 2.8.2
 BuildRequires:  make
 BuildRequires:  gcc
@@ -401,6 +402,7 @@ cat %{SOURCE101} %{SOURCE102} %{SOURCE103} %{SOURCE104} %{SOURCE105} %{SOURCE106
 %setup -q -T -a 0 -a 10 -c -n %{src_dir}
 pushd %{src_dir}
 %patch0 -p0
+%patch1 -p1
 cp %{SOURCE11} scripts
 
 %build
@@ -1097,7 +1099,9 @@ fi
 %attr(644, root, root) %{_mandir}/man1/comp_err.1*
 %attr(644, root, root) %{_mandir}/man1/mysql_config.1*
 %attr(755, root, root) %{_bindir}/mysql_config
+%ifarch %{multiarchs}
 %attr(755, root, root) %{_bindir}/mysql_config-%{__isa_bits}
+%endif
 %{_includedir}/mysql
 %{_datadir}/aclocal/mysql.m4
 %{_libdir}/mysql/lib%{shared_lib_pri_name}.a
@@ -1339,6 +1343,10 @@ fi
 %{_libdir}/mysql/private/icudt69l/brkitr
 
 %changelog
+* Tue Nov 26 2024 laokz <zhangkai@iscas.ac.cn> - 8.0.32-26.3
+- Add riscv64 patch
+- Add missed condition of packaging mysql_config-%{__isa_bits}
+
 * Wed Sep 11 2024 GreatSQL <greatsql@greatdb.com> - 8.0.32-26.2
 - Fix the issue of missing audit and datamask plugin files for GreatSQL-8.0.32-26.2
 
-- 
Gitee