@@ -33,7 +33,7 @@ BinlogReader::BinlogReader(Connection& connection, index::Index& index,
3333 storage::DocumentStore& doc_store, config::TableConfig table_config,
3434 const Config& config)
3535 : connection_(connection),
36- multi_table_mode_ ( false ),
36+
3737 index_ (&index),
3838 doc_store_(&doc_store),
3939 table_config_(std::move(table_config)),
@@ -441,13 +441,13 @@ bool BinlogReader::EvaluateRequiredFilters(
441441
442442 // Check each required filter condition
443443 for (const auto & required_filter : table_config.required_filters ) {
444- auto it = filters.find (required_filter.name );
445- if (it == filters.end ()) {
444+ auto filter_iter = filters.find (required_filter.name );
445+ if (filter_iter == filters.end ()) {
446446 spdlog::warn (" Required filter column '{}' not found in binlog event" , required_filter.name );
447447 return false ;
448448 }
449449
450- if (!CompareFilterValue (it ->second , required_filter)) {
450+ if (!CompareFilterValue (filter_iter ->second , required_filter)) {
451451 return false ;
452452 }
453453 }
@@ -482,7 +482,7 @@ std::unordered_map<std::string, storage::FilterValue> BinlogReader::ExtractAllFi
482482}
483483
484484bool BinlogReader::CompareFilterValue (const storage::FilterValue& value,
485- const config::RequiredFilterConfig& filter) const {
485+ const config::RequiredFilterConfig& filter) {
486486 // Handle NULL checks
487487 if (filter.op == " IS NULL" ) {
488488 return std::holds_alternative<std::monostate>(value);
@@ -502,54 +502,72 @@ bool BinlogReader::CompareFilterValue(const storage::FilterValue& value,
502502 int64_t val = std::get<int64_t >(value);
503503 int64_t target = std::stoll (filter.value );
504504
505- if (filter.op == " =" )
505+ if (filter.op == " =" ) {
506506 return val == target;
507- if (filter.op == " !=" )
507+ }
508+ if (filter.op == " !=" ) {
508509 return val != target;
509- if (filter.op == " <" )
510+ }
511+ if (filter.op == " <" ) {
510512 return val < target;
511- if (filter.op == " >" )
513+ }
514+ if (filter.op == " >" ) {
512515 return val > target;
513- if (filter.op == " <=" )
516+ }
517+ if (filter.op == " <=" ) {
514518 return val <= target;
515- if (filter.op == " >=" )
519+ }
520+ if (filter.op == " >=" ) {
516521 return val >= target;
522+ }
517523
518524 } else if (std::holds_alternative<double >(value)) {
519525 // Float comparison
520526 double val = std::get<double >(value);
521527 double target = std::stod (filter.value );
522528
523- if (filter.op == " =" )
529+ if (filter.op == " =" ) {
524530 return std::abs (val - target) < 1e-9 ;
525- if (filter.op == " !=" )
531+ }
532+ if (filter.op == " !=" ) {
526533 return std::abs (val - target) >= 1e-9 ;
527- if (filter.op == " <" )
534+ }
535+ if (filter.op == " <" ) {
528536 return val < target;
529- if (filter.op == " >" )
537+ }
538+ if (filter.op == " >" ) {
530539 return val > target;
531- if (filter.op == " <=" )
540+ }
541+ if (filter.op == " <=" ) {
532542 return val <= target;
533- if (filter.op == " >=" )
543+ }
544+ if (filter.op == " >=" ) {
534545 return val >= target;
546+ }
535547
536548 } else if (std::holds_alternative<std::string>(value)) {
537549 // String comparison
538- const std::string & val = std::get<std::string>(value);
550+ const auto & val = std::get<std::string>(value);
539551 const std::string& target = filter.value ;
540552
541- if (filter.op == " =" )
553+ if (filter.op == " =" ) {
542554 return val == target;
543- if (filter.op == " !=" )
555+ }
556+ if (filter.op == " !=" ) {
544557 return val != target;
545- if (filter.op == " <" )
558+ }
559+ if (filter.op == " <" ) {
546560 return val < target;
547- if (filter.op == " >" )
561+ }
562+ if (filter.op == " >" ) {
548563 return val > target;
549- if (filter.op == " <=" )
564+ }
565+ if (filter.op == " <=" ) {
550566 return val <= target;
551- if (filter.op == " >=" )
567+ }
568+ if (filter.op == " >=" ) {
552569 return val >= target;
570+ }
553571
554572 } else if (std::holds_alternative<uint64_t >(value)) {
555573 // Datetime/timestamp (stored as uint64_t epoch)
@@ -560,18 +578,24 @@ bool BinlogReader::CompareFilterValue(const storage::FilterValue& value,
560578 // TODO: Add proper datetime parsing if needed
561579 uint64_t target = std::stoull (filter.value );
562580
563- if (filter.op == " =" )
581+ if (filter.op == " =" ) {
564582 return val == target;
565- if (filter.op == " !=" )
583+ }
584+ if (filter.op == " !=" ) {
566585 return val != target;
567- if (filter.op == " <" )
586+ }
587+ if (filter.op == " <" ) {
568588 return val < target;
569- if (filter.op == " >" )
589+ }
590+ if (filter.op == " >" ) {
570591 return val > target;
571- if (filter.op == " <=" )
592+ }
593+ if (filter.op == " <=" ) {
572594 return val <= target;
573- if (filter.op == " >=" )
595+ }
596+ if (filter.op == " >=" ) {
574597 return val >= target;
598+ }
575599 }
576600
577601 spdlog::warn (" Unsupported filter value type for comparison" );
@@ -586,14 +610,14 @@ bool BinlogReader::ProcessEvent(const BinlogEvent& event) {
586610
587611 if (multi_table_mode_) {
588612 // Multi-table mode: lookup table from event
589- auto it = table_contexts_.find (event.table_name );
590- if (it == table_contexts_.end ()) {
613+ auto table_iter = table_contexts_.find (event.table_name );
614+ if (table_iter == table_contexts_.end ()) {
591615 // Event is for a table we're not tracking, skip silently
592616 return true ;
593617 }
594- current_index = it ->second ->index .get ();
595- current_doc_store = it ->second ->doc_store .get ();
596- current_config = &it ->second ->config ;
618+ current_index = table_iter ->second ->index .get ();
619+ current_doc_store = table_iter ->second ->doc_store .get ();
620+ current_config = &table_iter ->second ->config ;
597621 } else {
598622 // Single-table mode: skip events for other tables
599623 if (event.table_name != table_config_.name ) {
0 commit comments