Пример #1
0
        public async Task DumpBinlogAsync(DatabaseConnection channel, ConnectionOptions options)
        {
            long     serverId = options.Blocking ? options.ServerId : 0;
            ICommand command  = null;

            if (options.Binlog.StartingStrategy == StartingStrategy.FromGtid)
            {
                command = new DumpBinlogGtidCommand(serverId, options.Binlog.Filename, options.Binlog.Position, options.Binlog.Gtid);
            }
            else
            {
                command = new DumpBinlogCommand(serverId, options.Binlog.Filename, options.Binlog.Position);
            }

            await channel.WriteCommandAsync(command, 0);
        }
Пример #2
0
        public async Task DumpBinlogAsync(DatabaseConnection channel, ConnectionOptions options, CancellationToken cancellationToken = default)
        {
            long     serverId = options.Blocking ? options.ServerId : 0;
            ICommand command  = null;

            if (options.Binlog.StartingStrategy == StartingStrategy.FromGtid)
            {
                var gtidSet = (GtidSet)options.Binlog.GtidState;
                command = new DumpBinlogGtidCommand(serverId, options.Binlog.Filename, options.Binlog.Position, gtidSet);
            }
            else
            {
                command = new DumpBinlogCommand(serverId, options.Binlog.Filename, options.Binlog.Position);
            }

            await channel.WriteCommandAsync(command, 0, cancellationToken);
        }
Пример #3
0
        public async Task DumpBinlogAsync(DatabaseConnection channel, ConnectionOptions options)
        {
            await channel.WriteCommandAsync(new QueryCommand("SET @mariadb_slave_capability=4"), 0);

            var packet = await channel.ReadPacketSlowAsync();

            ThrowIfErrorPacket(packet, $"Setting @mariadb_slave_capability error.");

            if (options.Binlog.StartingStrategy == StartingStrategy.FromGtid)
            {
                await RegisterGtidSlave(channel, options);
            }

            long serverId = options.Blocking ? options.ServerId : 0;
            var  command  = new DumpBinlogCommand(serverId, options.Binlog.Filename, options.Binlog.Position);
            await channel.WriteCommandAsync(command, 0);
        }