Closed sm-shaw closed 5 months ago
As example first commit for SQL Server TPROC-C https://github.com/TPC-Council/HammerDB/compare/master...sm-shaw:HammerDB:659 implements the following checks:
For reference the consistency checks implemented for TPROC-C and TPROC-H are as follows and all have been tested on all databases to ensure that the schema is consistent both after a load and running a test. (For TPROC-H after running a refresh function). These come after basic tests to make sure the schema has been built as expected such as tables exists, indexes exist, stored procedures exist etc to prevent consistency tests failing on an incomplete build.
TPROC-C The specification defines 12 consistency conditions, of which Consistency conditions 1 through 4 are:
TPROC-H A consistent state for the TPC-H database is defined to exist when: O_TOTALPRICE = SUM(L_EXTENDEDPRICE(1-L_DISCOUNT)(1+L_TAX) for each ORDER and LINEITEM defined by (O_ORDERKEY=L_ORDERKEY) and can be checked by: SELECT DECIMAL(SUM(DECIMAL(INTEGER(INTEGER(DECIMAL (INTEGER(100DECIMAL(L_EXTENDEDPRICE,20,3)),20,3) (1-L_DISCOUNT)) * (1+L_TAX)),20,3)/100.0),20,3) FROM TPCD.LINEITEM WHERE L_ORDERKEY = okey
SELECT DECIMAL(SUM(O_TOTALPRICE, 20, 3)) from TPCD.ORDERS WHERE O_ORDERKEY = okey
Is your feature request related to a problem? Please describe. The TPC-C and TPC-H specifications that HammerDB is derived from includes schema consistency checks e.g. for TPROC-C there are 12 checks of which the first 4 should be demonstrated. HammerDB doesn't currently implement any consistency checks. This would be useful for HammerDB enhancements and also testing database modifications.
Describe the solution you'd like Implement consistency checks for both TPROC-C and TPROC-H for all databases. In the GUI this will be an option under Schema, after Build and before Delete. In the CLI this will be an additional command such as "checkconsistent" that will need to be added to both Tcl and Python CLI interfaces.
Describe alternatives you've considered
Additional context In the provided scripts run the consistency check after the run phase and before the results are reported and schema deleted.