Skip to content

Commit

Permalink
feat(tianmu): merge to Stonedb 5.7 stable (#1915)
Browse files Browse the repository at this point in the history
* docs(downlaod):update the docs of download(#1453)

* fix(mtr):Resolve the nightly run error problem(#1458)

* fix(workflow): fix can not run lcov in workflow

* feat(tianmu):New configuration parameters: "tianmu_mandatory" and "tianmu_no_key_error (#1462)"
In version 1.0.4, we will discard "MANDATORY_TIANMU" and "NO_KEY_ERROR" in (sql_mode)

Specifies whether to enable mandatory Tianmu engine in table. if yes ,set tianmu_mandatory to ON, otherwise set the variable to OFF.
Specifies whether to to directly skip DDL statements that are not supported by the SQL layer, instead of reporting errors.
if yes ,set tianmu_no_key_error to ON, otherwise set the variable to OFF.

* feat(tianmu):Discard "MANDATORY_TIANMU" and "NO_KEY_ERROR" in (sql_mode)

* feat(tianmu):Resolve the issue of warning messages when setting new parameters

* fix(tianmu):(Primary/Secondary)Error 1032 occasionally occurs during primary/secondary synchronization if UUIDs are used as the primary key(#1464)

Cause of the problem:
When performing a primary key scan under the master slave, "ha_tianmu:: position()" is called first to obtain the primary key value from the "record",
However, in this scenario, after calling the "key_copy()" function, the "record" will be cleared, resulting in the subsequent "GetKeys()" obtaining a null primary key value.
Solution:
Because the value "handler->ref" is not used in the future, you can simply delete the call to "key_copy()".

* test(mtr): add integer/unsigned/in subquery/create temporary testcases and update escape.test(#1196)

* docs(v1.0.3): update the docs for v1.0.3

* fix(dcoker): FixDocker deployment commands(#1499)

* feat: add Baidu statistics script(#1498)

* fix(website): fix Baidu statistics script(#1502)

* test(mtr): Optimize parallel scheduling to execute more innodb engine testcases, add date type and std func testcase(#1196)

* fix crash when the aggregated element was decimal (#1402)
    1. Fix the crash first
    2. then redesign the entire aggregated data stream

* build(deps): bump nth-check and unist-util-select in /website

Bumps [nth-check](https://github.com/fb55/nth-check) to 2.1.1 and updates ancestor dependency [unist-util-select](https://github.com/syntax-tree/unist-util-select). These dependencies need to be updated together.


Updates `nth-check` from 1.0.2 to 2.1.1
- [Release notes](https://github.com/fb55/nth-check/releases)
- [Commits](fb55/nth-check@v1.0.2...v2.1.1)

Updates `unist-util-select` from 2.0.2 to 4.0.1
- [Release notes](https://github.com/syntax-tree/unist-util-select/releases)
- [Commits](syntax-tree/unist-util-select@2.0.2...4.0.1)

---
updated-dependencies:
- dependency-name: nth-check
  dependency-type: indirect
- dependency-name: unist-util-select
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* docs(deploy): Update the document and fix the link

* update the copyright

* update the readme(#1324)

* Create FUNDING.yml

update the Sponsor button

* Update FUNDING.yml

fix the link of opencollective

* remove dup lines in git workflow

* feat(tianmu): mv func from public to protected(#1501)

* style change

* strip spaces

* remove dup lines

* change to uint

* fix(tianmu):Resolve DDL and insert inot select Possible space inflation issues(#366)

Cause of the problem:
1. For multiple versions, Tianmu needs to first copy an original pack when performing DML operations,
Modify the copied package and use append write or overwrite write after modification
(If there is invalid space in the DATA file that can be written to the current pack, use overwrite write, otherwise use append write) to write to the file,
After the latest package is written to a file, the latest version chain will point to the address that was last written.
There is a problem with the current (TianmuAttr:: LoadData) logic. Every time you call (TianmuAttr:: LoadData),
Will write data to disk,
If there are multiple rows written in a transaction, there will be multiple copies of data,
"Because the current transaction has not been committed, the space for previous repeated writes has not been released, so the logic of overwriting writes will not be reached.",
"I only follow the logic of additional writing, which is the fundamental reason for the skyrocketing space.".
If you encounter a particularly large multiline write transaction, it will lead to a space explosion.
Moreover, disk IO is performed once per load line, which can also lead to degraded insert performance.
Solution:
To optimize the logic of (TianmuAttr:: LoadData), it is necessary to determine whether the data in the pack is full before saving changes,
Is whether to reach 65536 lines, and if so, write again,
If it cannot be reached, it is necessary to write again in the commit phase.

* feat(tianmu):Reconstruct direct insert into parallel execution, improving direct insert performance.

* feat(tianmu):Add code comments for easy understanding

* fix(tianmu):The myloader cann't work if the autocommit is closed. (#1510)

Currently, TIANMU does not support manual transactions and only supports automatic commit.
However, it does determine whether to commit the transaction based on the automatic commit parameters of MySQL.
If automatic commit is turned off, automatic commit will not be performed on the transaction

* fix(core): fix bug: The instance occasionally crashes if both fields specified for an equi-join are of the string data types (#1476)

* fix: page hover font style

* feat(mtr): To fix the mtr usage

The disabeld mtr use cases should follow the mtr conventional rules.
Adds a disabled.def to indeciate which case is disabled or not.

* fix(tianmu):The mysqld is crashed when you are starting replication.(#1523)

It is possible to update null values with null values in the delta layer,
For example:
update t set name="xiaohua" where id=1;
update t set name=null where id=1;
So when encountering this situation, directly return

* feat(tianmu):Add delta layer mtr

* bug 1538:The instance occasionally crashes when the parallel degree is enabled of the right table #1538

* feat(tianmu): To support vocalno framwork

The PRs to support vocalno framwork include a serials of PR.
Part1: Refine framework of code to make it clean and clear to read.

* docs(quickstart): add stonedb-8.0 compiling guide #1449

* fix(website): fix website error #1449

* feat(tianmu): support volcano framewrok (#1546)

* feat(tianmu): To support volcano framework

This is a serial of PRs, part2: To remove global var `ha_kvstore`, which should be in an engine.
To support volcano framework. and In order to do that, at secondly, ha_kvstore_,
a global variable removed to the engine. That follows innodb conventional rules.

* fix(tianmu): revert code, mv ret value from try block back to catch block

[summary]

The logic of this modification is as follows:
Previously, set ret action has been moved to try block, which is not efficient because every time we do truncate success, ret will be setted to 1. This time we will move the set ret action back to catch block, which will only trigged when truncate failed.

* feat(tiamnu): hard code in defs.h (#1481)
change magic number to readable const

* docs:update the compile guides #1562

* test(mtr): add more innodb testcases and tianmu range testcase(#1196)

* fix(tianmu):Remove excess log printing and add some code comments(#1545)

* fix(tianmu): fix mysqld crash when exec query with AggregateRough, assert failed on i < m_idx.size() at tianmu_attr.h:387, msg: [bad dpn index 0/0] (#1580)

* fix(website): fix the download link of 5.7(#1518)

* feat(website): update the latest content(#1587)

* feat(tianmu): support volcano framework (#1554)

Part3: To remove the `ha_tianmu_engine`, and gets it from hton's data. This makes
it behavior just like innodb.  MySQL gets innodb handler instance from table->s->file.
and it will make the code logic more concise.

* fix: max-width navbar search style

* feat(website): upgrade the docusaurus version(#1604)
fix #1604

* fix(website): fix Roadmap module location(#1597)

* website(community): update the content

* feat(website): update the logo of XinChuang(#1590)

* fix(tianmu):The instance occasionally crashes when the memory leak. (#1549)

* fix(tianmu):Modify merge_ The assignment method of ID, delaying the assignment to ensure that the final value is correct

* fix(tianmu):Fix bug in delta layer initialization

* fix(tianmu):Resolve the issue of assertion failure caused by memory allocation bugs in (pack_int)

* fix(tianmu):Code format adjustment

* fix(website): fix the wrong QR code(#1624)

* feat(tianmu):Add delta layer information output and table name output

* fix(tianmu):Perfect atomic operations for delta_table

* feat(tianmu):Optimize delta layer merge operations to remove useless logic

* fix(tianmu):assert failed on ptr == buff.get() + data_.sum_len at pack_str.cpp:584(#1620)

* fix(tianmu):assert failed on oldv <= dpn_->max_i at pack_int.cpp:337 (#1610)

* feat(tianmu):Increase assertion printing information and optimize code logic(#1617)

* fix(tianmu): fix mysqld crash when query where JOIN::propagate_dependencies (#1628)

* fix(tianmu): fix MySQL server has gone away when exec query (#1641 #1640)

* fix(tianmu):Support insert ignore syntax (#1637)

* fix(tianmu): fix query input variables wrong result (#1647)

* fix(tianmu): fix result of the query using the subquery derived table is incorrect (#1662)

* fix(tianmu): fix results of two queries using a derived table and a custom face change are incorrect (#1696)

* feat(tianmu): Test cases that supplement custom variables (#1703)

* fix(tianmu): fix mysqld crash when assigning return values using both custom variables and derived tables (#1707)

* fix(tianmu): Insert ignore can insert duplicate values.(#1699)

* fix(tianmu): fix error occurred in the union all query result (#1599)

* remove unused code block

* fix bug and change test case exptected result

* add stonedb-8.0 compiling guide for CentOS 7.x

* docs(quickstart): add stonedb-8.0 compiling guide(Chinese) for CentOS 7.x

* fix(tianmu):Even if a primary key is defined, duplicate data may be imported.(#1648)

* add delete/drop into tianmu log stat

* open log for all cmds

* fit format

* fix(tianmu): fix Error result set of the IN subquery with semi join (#1764)

* doc(develop-guide): modify method for complie stonedb using docker

1. change the version of the stonedb from 5.6 to 5.7 in docs.
2. list both manual install and automatic install in docs.
3. update the reference in zh-doc to a valid one:
可以参考:[StoneDB快速部署手册](https://stonedb.io/zh/docs/getting-started/quick-deployment)
可以参考:[StoneDB快速部署手册](https://stonedb.io/zh/docs/quick-deployment)

* docs:add docker compile guide of stonedb8.0.(#1780)

* feature: remove DBUG_OFF and repalce DEBUG_ASSERT with assert

* automatically formatting

* fix: fix storage of DT type

* fix incorrect result of TIME type by distinguishing the processing of TIME type from other time types

* fix(tinmu): fix tianmu crash when set varchar to num when order by

* docs(website): update the documentation for Compile StoneDB 8.0 in Docker(#1823)

* fix(tianmu): fix up the incompatible type

1) In result value setup phase, it only deals with num, but in some case, some non-num types
involved, therefore, we should also deal with these types.

2) To fixup the boundary of the error codes.

* fix(tianmu): Fix up the unknown exception after instance killed randomly (#1841)

If the instance was killed by `kill -9 'pid'` randomly, the new inserted data will not be written into `DATA` file under
the param of `tianmu_insert_delayed` was set to 0. Under this configuration, the data will write to memory not a `DATA`
file. Therefore, when the instance was killed and restarted, the data will be lost, and the `DATA` can not be found, and
an TianmuError exception will be thrown.

changed the writing behavior of instance from writting data into memory to writting data into `DATA` file immediately as
that of `tianmu_insert_delayed=1`.

* fix(tianmu): fix up the incorrect meta-info leads unexpected behavior (#1840)

In `ColumnShare::scan_dpn`, it will throw an exception to identify the in-consistent meta-data,
which the offset violates the rules. Now, the deleted DPNs should not be added to `segs`.

And, some auxiliary functions are added for helping to identify the status of files.

* fix(workflow): nightly build failed #1830

[summary]
Currently we disable tar pkg in ci/cd.

* feat(tianmu): revert assert() --> debug_assert() #1551

[summary]
To avoid some cases of some assert failed in release mode.

* feat(tianmu): fixup the default delimeter for load data (#1843)

Tianmu default delimiter is ';' not '\t'. In order to follow the mysql convention,
we change the default delimeter to `\t`.

* fix(tianmu): revert PR #1841. (#1850)

Due to the disk space flattion, this PR is used to revert PR #1841. But this will lead to data in-consistent after the
instance killed at randomly because the new data inserted into memory, and will lost. The root cause pls ref to discussion
in #1621.

* fix(tianmu): fix up mtr test case for delim of load data command (#1854)

To fix up some MTR test cases because the delim of load data is changed from ; to \t.

* fix(tianmu): fix up the `group_concat` function in tianmu (#1852)

To allow `group_concat` function executed in tianmu, and Changes `SI` to `SpecialInstruction`.
Some exceptions are catched.

* fix(tianmu): To fixup the instance crashed if the result of aggregate function goes out of bounds (#1856)

To caculate `sum(length())` will lead a corruption in destructor of `ValueOrNull`, frees an array of
char. Before the array deletes, the validity of that should be checked, and after that the pointer of
that arrary should also be set to nullptr, which make sure it's a safe code piece.

* docs(developer-guide): update the compiling guide of stonedb 8.0 for centos7.x(#1817)

* fix(tianmu): Fixup the mem leakage of aggregation function

1: Fixup the memory leakage of aggregation function, which may lead to failed of malloc.
2: Re-impl the operator= of `ValueOrNull`.
3: Fixup the assertion of `dow_cast` in ` Query::ClearSubselectTransformation`, `Item_func_trig_cond`.

* fix(tianmu): fix UNION of non-matching columns (column no 0)

* test(tianmu): add order by sentence in the mtr case various_join.test

* test(mtr): add more test cases for tianmu(#1196)

[summary]
case_when.test
drop_restric.test
empty_string_not_null.test
left_right_func.test
like_not_like.test
multi_join.test
order_by.test
ssb_small.test
union_case.test

* test(mtr): add order by sentence in the mtr case various_join.test

* ci(codecov): update the config

* fix(tianmu): To suuport ignore option for update statement

To support `update ignore` statement. The logic of uniqueness check is re-implemented.

* ci(codecov): update the codecov congfig

* docs(intro): update the support for 8.0

* wokflow(codecov): Filter out excess code files

* workflow(coverage): Update the lcov running logic

* fix(tianmu): default value of the field take unaffect in load #1865

Cause:
  in the function ParsingStrategy::ParseResult ParsingStrategy::GetOneRow
field->val_str(str) cannot distinguish 0 and NULL value.
Solution:
  Check whether field's default value is NULL.

* fix(tianmu): To support union(all) the statement which is without from clause

1: To fixup unsupport union or union all a sql statement which is without from clause.
2: Re-format some codes and functions.

* fix(tianmu): To remove unnessary optimization in tianmu

1:Removes the unnessary optimization in stage of compiliation of tianmu. It doesnot have any helps for us.
and may introuduce unexepected behaviors.
2:Refine MTR: issue848, issue1865, alter_table1, issue1523

* fix(tianmu): hotfix corruption in ValueOrNull under multi-thread

In multi-thread aggregation, ExpressionColumn will occur double free due to without
protection. Thread A will do ValueOrNull::operator ==, but in thread B, it will try to
free it. Therefore, it leads to instance crash.

* fix(tianmu): incorrect result when using where expr and args > bigint_max #1564

[summary]
1. static_cast<int64_t>(18446744073709551601) = -15
2. Item will set 18446744073709551601 with unsigned flag, but in tianmu
transform to ValueOrNot, the value will be set to `-15`.
3. add `unsigned flag` in value_or_null & TianmuNum & tianmu expr.

* fix(tianmu): add TIME_to_ulonglong_time_round process and fix up precision loss problem (#1173)

When converting TIME/DATETIME to ulonglong numeric, tianmu engine does not take the
TIME_to_ulonglong_time_round process. This causes the results different from innodb.
Furthermore, when we close the tianmu_insert_delayed parameter and execute an insert SQL,
the TIME/DATETIME/TIMESTAMP type's data will loss precision due to incomplete attribute copying.

PR Close #1173

* fix(tianmu): fix format using clang-format #792

* feat: rm files after rebase leftover #1217

files deleted:
        storage/tianmu/core/rc_attr_typeinfo.h
        storage/tianmu/handler/tianmu_handler.cpp
        storage/tianmu/handler/tianmu_handler_com.cpp
        storage/tianmu/types/rc_data_types.cpp
        storage/tianmu/types/rc_num.cpp
        storage/tianmu/types/rc_num.h
        storage/tianmu/types/rc_value_object.cpp

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: LiMK <slibre@qq.com>
Co-authored-by: lihongjian <lihongjian@stoneatom.com>
Co-authored-by: shizhao <shizhao@stoneatom.com>
Co-authored-by: adofsauron <adofsauron@163.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: StoneAtom <98451811+stoneatomadmin@users.noreply.github.com>
Co-authored-by: zzzz-vincent <wenzishen.vincent@hotmail.com>
Co-authored-by: wisehead <alex.chenhui@gmail.com>
Co-authored-by: Agility6 <agility6@163.com>
Co-authored-by: Double0101 <double0101@foxmail.com>
Co-authored-by: dysprosium0626 <1119493091@qq.com>
Co-authored-by: augety <chenshengjiang@stoneatom.com>
Co-authored-by: xuxinqiang <xxq2933@163.com>
Co-authored-by: Jinrong Duan <duanjr02@gmail.com>
Co-authored-by: unknown <adofsauron>
Co-authored-by: hustjieke <gaoriyao1@gmail.com>
  • Loading branch information
16 people authored Jun 29, 2023
1 parent b6380d1 commit a43394b
Show file tree
Hide file tree
Showing 431 changed files with 28,096 additions and 40,973 deletions.
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: stonedb
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
39 changes: 19 additions & 20 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ jobs:
-DDOWNLOAD_BOOST=0 \
-DWITH_BOOST=/usr/local/stonedb-boost/ \
-DDOWNLOAD_ROCKSDB=0 \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb/ \
-DWITH_MARISA=/usr/local/stonedb-marisa/ \
-DDOWNLOAD_ROCKSDB=0 \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb && make -j`nproc` && make -j`nproc` install
tar -zcPvf ../pkg_outdir/stonedb57_nightly-`date +%y%m%d%H%M`.tar.gz /stonedb57/
Expand All @@ -68,21 +66,22 @@ jobs:
cd /stonedb57/install/mysql-test
./mysql-test-run.pl --suite=tianmu --nowarnings --force --nocheck-testcases --retry=0
- name: output some vars
id: vars
env:
SHA_EXT: sha256sum.txt
run: |
find pkg_outdir -type f \( -iname \*.deb -o -iname \*.rpm -o -iname \*.tar.gz \) -exec bash -c "sha256sum {} > {}.sha256sum.txt" \;
subdir=$(date -u +%Y.%m.%d)
echo "::set-output name=subdir::$subdir"
- name: copy file via ssh password
uses: appleboy/scp-action@master
with:
host: ${{ secrets.FILE_SERVER_HOST }}
username: ${{ secrets.FILE_SERVER_USERNAME }}
password: ${{ secrets.FILE_SERVER_PASSWORD }}
port: ${{ secrets.FILE_SERVER_PORT }}
source: "pkg_outdir/*"
target: "${{ secrets.FILE_SERVER_DIR }}"
# TODO(): physical machine has been removed, we restart this funcion again in the future.
#- name: output some vars
# id: vars
# env:
# SHA_EXT: sha256sum.txt
# run: |
# find pkg_outdir -type f \( -iname \*.deb -o -iname \*.rpm -o -iname \*.tar.gz \) -exec bash -c "sha256sum {} > {}.sha256sum.txt" \;
# subdir=$(date -u +%Y.%m.%d)
# echo "::set-output name=subdir::$subdir"
#
#- name: copy file via ssh password
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.FILE_SERVER_HOST }}
# username: ${{ secrets.FILE_SERVER_USERNAME }}
# password: ${{ secrets.FILE_SERVER_PASSWORD }}
# port: ${{ secrets.FILE_SERVER_PORT }}
# source: "pkg_outdir/*"
# target: "${{ secrets.FILE_SERVER_DIR }}"
24 changes: 12 additions & 12 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ jobs:
image: stoneatom/stonedb_buildenv:${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
ssh-strict: 'false'
- name: compile stonedb
id: compile
run: |
- run: |
case ${{ matrix.os }} in
debian10_1.0.3)
apt-get update && apt-get install curl lcov bc libssl-dev -y
apt-get --allow-releaseinfo-change update && apt-get install curl lcov bc libssl-dev -y
;;
centos7_1.0.3)
yum install curl lcov.noarch bc.x86_64 -y
rm -rf /usr/bin/gcc && ln -s /opt/rh/devtoolset-9/root/bin/gcc /usr/bin/gcc
;;
esac
#with:
# ssh-strict: 'false'
- name: compile stonedb
id: compile
run: |
mkdir build && cd build
git config --global --add safe.directory /__w/stonedb/stonedb
git fetch --tags
Expand All @@ -119,9 +119,7 @@ jobs:
-DDOWNLOAD_BOOST=0 \
-DWITH_BOOST=/usr/local/stonedb-boost/ \
-DDOWNLOAD_ROCKSDB=0 \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb/ \
-DWITH_MARISA=/usr/local/stonedb-marisa/ \
-DDOWNLOAD_ROCKSDB=0 \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb -DENABLE_GCOV=1 && make -j`nproc` && make -j`nproc` install
- name: mtr test
Expand All @@ -130,13 +128,15 @@ jobs:
groupadd mysql && useradd -g mysql mysql
chown -R mysql:mysql /stonedb57 && chown -R mysql:mysql ./build
cd /stonedb57/install/mysql-test
./mysql-test-run.pl --suite=innodb --nowarnings --force --nocheck-testcases --retry=0 --defaults-file=/stonedb57/install/mysql-test/suite/innodb/include/my_innodb.cnf --do-test-list=/stonedb57/install/mysql-test/suite/innodb/include/innodb_testlist
./mysql-test-run.pl --suite=innodb,main --mysqld=--default-storage-engine=innodb --nowarnings --force --nocheck-testcases --retry=0 --do-test-list=./suite/innodb/include/innodb_testlist --parallel=15
./mysql-test-run.pl --suite=tianmu --nowarnings --force --nocheck-testcases --retry=0 --parallel=10
- name: create coverage.info
run: |
cat codecov.yml | curl --data-binary @- https://codecov.io/validate
cd build
lcov --capture --directory . --output-file coverage.info --test-name coverage
lcov --capture --directory . --output-file coverage.info --test-name coverage
- name: Codecov
uses: codecov/codecov-action@v3.1.1
uses: codecov/codecov-action@v3.1.4

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Check if  `git` has been installed. If not, install it first.
1. Issue report: Open a regular [StoneDB issue](https://github.com/stoneatom/stonedb/issues/new/choose) to bind your pull request.<br />For more details about creating github issue concepts, see: [create an github issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue)
2. Fork [StoneDB repo](https://github.com/stoneatom/stonedb) to your own account.
3. After add you own code, add unit test
4. Do *make mtr test*
4. Do *make mtr test* [How to add mtr test](https://stonedb.io/docs/getting-started/quick-add-mtr-test/)
5. After all test passed, use *clang-format* to formate your code according to [google c++ styleguide](https://google.github.io/styleguide/cppguide.html)
6. Submit a [Draft Pull Requests](https://github.blog/2019-02-14-introducing-draft-pull-requests/) and  [write your PR description](https://github.com/stoneatom/stonedb/blob/stonedb-5.7/.github/pull_request_template.md)<br />For more details about pr concepts, see [creating-a-pull-request-from-a-fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)<br />For more detail about draft pr concepts,  see [draft-pull-request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests)
7. After all CI tests are passed, change the status to “Ready for review”.
Expand Down
103 changes: 103 additions & 0 deletions Docs/02-getting-started/quick-add-mtr-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
id: quick-add-mtr-test
sidebar_position: 3.6
---

# Qucik Add MTR Test

## Add and Run a MTR test

When you contribute your code into StoneDB, test your code in the meantime.

Test cases are in the path \${StoneDB-Source-DIR}/mysql-test/suite/tianmu/.

:::info
`${StoneDB-Source-DIR}` is your StoneDB source code directory.

`${TEST-PATH}=${StoneDB-Source-DIR}/mysql-test/suite/tianmu/` in the following context.
:::

### Step 1. Write your test file and result file

Put your test file in the `${TEST-PATH}/t/` and result file in the `${TEST-PATH}/r/`.

You can write your test cases like this.

issue736.test
```sql
--source include/have_tianmu.inc
use test;
CREATE TABLE t1(col1 INT, col2 CHAR(5))ENGINE=tianmu;
INSERT INTO t1 VALUES(NULL,''),(1,'a'),(1,'b'),(1,'c'),(2,'dd'),(3,'eee');
INSERT INTO t1 VALUES(8,UNHEX('CEB2'));
SELECT COUNT(DISTINCT col2) FROM t1;
SELECT COUNT(DISTINCT col1) FROM t1;
DROP TABLE t1;
```

Issue736.result
```sql
use test;
CREATE TABLE t1(col1 INT, col2 CHAR(5))ENGINE=tianmu;
INSERT INTO t1 VALUES(NULL,''),(1,'a'),(1,'b'),(1,'c'),(2,'dd'),(3,'eee');
INSERT INTO t1 VALUES(8,UNHEX('CEB2'));
SELECT COUNT(DISTINCT col2) FROM t1;
COUNT(DISTINCT col2)
7
SELECT COUNT(DISTINCT col1) FROM t1;
COUNT(DISTINCT col1)
4
DROP TABLE t1;

```

### Step 2. Compile your StoneDB.

In this example, I compile my StoneDB in `${StoneDB-Source-DIR}/build/mysql8/` and install in `${StoneDB-Source-DIR}/build/install8/`

```shell
cd stonedb/build
mkdir mysql8 install8
# build your stonedb
.........
```

### Step 3. Run your test.

After installation, test cases will be moved into your installation directory.In this example, the path is `${StoneDB-Source-DIR}/build/install8/mysql-test`

``` shell
cd install8/mysql-test
# run your test case. issue736 is my testcase.
# run one case.
./mtr --suite=tianmu testcase
# run all cases.
./mysql-test-run.pl --suite=tianmu --nowarnings --force --nocheck-testcases --parallel=10

### Execute the test in this example.
root@htap-dev-64-2:/stonedb/build/install8/mysql-test# ./mtr --suite=tianmu issue736
Logging: ./mtr --suite=tianmu issue736
MySQL Version 8.0.30
Checking supported features
- Binaries are debug compiled
Collecting tests
Checking leftover processes
Removing old var directory
Creating var directory '/stonedb/build/install8/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
TEST NAME RESULT TIME (ms) COMMENT
------------------------------------------------------------------------------
worker[1] mysql-test-run: WARNING: running this script as _root_ will cause some tests to be skipped
[ 50%] tianmu.issue736 [ pass ] 78
[100%] shutdown_report [ pass ]
------------------------------------------------------------------------------
The servers were restarted 0 times
The servers were reinitialized 0 times
Spent 0.078 of 35 seconds executing testcases

Completed: All 2 tests were successful.

```
24 changes: 15 additions & 9 deletions Docs/02-getting-started/quick-deploy-in-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,30 @@ sidebar_position: 3.2

# Quick Deployment in a Docker Container
## Prerequisites
The image of StoneDB is downloaded from Docker Hub.

The image of StoneDB is downloaded from Docker Hub. You can read the Dockerhub documentation, which must be up to date.
[Docker Hub](https://hub.docker.com/r/stoneatom/stonedb)

## Procedure
The username and password for login are **root** and **stonedb123**.
The username and password for login are **root**. The **password** is customized by yourself.

Make sure your CPU supports AVX

```bash
cat /proc/cpuinfo |grep avx
```
### 1. Pull the image
Run the following command:
```bash
docker pull stoneatom/stonedb:v1.0.2
docker pull stoneatom/stonedb:v1.0.3
```
### 2. Run the image
Run the following command:
```bash
docker run -p 13306:3306 -v $stonedb_volumn_dir/data/:/stonedb56/install/data/ -it -d stoneatom/stonedb:v0.1 /bin/bash
docker run -p 3306:3306 -itd -v $YOU_DATA_DIR:/opt -e MYSQL_ROOT_PASSWORD='$YOU_PASSWORD' stoneatom/stonedb:v1.0.3
```
Altenatively, run the following command:
```bash
docker run -p 13306:3306 -it -d stoneatom/stonedb:v0.1 /bin/bash
docker run -p 3306:3306 -itd -e MYSQL_ROOT_PASSWORD='$YOU_PASSWORD' stoneatom/stonedb:v1.0.3
```
Parameter description:

Expand All @@ -32,16 +37,17 @@ Parameter description:
- **-i**: the interaction.
- **-t**: the terminal.
- **-d**: Do not enter the container upon startup. If you want to enter the container upon startup, run the docker exec command.
### **3. Log in to StoneDB in the container**
### 3. Log in to StoneDB in the container
```bash
# Obtain the Docker container ID.
docker ps
# Use the "cocker ps" command to obtain the container ID and enter the Docker container.
docker exec -it <Container ID> bash
<Container ID>$ /stonedb56/install/bin/mysql -uroot -pstonedb123

<Container ID>$ /opt/stonedb57/install/bin/mysql -uroot -p$YOU_PASSWORD
```
### **4. Log in to StoneDB using a third-party tool**
You can log in to StoneDB by using third-party tools such as mysql, Navicat, and DBeaver. The following code uses mysql as an example.
```shell
mysql -h<Host IP address> -uroot -pstonedb123 -P<Mapped port of the host>
mysql -h<Host IP address> -uroot -p$YOU_PASSWORD -P<Mapped port of the host>
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ sidebar_position: 3.14
## Step 1. Install StoneDB
1. Download the StoneDB software package.
```sql
wget https://github.com/stoneatom/stonedb/releases/download/5.7-v1.0.2-GA/stonedb-ce-5.7_v1.0.2.ubuntu.amd64.deb
wget https://github.com/stoneatom/stonedb/releases/download/5.7-v1.0.3-GA/stonedb-ce-5.7_v1.0.3.ubuntu.amd64.deb
```

2. Use the DPKG command to install the DEB package.
```sql
dpkg -i stonedb-ce-5.7_v1.0.2.ubuntu.amd64.deb
dpkg -i stonedb-ce-5.7_v1.0.3.ubuntu.amd64.deb
```
:::info
If this step fails, run `ldd /opt/stonedb57/install/bin/mysqld | grep 'not found'` to check whether any dependent libraries are missing. If yes, run `source /opt/stonedb57/install/bin/sourceenv` and then retry this step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ sidebar_position: 3.12

# Quick Deploy StoneDB-5.7
## 1. Download the installation package
Click [here](https://static.stoneatom.com/custom/stonedb-ce-5.7-v1.0.3.el7.x86_64.tar.gz) to download the latest installation package of StoneDB.

Click [Github](https://github.com/stoneatom/stonedb/releases/download/5.7-v1.0.3-GA/stonedb-ce-5.7-v1.0.3.el7.x86_64.tar.gz) or [Gitee](https://gitee.com/StoneDB/stonedb/releases/download/5.7-v1.0.3-GA/stonedb-ce-5.7-v1.0.3.el7.x86_64.tar.gz) to download the latest installation package of StoneDB.


:::info
To simplify deployment, the installation package provided here is pre-compiled to include all required dependencies.
:::
Expand All @@ -31,6 +34,8 @@ Users can start StoneDB in two ways: manual installation and automatic installat
```shell
groupadd mysql
useradd -g mysql mysql

# Here are the optional execution statements
passwd mysql
```
### 4.2 Manually install StoneDB
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
id: compile-using-centos7-foe-56
sidebar_position: 5.122
id: compile-using-centos7-for-56
sidebar_position: 5.123
---

# Compile StoneDB for MySQL5.6 on CentOS 7
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
id: compile-using-centos7-for-57
sidebar_position: 5.121
sidebar_position: 5.122
---

# Compile StoneDB for MySQL5.7 on CentOS 7
Expand Down
Loading

0 comments on commit a43394b

Please sign in to comment.