Add pipelined backfilling

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-03-10 11:22:24 +00:00
parent 681d7393d7
commit acfc0ca4c9
7 changed files with 258 additions and 105 deletions

View File

@@ -1,13 +1,13 @@
use std::sync::Arc;
use crate::{
cleanup, delete_where_symbols, optimize, select_where_symbols, types::Backfill, upsert,
cleanup, delete_where_symbols, optimize, select_where_symbols, types::Backfill, upsert_batch,
};
use clickhouse::{error::Error, Client};
use tokio::sync::Semaphore;
select_where_symbols!(Backfill, "backfills_bars");
upsert!(Backfill, "backfills_bars");
upsert_batch!(Backfill, "backfills_bars");
delete_where_symbols!("backfills_bars");
cleanup!("backfills_bars");
optimize!("backfills_bars");

View File

@@ -1,13 +1,13 @@
use std::sync::Arc;
use crate::{
cleanup, delete_where_symbols, optimize, select_where_symbols, types::Backfill, upsert,
cleanup, delete_where_symbols, optimize, select_where_symbols, types::Backfill, upsert_batch,
};
use clickhouse::{error::Error, Client};
use tokio::sync::Semaphore;
select_where_symbols!(Backfill, "backfills_news");
upsert!(Backfill, "backfills_news");
upsert_batch!(Backfill, "backfills_news");
delete_where_symbols!("backfills_news");
cleanup!("backfills_news");
optimize!("backfills_news");

View File

@@ -4,6 +4,8 @@ use crate::{delete_where_symbols, optimize, types::Bar, upsert, upsert_batch};
use clickhouse::Client;
use tokio::sync::Semaphore;
pub const BATCH_FLUSH_SIZE: usize = 100_000;
upsert!(Bar, "bars");
upsert_batch!(Bar, "bars");
delete_where_symbols!("bars");

View File

@@ -5,6 +5,8 @@ use clickhouse::{error::Error, Client};
use serde::Serialize;
use tokio::sync::Semaphore;
pub const BATCH_FLUSH_SIZE: usize = 500;
upsert!(News, "news");
upsert_batch!(News, "news");
optimize!("news");