From 0aa8c8ef43f4dcb58bed626188106768eb5e346d Mon Sep 17 00:00:00 2001 From: WenyXu Date: Thu, 11 Jan 2024 17:50:18 +0000 Subject: [PATCH 1/2] fix: fix store all wal options --- src/common/meta/src/key/datanode_table.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/common/meta/src/key/datanode_table.rs b/src/common/meta/src/key/datanode_table.rs index 3000d56a5135..13a88e9ee9ef 100644 --- a/src/common/meta/src/key/datanode_table.rs +++ b/src/common/meta/src/key/datanode_table.rs @@ -178,15 +178,6 @@ impl DatanodeTableManager { let txns = distribution .into_iter() .map(|(datanode_id, regions)| { - let filtered_region_wal_options = regions - .iter() - .filter_map(|region_number| { - region_wal_options - .get(region_number) - .map(|wal_options| (*region_number, wal_options.clone())) - }) - .collect(); - let key = DatanodeTableKey::new(datanode_id, table_id); let val = DatanodeTableValue::new( table_id, @@ -195,7 +186,9 @@ impl DatanodeTableManager { engine: engine.to_string(), region_storage_path: region_storage_path.to_string(), region_options: region_options.clone(), - region_wal_options: filtered_region_wal_options, + // FIXME(weny): Before we store all region wal options into table metadata or somewhere, + // We must store all region wal options. + region_wal_options: region_wal_options.clone(), }, ); From e9b2aea7515c068748646dc7ac2cedf9b397ce66 Mon Sep 17 00:00:00 2001 From: WenyXu Date: Thu, 11 Jan 2024 18:40:51 +0000 Subject: [PATCH 2/2] fix: incorrect updating DatanodeTable value --- src/common/meta/src/key/datanode_table.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common/meta/src/key/datanode_table.rs b/src/common/meta/src/key/datanode_table.rs index 13a88e9ee9ef..9b5ec097b59b 100644 --- a/src/common/meta/src/key/datanode_table.rs +++ b/src/common/meta/src/key/datanode_table.rs @@ -236,7 +236,15 @@ impl DatanodeTableManager { if need_update { let key = DatanodeTableKey::new(datanode, table_id); let raw_key = key.as_raw_key(); - let val = DatanodeTableValue::new(table_id, regions, region_info.clone()) + // FIXME(weny): add unit tests. + let mut new_region_info = region_info.clone(); + if need_update_options { + new_region_info.region_options = new_region_options.clone(); + } + if need_update_wal_options { + new_region_info.region_wal_options = new_region_wal_options.clone(); + } + let val = DatanodeTableValue::new(table_id, regions, new_region_info) .try_as_raw_value()?; opts.push(TxnOp::Put(raw_key, val)); }