| 735 | } |
| 736 | |
| 737 | void MaterializedMySQLSyncThreadManager::initialize() |
| 738 | { |
| 739 | setSyncType(MaterializedMySQLSyncType::PreparingSync); |
| 740 | auto manager_metadata = catalog->getOrSetMaterializedMySQLManagerMetadata(storage_id); |
| 741 | |
| 742 | /// Update materialized_tables_list with include/exclude setting |
| 743 | updateSyncTableList(); |
| 744 | |
| 745 | if (manager_metadata->dumped_first_time()) |
| 746 | { |
| 747 | updateResyncTables(); |
| 748 | manager_metadata->clear_materialized_tables(); |
| 749 | for (const auto & name: materialized_tables_list) |
| 750 | manager_metadata->add_materialized_tables(name); |
| 751 | catalog->updateMaterializedMySQLManagerMetadata(storage_id, *manager_metadata); |
| 752 | } |
| 753 | else |
| 754 | initializeMaterializedMySQL(manager_metadata); |
| 755 | |
| 756 | if (materialized_tables_list.empty()) |
| 757 | { |
| 758 | LOG_WARNING(log, "No tables found in mysql to be synced"); |
| 759 | return; |
| 760 | } |
| 761 | |
| 762 | /// here the tables have been created and dumped for the first time |
| 763 | std::lock_guard resync_lock(resync_mutex); |
| 764 | std::lock_guard lock(status_info_mutex); |
| 765 | |
| 766 | threads_info.clear(); |
| 767 | for (const auto & table : materialized_tables_list) |
| 768 | { |
| 769 | threads_info.emplace_back(); |
| 770 | auto & thread_info = threads_info.back(); |
| 771 | thread_info = std::make_shared<SyncThreadScheduleInfo>(); |
| 772 | |
| 773 | thread_info->assigned_materialized_table = table; |
| 774 | |
| 775 | if (manager_metadata->dumped_first_time() && !resync_tables.count(table)) |
| 776 | getBinlogMetadataFromCatalog(thread_info->binlog_info, table); |
| 777 | } |
| 778 | resync_table_task->activateAndSchedule(); |
| 779 | } |
| 780 | |
| 781 | void MaterializedMySQLSyncThreadManager::createReadonlyReplicaClient(const String & replica_info, const String & mysql_database_name) |
| 782 | { |
nothing calls this directly
no test coverage detected