Skip to content

Commit 0ece561

Browse files
committed
address PR comments
1 parent 67d43cb commit 0ece561

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

kernel/src/table_changes/log_replay.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,14 @@ fn process_cdf_commit(
183183
};
184184

185185
visitor.visit_rows_of(actions.as_ref())?;
186-
let has_metadata = visitor.metadata.is_some();
186+
let metadata_changed = visitor.metadata.is_some();
187187
match (visitor.protocol, visitor.metadata) {
188-
(None, None) => {}
189-
(p, m) => {
190-
let p = p.unwrap_or_else(|| table_configuration.protocol().clone());
191-
let m = m.unwrap_or_else(|| table_configuration.metadata().clone());
188+
(None, None) => {} // no change
189+
(protocol, metadata) => {
190+
// at least one of protocol and metadata changed, so update the table configuration
192191
*table_configuration = TableConfiguration::try_new(
193-
m,
194-
p,
192+
metadata.unwrap_or_else(|| table_configuration.metadata().clone()),
193+
protocol.unwrap_or_else(|| table_configuration.protocol().clone()),
195194
table_configuration.table_root().clone(),
196195
commit_file.version,
197196
)?;
@@ -200,7 +199,7 @@ fn process_cdf_commit(
200199
}
201200
}
202201
}
203-
if has_metadata {
202+
if metadata_changed {
204203
require!(
205204
table_schema.as_ref() == table_configuration.schema(),
206205
Error::change_data_feed_incompatible_schema(

0 commit comments

Comments
 (0)