/** Executes a payment transaction. */ public void doPayment() throws IOException { boolean allow_remote = (parameters.warehouses > 1 && config.payment_multip != false); double remote_prob = (config.payment_multip_mix >= 0 ? config.payment_multip_mix : 15) * 10d; short w_id = generateWarehouseId(); byte d_id = generateDistrict(); short c_w_id; byte c_d_id; if (allow_remote == false || generator.number(1, 1000) <= (1000 - remote_prob)) { // 85%: paying through own warehouse (or there is only 1 warehouse) c_w_id = w_id; c_d_id = d_id; } else { // 15%: paying through another warehouse: if (config.warehouse_pairing) { c_w_id = generatePairedWarehouse(w_id, parameters.starting_warehouse, parameters.last_warehouse); } else if (config.payment_multip_remote) { c_w_id = (short) generator.numberRemoteWarehouseId( parameters.starting_warehouse, parameters.last_warehouse, (int) w_id); } else { // select in range [1, num_warehouses] excluding w_id c_w_id = (short) generator.numberExcluding( parameters.starting_warehouse, parameters.last_warehouse, w_id); } assert c_w_id != w_id; c_d_id = generateDistrict(); } double h_amount = generator.fixedPoint(2, TPCCConstants.MIN_PAYMENT, TPCCConstants.MAX_PAYMENT); TimestampType now = clock.getDateTime(); if (generator.number(1, 100) <= 60) { // 60%: payment by last name String c_last = generator.makeRandomLastName(parameters.customersPerDistrict); client.callPaymentByName(w_id, d_id, h_amount, c_w_id, c_d_id, c_last, now); } else { // 40%: payment by id client.callPaymentById(w_id, d_id, h_amount, c_w_id, c_d_id, generateCID(), now); } }
/** Executes an order status transaction. */ public void doOrderStatus() throws IOException { int y = generator.number(1, 100); if (y <= 60) { // 60%: order status by last name String cLast = generator.makeRandomLastName(parameters.customersPerDistrict); client.callOrderStatus( TPCCConstants.ORDER_STATUS_BY_NAME, generateWarehouseId(), generateDistrict(), cLast); } else { // 40%: order status by id assert y > 60; client.callOrderStatus( TPCCConstants.ORDER_STATUS_BY_ID, generateWarehouseId(), generateDistrict(), generateCID()); } }