TPC-Council / HammerDB

HammerDB Database Load Testing and Benchmarking Tool
http://www.hammerdb.com
GNU General Public License v3.0
542 stars 115 forks source link

Add support for Oceanbase in MySQL TPROC-C #710

Open KingKongLittle opened 3 weeks ago

KingKongLittle commented 3 weeks ago

Describe the bug Transaction Counter For Oceanbase4.2.3.0 ( for mysql TPROC-C ) cannot be displayed

To Reproduce

Expected behavior When I Test Oceanbase4.2.3.0 use Mysql TPROC-C options,The Transaction Counter can't displayed, It show the proc read_more is return no value. After I replace : set sqc "show global status where Variable_name = 'Com_commit' or Variable_name = 'Com_rollback'" with set sqc "select REPLACE( REPLACE(name,'trans commit count','Com_commit'),'trans rollback count','Com_rollback') Variable_name,sum(value) from oceanbase.gv\$sysstat where name in ('trans rollback count','trans commit count') group by name "

then Transaction Counter is OK.

Screenshots image

image

image

HammerDB Version (please complete the following information):

Operating System (please complete the following information):

Database Client (please complete the following information):

Additional context

sm-shaw commented 3 weeks ago

At the moment we don't have support for Oceanbase with MySQL TPROC-C, However the good news is that Pull Request #670 adds support for Oceanbase for MySQL TPROC-H and as this adds support for querying Oceanbase queries (as opposed to transactions) for the transaction counter and this will be available in v4.11.

To add support for Oceanbase TPROC-C we could not just change the statement as that would then break it for regular MySQL.

Therefore, it needs something similar to the TPROC-H support i.e. an Oceanbase compatible option/checkbox and the additional connection options added if this is selected such as <mysql_oceanbase_port>2881</mysql_oceanbase_port> and <mysql_ob_tenant_name>tpch</mysql_ob_tenant_name>.

When this is selected, it would then use the statement you show or something similar, however, does it also need other options such as the tenant name adding as the TPROC-H workload does? It would also need the statement changing in the driver script for when it reports the final TPM value.

From your screenshots it looks as if the schema built and the workload ran OK, but it would also need to clarify options such as whether the stored procedures run OK or whether the client SQL option is necessary and stored procedures get greyed out.

So, the core team don't have access to Oceanbase and would therefore not add this feature. (however as with #670 we can check if it breaks existing functionality) Nevertheless, #670 provides an excellent template for exactly what you want to do, where #670 adds support for TPROC-H and you want to do this for TPROC-C.

Therefore, the best approach is for you to develop this feature and make a pull request. Perhaps also @yaqi-zhao and @xtangxtang who did #670 may be willing to assist you to add Oceanbase support for TPROC-C also and make a pull request to do so.

sm-shaw commented 3 weeks ago

And if you add the change by making the PR, you can find that the transaction counter is improved in the current version:

Screenshot at 2024-06-14 10-10-42

and if you run the web service to query the stored job data it would also then add the transaction count to the job data as shown here (Click on Jobs in the tree view, start web service and browse)

Screenshot at 2024-06-14 10-14-25

KingKongLittle commented 3 weeks ago

image It look like the schema built and the workload and stored procedures run OK .

sm-shaw commented 3 weeks ago

What would be useful would be to run the Schema Check introduced at v4.10. you can see the GUI "Check" option in my screenshot above or you can run the CLI command "schemacheck" - If this runs OK and you can run with stored procedures then that would verify that the build ran OK. Then it would be a case of adding the Oceanbase compatible checkbox, the additional connection options such as port and tenant name and then the transaction counter query in both the transaction counter and the driver scripts (in multiple places). Also currently we just have the tcl example CLI scripts for Oceanbase TPROC-H and therefore it would also need these completing fully for both Tcl and Python for Oceanbase for both TPROC-C and TPROC-H.

sm-shaw commented 3 weeks ago

A blog post on how to verify the schema is here https://www.hammerdb.com/blog/uncategorized/hammerdb-v4-10-new-features-schema-and-consistency-checks/

KingKongLittle commented 3 weeks ago

image Error in Virtual User 1: Error: mysqlexec/db server: MySQL compatible temporary table not supported

KingKongLittle commented 3 weeks ago

about temporary table, It was supported in the previous Oceanbase 3.x version, but in the new Oceanbase 4.x version it has been restructured, and the support will be available around September.

