Percona-Lab/sysbench-tpcc

Payment transaction uses wrong warehouse id

sdressler opened this issue · 3 comments

I think that the payment transaction uses w_id instead of c_w_id in several places. For instance:

-- SELECT count(c_id) 
--	FROM customer
--	WHERE c_w_id = :c_w_id
--	AND c_d_id = :c_d_id
--	AND c_last = :c_last;*/
  
	local namecnt = con:query_row(([[SELECT count(c_id) namecnt
			                   FROM customer%d
			                  WHERE c_w_id = %d 
			                    AND c_d_id= %d
                                            AND c_last='%s']]):format(table_num, w_id, c_d_id, c_last ))

According to specification this should pass in c_w_id. Updating the warehouse, for example looks correct instead:

-- UPDATE district SET d_ytd = d_ytd + :h_amount
--		WHERE d_w_id = :w_id 
--		AND d_id = :d_id;*/

  con:query(([[UPDATE district%d 
                 SET d_ytd = d_ytd + %d 
               WHERE d_w_id = %d 
                 AND d_id= %d]]):format(table_num, h_amount, w_id, d_id))

I'm happy to open a PR but first want to clarify whether this is intentional or not.

I think you are right, seems like an oversight.

Would you want a PR?

yes, PR would be good!