Skip to content

Commit

Permalink
Bugfix/ignore orders after checkpoint (#122)
Browse files Browse the repository at this point in the history
* ignore orders after checkpoint while migrating

---------

Co-authored-by: Cyberaurora <[email protected]>
  • Loading branch information
kb1ns and kb1ns authored Nov 14, 2023
1 parent 2faac59 commit df81c0f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,33 @@

## Introduction

Galois is an extremely high performance matching engine written in Rust which uses event-sourcing pattern to handle tens of thousands of orders per second or even better, depending on the performance of persistence.
Galois is an extremely high-performance matching engine written in Rust which uses event-sourcing pattern to handle tens of thousands of orders per second or even better.

The internal structure of Galois looks like below:

```
sidecar chain <-+
| | \
^ | \
| | \
v v \
+-----> server scanner +
+----> server scanner +
| \ / |
|\ \ / |
| \ \ / |
| +-<- sequencer |
| +-- sequencer |
+ | |
|\ | |
| \ v |
| +-<- executor |
+ / \ +
\ / \ /
\ / \ /
+-<- output committer -+
| +-- executor |
| | |
| | |
| v |
+ rocksdb +
\ / \ /
\ / \ /
\ / \ /
+-- market committer -+
```

Expand Down
2 changes: 1 addition & 1 deletion engine/src/executor/orderbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub struct OrderBook {
pub min_vol: Amount,
pub enable_market_order: bool,
pub open: bool,
max_id: OrderId,
pub max_id: OrderId,
}

#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
Expand Down
6 changes: 3 additions & 3 deletions engine/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ mod v1_to_v2 {
futures::executor::block_on(async move { Pool::connect_with(option).await.unwrap() });
let mut pendings = vec![];
let pool = std::sync::Arc::new(pool);
for (symbol, _) in data.orderbooks.iter() {
for (symbol, orderbook) in data.orderbooks.iter() {
let sql = format!(
"select * from t_order_{}_{} where f_status in (0, 3)",
symbol.0, symbol.1
"select * from t_order_{}_{} where f_status in (0, 3) and f_id <= {}",
symbol.0, symbol.1, orderbook.max_id,
);
let s = *symbol;
let p = pool.clone();
Expand Down

0 comments on commit df81c0f

Please sign in to comment.