KingKongLittle commented 3 weeks ago

This is a TPROC-C test result : image

KingKongLittle commented 3 weeks ago

image image image It seems the test was successful.

sm-shaw commented 3 weeks ago

yes that looks successful, so it looks like support for TPROC-C for oceanbase is entirely possible and the performance looks good. So it looks like we need the following in a PR from someone who can test on Oceanbase and then we can verify that it still all works against regualr MySQL.

KingKongLittle commented 3 weeks ago

When i use V4.11 an error occurred "Error in Virtual User 1: Error: invalid command name "maria::sel"" image

But the SQL statement with "SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '$db'" And "SELECT COUNT(DISTINCT TABLE_NAME) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '$db'" All return the correct result : image

sm-shaw commented 3 weeks ago

Yes that is fixed here https://github.com/TPC-Council/HammerDB/pull/709/commits/a56b984f338a2f8273e88a1eb467218a7542b047 that will go into the 4.11 release that is still undergoing testing before release.

KingKongLittle commented 3 weeks ago

image It is OK.

For good performance ,can use SQL statement in OceanBase :

ALTER TABLE customer PARTITION BY KEY(c_w_id) PARTITIONS 12; ALTER TABLE district PARTITION BY KEY(d_w_id) PARTITIONS 12; ALTER TABLE history PARTITION BY KEY(h_w_id) PARTITIONS 12; ALTER TABLE new_order PARTITION BY KEY(no_w_id) PARTITIONS 12; ALTER TABLE order_line PARTITION BY KEY(ol_w_id) PARTITIONS 12; ALTER TABLE orders PARTITION BY KEY(o_w_id) PARTITIONS 12;
ALTER TABLE stock PARTITION BY KEY(s_w_id) PARTITIONS 12; ALTER TABLE warehouse PARTITION BY KEY(w_id) PARTITIONS 12; CREATE TABLEGROUP hammerdb_group SHARDING = 'PARTITION'; ALTER TABLE customer SET TABLEGROUP hammerdb_group ; ALTER TABLE district SET TABLEGROUP hammerdb_group ; ALTER TABLE history SET TABLEGROUP hammerdb_group ; ALTER TABLE new_order SET TABLEGROUP hammerdb_group ; ALTER TABLE order_line SET TABLEGROUP hammerdb_group ; ALTER TABLE orders SET TABLEGROUP hammerdb_group ; ALTER TABLE stock SET TABLEGROUP hammerdb_group ; ALTER TABLE warehouse SET TABLEGROUP hammerdb_group ;

call dbms_stats.gather_schema_stats('tpcc',degree=>96);

sm-shaw commented 3 weeks ago

There is already a partitioning option for MySQL, however with an oceanbase checkbox you can add any specific partitioning for Oceanbase there. In the screenshots it looks like you are missing the fonts the required packages are detailed here https://www.hammerdb.com/docs/ch01s01.html#d0e109

KingKongLittle commented 3 weeks ago

ALTER TABLE item DUPLICATE_SCOPE= 'cluster'; can Improve test scores

KingKongLittle commented 3 weeks ago

Alicoud Node specifications : 14cpu70g

sm-shaw commented 3 weeks ago

Lets leave this issue open as "help required" as someone with Oceanbase access may wish to add support as it looks straightforward, for example @yaqi-zhao and @xtangxtang can advise if there is interest in doing this?

As as a summary, the key enhancement is:

ob1 ob2

<?xml version="1.0" encoding="utf-8"?>
<mysql>
..
        <mysql_oceanbase_port>2881</mysql_oceanbase_port>
    </connection>
..
    <tpch>
        <schema>
            <mysql_ob_tenant_name>tpch</mysql_ob_tenant_name>
..
            <mysql_tpch_obcompat>false</mysql_tpch_obcompat>
            <mysql_ob_partition_num>1</mysql_ob_partition_num>

When set up correctly print dict will show the new settings:

hammerdb>print dict
Dictionary Settings for MySQL
connection {
...
 mysql_oceanbase_port     = 2881
}
tpch       {
...
 mysql_ob_tenant_name      = tpch
..
 mysql_tpch_obcompat       = true
 mysql_ob_partition_num    = 1
...
}

Once the configuration is done then the additional task are:

sm-shaw commented 3 weeks ago

Changed title of Issue to be clear for where help is wanted