@@ -48,12 +48,12 @@ TAsyncExecuteQueryResult GetNewOrder(
48
48
DECLARE $no_d_id AS Int32;
49
49
DECLARE $no_w_id AS Int32;
50
50
51
- SELECT NO_W_ID, NO_D_ID, NO_O_ID FROM `new_order `
51
+ SELECT NO_W_ID, NO_D_ID, NO_O_ID FROM `{} `
52
52
WHERE NO_D_ID = $no_d_id
53
53
AND NO_W_ID = $no_w_id
54
54
ORDER BY NO_W_ID ASC, NO_D_ID ASC, NO_O_ID ASC
55
55
LIMIT 1;
56
- )" , context.Path .c_str ());
56
+ )" , context.Path .c_str (), TABLE_NEW_ORDER );
57
57
58
58
auto params = TParamsBuilder ()
59
59
.AddParam (" $no_d_id" ).Int32 (districtID).Build ()
@@ -84,11 +84,11 @@ TAsyncExecuteQueryResult DeleteNewOrder(
84
84
DECLARE $no_d_id AS Int32;
85
85
DECLARE $no_w_id AS Int32;
86
86
87
- DELETE FROM `new_order `
87
+ DELETE FROM `{} `
88
88
WHERE NO_O_ID = $no_o_id
89
89
AND NO_D_ID = $no_d_id
90
90
AND NO_W_ID = $no_w_id;
91
- )" , context.Path .c_str ());
91
+ )" , context.Path .c_str (), TABLE_NEW_ORDER );
92
92
93
93
auto params = TParamsBuilder ()
94
94
.AddParam (" $no_o_id" ).Int32 (orderID).Build ()
@@ -120,11 +120,11 @@ TAsyncExecuteQueryResult GetCustomerID(
120
120
DECLARE $o_w_id AS Int32;
121
121
122
122
SELECT O_C_ID
123
- FROM `oorder `
123
+ FROM `{} `
124
124
WHERE O_ID = $o_id
125
125
AND O_D_ID = $o_d_id
126
126
AND O_W_ID = $o_w_id;
127
- )" , context.Path .c_str ());
127
+ )" , context.Path .c_str (), TABLE_OORDER );
128
128
129
129
auto params = TParamsBuilder ()
130
130
.AddParam (" $o_id" ).Int32 (orderID).Build ()
@@ -156,9 +156,9 @@ TAsyncExecuteQueryResult UpdateCarrierID(
156
156
DECLARE $o_w_id AS Int32;
157
157
DECLARE $o_carrier_id AS Int32;
158
158
159
- UPSERT INTO `oorder ` (O_W_ID, O_D_ID, O_ID, O_CARRIER_ID)
159
+ UPSERT INTO `{} ` (O_W_ID, O_D_ID, O_ID, O_CARRIER_ID)
160
160
VALUES ($o_w_id, $o_d_id, $o_id, $o_carrier_id);
161
- )" , context.Path .c_str ());
161
+ )" , context.Path .c_str (), TABLE_OORDER );
162
162
163
163
auto params = TParamsBuilder ()
164
164
.AddParam (" $o_w_id" ).Int32 (warehouseID).Build ()
@@ -188,8 +188,8 @@ TAsyncExecuteQueryResult UpdateDeliveryDate(
188
188
$mapper = ($row) -> (AsStruct(
189
189
$row.p1 as OL_W_ID, $row.p2 as OL_D_ID, $row.p3 as OL_O_ID,
190
190
$row.p4 as OL_NUMBER, $row.p5 as OL_DELIVERY_D));
191
- UPSERT INTO `order_line ` SELECT * FROM as_table(ListMap($values, $mapper));
192
- )" , context.Path .c_str ());
191
+ UPSERT INTO `{} ` SELECT * FROM as_table(ListMap($values, $mapper));
192
+ )" , context.Path .c_str (), TABLE_ORDER_LINE );
193
193
194
194
auto paramsBuilder = TParamsBuilder ();
195
195
auto & listBuilder = paramsBuilder.AddParam (" $values" ).BeginList ();
@@ -229,11 +229,11 @@ TAsyncExecuteQueryResult GetOrderLines(
229
229
DECLARE $ol_w_id AS Int32;
230
230
231
231
SELECT OL_NUMBER, OL_AMOUNT
232
- FROM `order_line `
232
+ FROM `{} `
233
233
WHERE OL_O_ID = $ol_o_id
234
234
AND OL_D_ID = $ol_d_id
235
235
AND OL_W_ID = $ol_w_id;
236
- )" , context.Path .c_str ());
236
+ )" , context.Path .c_str (), TABLE_ORDER_LINE );
237
237
238
238
auto params = TParamsBuilder ()
239
239
.AddParam (" $ol_o_id" ).Int32 (orderID).Build ()
@@ -265,11 +265,11 @@ TAsyncExecuteQueryResult GetCustomerData(
265
265
DECLARE $c_id AS Int32;
266
266
267
267
SELECT C_BALANCE, C_DELIVERY_CNT
268
- FROM `customer `
268
+ FROM `{} `
269
269
WHERE C_W_ID = $c_w_id
270
270
AND C_D_ID = $c_d_id
271
271
AND C_ID = $c_id;
272
- )" , context.Path .c_str ());
272
+ )" , context.Path .c_str (), TABLE_CUSTOMER );
273
273
274
274
auto params = TParamsBuilder ()
275
275
.AddParam (" $c_w_id" ).Int32 (warehouseID).Build ()
@@ -302,9 +302,9 @@ TAsyncExecuteQueryResult UpdateCustomerBalanceAndDeliveryCount(
302
302
DECLARE $c_balance AS Double;
303
303
DECLARE $c_delivery_cnt AS Int32;
304
304
305
- UPSERT INTO `customer ` (C_W_ID, C_D_ID, C_ID, C_BALANCE, C_DELIVERY_CNT)
305
+ UPSERT INTO `{} ` (C_W_ID, C_D_ID, C_ID, C_BALANCE, C_DELIVERY_CNT)
306
306
VALUES ($c_w_id, $c_d_id, $c_id, $c_balance, $c_delivery_cnt);
307
- )" , context.Path .c_str ());
307
+ )" , context.Path .c_str (), TABLE_CUSTOMER );
308
308
309
309
auto params = TParamsBuilder ()
310
310
.AddParam (" $c_w_id" ).Int32 (warehouseID).Build ()
@@ -342,7 +342,8 @@ NThreading::TFuture<TStatus> GetDeliveryTask(
342
342
const int warehouseID = context.WarehouseID ;
343
343
const int carrierID = RandomNumber (1 , 10 );
344
344
345
- LOG_T (" Terminal " << context.TerminalID << " started Delivery transaction in " << warehouseID);
345
+ LOG_T (" Terminal " << context.TerminalID << " started Delivery transaction in " << warehouseID
346
+ << " , session: " << session.GetId ());
346
347
347
348
size_t processedOrderCount = 0 ;
348
349
std::optional<TTransaction> tx;
@@ -356,9 +357,11 @@ NThreading::TFuture<TStatus> GetDeliveryTask(
356
357
if (!newOrderResult.IsSuccess ()) {
357
358
if (ShouldExit (newOrderResult)) {
358
359
LOG_E (" Terminal " << context.TerminalID << " new order query failed: "
359
- << newOrderResult.GetIssues ().ToOneLineString ());
360
+ << newOrderResult.GetIssues ().ToOneLineString () << " , session: " << session. GetId () );
360
361
std::quick_exit (1 );
361
362
}
363
+ LOG_T (" Terminal " << context.TerminalID << " new order query failed: "
364
+ << newOrderResult.GetIssues ().ToOneLineString () << " , session: " << session.GetId ());
362
365
co_return newOrderResult;
363
366
}
364
367
@@ -383,9 +386,11 @@ NThreading::TFuture<TStatus> GetDeliveryTask(
383
386
if (!customerIdResult.IsSuccess ()) {
384
387
if (ShouldExit (customerIdResult)) {
385
388
LOG_E (" Terminal " << context.TerminalID << " get customer ID failed: "
386
- << customerIdResult.GetIssues ().ToOneLineString ());
389
+ << customerIdResult.GetIssues ().ToOneLineString () << " , session: " << session. GetId () );
387
390
std::quick_exit (1 );
388
391
}
392
+ LOG_T (" Terminal " << context.TerminalID << " get customer ID failed: "
393
+ << customerIdResult.GetIssues ().ToOneLineString () << " , session: " << session.GetId ());
389
394
co_return customerIdResult;
390
395
}
391
396
@@ -403,9 +408,11 @@ NThreading::TFuture<TStatus> GetDeliveryTask(
403
408
if (!customerDataResult.IsSuccess ()) {
404
409
if (ShouldExit (customerDataResult)) {
405
410
LOG_E (" Terminal " << context.TerminalID << " get customer data failed: "
406
- << customerDataResult.GetIssues ().ToOneLineString ());
411
+ << customerDataResult.GetIssues ().ToOneLineString () << " , session: " << session. GetId () );
407
412
std::quick_exit (1 );
408
413
}
414
+ LOG_T (" Terminal " << context.TerminalID << " get customer data failed: "
415
+ << customerDataResult.GetIssues ().ToOneLineString () << " , session: " << session.GetId ());
409
416
co_return customerDataResult;
410
417
}
411
418
@@ -425,9 +432,11 @@ NThreading::TFuture<TStatus> GetDeliveryTask(
425
432
if (!orderLinesResult.IsSuccess ()) {
426
433
if (ShouldExit (orderLinesResult)) {
427
434
LOG_E (" Terminal " << context.TerminalID << " get order lines failed: "
428
- << orderLinesResult.GetIssues ().ToOneLineString ());
435
+ << orderLinesResult.GetIssues ().ToOneLineString () << " , session: " << session. GetId () );
429
436
std::quick_exit (1 );
430
437
}
438
+ LOG_T (" Terminal " << context.TerminalID << " get order lines failed: "
439
+ << orderLinesResult.GetIssues ().ToOneLineString () << " , session: " << session.GetId ());
431
440
co_return orderLinesResult;
432
441
}
433
442
@@ -463,9 +472,11 @@ NThreading::TFuture<TStatus> GetDeliveryTask(
463
472
if (!deleteOrderResult.IsSuccess ()) {
464
473
if (ShouldExit (deleteOrderResult)) {
465
474
LOG_E (" Terminal " << context.TerminalID << " delete order failed: "
466
- << deleteOrderResult.GetIssues ().ToOneLineString ());
475
+ << deleteOrderResult.GetIssues ().ToOneLineString () << " , session: " << session. GetId () );
467
476
std::quick_exit (1 );
468
477
}
478
+ LOG_T (" Terminal " << context.TerminalID << " delete order failed: "
479
+ << deleteOrderResult.GetIssues ().ToOneLineString () << " , session: " << session.GetId ());
469
480
co_return deleteOrderResult;
470
481
}
471
482
@@ -475,9 +486,11 @@ NThreading::TFuture<TStatus> GetDeliveryTask(
475
486
if (!updateCarrierResult.IsSuccess ()) {
476
487
if (ShouldExit (updateCarrierResult)) {
477
488
LOG_E (" Terminal " << context.TerminalID << " update carrier ID failed: "
478
- << updateCarrierResult.GetIssues ().ToOneLineString ());
489
+ << updateCarrierResult.GetIssues ().ToOneLineString () << " , session: " << session. GetId () );
479
490
std::quick_exit (1 );
480
491
}
492
+ LOG_T (" Terminal " << context.TerminalID << " update carrier ID failed: "
493
+ << updateCarrierResult.GetIssues ().ToOneLineString () << " , session: " << session.GetId ());
481
494
co_return updateCarrierResult;
482
495
}
483
496
@@ -489,9 +502,11 @@ NThreading::TFuture<TStatus> GetDeliveryTask(
489
502
if (!updateDeliveryResult.IsSuccess ()) {
490
503
if (ShouldExit (updateDeliveryResult)) {
491
504
LOG_E (" Terminal " << context.TerminalID << " update delivery date failed: "
492
- << updateDeliveryResult.GetIssues ().ToOneLineString ());
505
+ << updateDeliveryResult.GetIssues ().ToOneLineString () << " , session: " << session. GetId () );
493
506
std::quick_exit (1 );
494
507
}
508
+ LOG_T (" Terminal " << context.TerminalID << " update delivery date failed: "
509
+ << updateDeliveryResult.GetIssues ().ToOneLineString () << " , session: " << session.GetId ());
495
510
co_return updateDeliveryResult;
496
511
}
497
512
@@ -501,9 +516,11 @@ NThreading::TFuture<TStatus> GetDeliveryTask(
501
516
if (!updateCustomerResult.IsSuccess ()) {
502
517
if (ShouldExit (updateCustomerResult)) {
503
518
LOG_E (" Terminal " << context.TerminalID << " update customer failed: "
504
- << updateCustomerResult.GetIssues ().ToOneLineString ());
519
+ << updateCustomerResult.GetIssues ().ToOneLineString () << " , session: " << session. GetId () );
505
520
std::quick_exit (1 );
506
521
}
522
+ LOG_T (" Terminal " << context.TerminalID << " update customer failed: "
523
+ << updateCustomerResult.GetIssues ().ToOneLineString () << " , session: " << session.GetId ());
507
524
co_return updateCustomerResult;
508
525
}
509
526
@@ -512,7 +529,7 @@ NThreading::TFuture<TStatus> GetDeliveryTask(
512
529
}
513
530
514
531
LOG_T (" Terminal " << context.TerminalID
515
- << " is committing Delivery transaction, processed " << processedOrderCount << " districts" );
532
+ << " is committing Delivery transaction, processed " << processedOrderCount << " districts, session: " << session. GetId () );
516
533
517
534
auto commitFuture = tx->Commit ();
518
535
auto commitResult = co_await TSuspendWithFuture (commitFuture, context.TaskQueue , context.TerminalID );
0 commit comments