| 239 | } |
| 240 | |
| 241 | void MaterializeMetadata::transaction(const MySQLReplication::Position & position, const std::function<void()> & fun) |
| 242 | { |
| 243 | binlog_file = position.binlog_name; |
| 244 | binlog_position = position.binlog_pos; |
| 245 | executed_gtid_set = position.gtid_sets.toString(); |
| 246 | |
| 247 | if (!persistent_path.empty()) |
| 248 | { |
| 249 | String persistent_tmp_path = persistent_path + ".tmp"; |
| 250 | |
| 251 | { |
| 252 | WriteBufferFromFile out(persistent_tmp_path, DBMS_DEFAULT_BUFFER_SIZE, O_WRONLY | O_TRUNC | O_CREAT); |
| 253 | |
| 254 | /// TSV format metadata file. |
| 255 | writeString("Version:\t" + toString(meta_version), out); |
| 256 | writeString("\nBinlog File:\t" + binlog_file, out); |
| 257 | writeString("\nExecuted GTID:\t" + executed_gtid_set, out); |
| 258 | writeString("\nBinlog Position:\t" + toString(binlog_position), out); |
| 259 | |
| 260 | out.next(); |
| 261 | out.sync(); |
| 262 | out.close(); |
| 263 | } |
| 264 | |
| 265 | commitMetadata(std::move(fun), persistent_tmp_path, persistent_path); |
| 266 | } |
| 267 | else |
| 268 | fun(); |
| 269 | } |
| 270 | |
| 271 | void MaterializeMetadata::getTablesWithCreateQueryFromMySql(mysqlxx::PoolWithFailover::Entry & connection, |
| 272 | const String & database, |
no test coverage detected