viabtc / viabtc_exchange_server

A trading engine with high-speed performance and real-time notification
MIT License
2.67k stars 1.49k forks source link

Balance Lost for all Users on Matchingengine Restart #244

Closed sayin-demah closed 4 years ago

sayin-demah commented 4 years ago

Hi,

I am trying to add a new market pair and restart the matching engine, but upon restart the matching engine all my user balances vanished. I tried restart all other modules as well but no luck.

I can see in the matching engine log says that "load balance from: slice_balance_1585155600" but this balance slice table is empty but the table before this slice has values in it. Below is the matching engine log for your reference

=== matchengine is starting === matchengine contains kafka config: "kafka:9092" === matchengine: kafka addr found: kafka:9092 === matchengine: kafka is up === matchengine contains db_history mysql host: "mysql-0.mysql" and port: 3306 === matchengine: db_history is up === matchengine contains db_log mysql host: "mysql-0.mysql" and port: 3306 === matchengine: db_log is up === matchengine: ready to exec [2020-03-25 17:00:18.116549] me_persist.c:32(get_last_slice): get last slice time [2020-03-25 17:00:18.117259] me_persist.c:135(init_from_db): last_slice_time: 1585155600, last_oper_id: 0, last_order_id: 0, last_deals_id: 0 [2020-03-25 17:00:18.117285] me_persist.c:65(load_slice_from_db): load orders from: slice_order_1585155600 [2020-03-25 17:00:18.118613] me_persist.c:76(load_slice_from_db): load balance from: slice_balance_1585155600 [2020-03-25 17:00:18.119506] me_persist.c:94(load_operlog_from_db): load oper log from: operlog_20200325 [2020-03-25 17:00:18.122384] me_persist.c:97(load_operlog_from_db): table operlog_20200325 not exist [2020-03-25 17:00:18.122501] me_persist.c:164(init_from_db): load success [2020-03-25 17:00:18.399421] me_main.c:139(main): server start === matchengine(exe) has started

Can anyone please help me resolve this issue..

sayin-demah commented 4 years ago

Found the solution for this issue, actually the table slice_balance_1585155600 is empty so I have simply copy the data from previous slice_table to slice_balance_1585155600 and restarted the matching engine. Now I got all my users balances back.