do not pad tx during sync phase

This commit is contained in:
Peter Zhang 2024-11-06 18:43:41 +08:00
parent 3fd800275a
commit ce7a320098
2 changed files with 8 additions and 6 deletions

View File

@ -63,22 +63,22 @@ impl<T: ?Sized + Configurable> ConfigurableExt for T {}
impl Configurable for LogManager { impl Configurable for LogManager {
fn get_config(&self, key: &[u8]) -> Result<Option<Vec<u8>>> { fn get_config(&self, key: &[u8]) -> Result<Option<Vec<u8>>> {
Ok(self.flow_db.get(COL_MISC, key)?) Ok(self.data_db.get(COL_MISC, key)?)
} }
fn set_config(&self, key: &[u8], value: &[u8]) -> Result<()> { fn set_config(&self, key: &[u8], value: &[u8]) -> Result<()> {
self.flow_db.put(COL_MISC, key, value)?; self.data_db.put(COL_MISC, key, value)?;
Ok(()) Ok(())
} }
fn remove_config(&self, key: &[u8]) -> Result<()> { fn remove_config(&self, key: &[u8]) -> Result<()> {
Ok(self.flow_db.delete(COL_MISC, key)?) Ok(self.data_db.delete(COL_MISC, key)?)
} }
fn exec_configs(&self, tx: ConfigTx) -> Result<()> { fn exec_configs(&self, tx: ConfigTx) -> Result<()> {
let mut db_tx = self.flow_db.transaction(); let mut db_tx = self.data_db.transaction();
db_tx.ops = tx.ops; db_tx.ops = tx.ops;
self.flow_db.write(db_tx)?; self.data_db.write(db_tx)?;
Ok(()) Ok(())
} }

View File

@ -62,6 +62,7 @@ pub struct UpdateFlowMessage {
pub struct LogManager { pub struct LogManager {
pub(crate) flow_db: Arc<dyn ZgsKeyValueDB>, pub(crate) flow_db: Arc<dyn ZgsKeyValueDB>,
pub(crate) data_db: Arc<dyn ZgsKeyValueDB>,
tx_store: TransactionStore, tx_store: TransactionStore,
flow_store: Arc<FlowStore>, flow_store: Arc<FlowStore>,
merkle: RwLock<MerkleManager>, merkle: RwLock<MerkleManager>,
@ -635,7 +636,7 @@ impl LogManager {
config: LogConfig, config: LogConfig,
executor: task_executor::TaskExecutor, executor: task_executor::TaskExecutor,
) -> Result<Self> { ) -> Result<Self> {
let tx_store = TransactionStore::new(flow_db_source.clone())?; let tx_store = TransactionStore::new(data_db_source.clone())?;
let flow_db = Arc::new(FlowDBStore::new(flow_db_source.clone())); let flow_db = Arc::new(FlowDBStore::new(flow_db_source.clone()));
let data_db = Arc::new(FlowDBStore::new(data_db_source.clone())); let data_db = Arc::new(FlowDBStore::new(data_db_source.clone()));
let flow_store = Arc::new(FlowStore::new(data_db.clone(), config.flow.clone())); let flow_store = Arc::new(FlowStore::new(data_db.clone(), config.flow.clone()));
@ -743,6 +744,7 @@ impl LogManager {
let mut log_manager = Self { let mut log_manager = Self {
flow_db: flow_db_source, flow_db: flow_db_source,
data_db: data_db_source,
tx_store, tx_store,
flow_store, flow_store,
merkle, merkle,