WL#2726: Allow compression when using mysqlbinlog against remote server

Affects: Server-8.0   —   Status: Complete

EXECUTIVE SUMMARY
=================

This worklog enables protocol compression for mysqlbinlog. After
this worklog is implemented the user will be able to connect to a
remote server using mysqlbinlog and request protocol compression
support while transfering binary logs over the network.

USER/DEV STORIES
================

- As a MySQL user I want to use MySQL protocol compression over the
  network when transferring binary logs using the mysqlbinlog tool so
  that I save network bandwidth consumption.

SCOPE
=====

This work is about enabling protocol compression in mysqlbinlog. It
is not about implementing binary log compression at rest. This means
that we will focus on just implementing protocol compression that
tools such as the mysql client and mysqldump already support. This is
really a small patch.

FUNCTIONAL REQUIREMENTS
=======================

F1. If use specifies in the command line the compression flag "-C"
    then protocol compression SHALL be enabled for the communication
    between the mysqlbinlog client tool and the server.

F2. If use specifies in the command line the compression flag
    "--compress" then protocol compression SHALL be enabled for the
    communication between the mysqlbinlog client tool and the server.
SUMMARY OF THE APPROACH
=======================

The work is to simply add the compression flag to the command line
options for mysqlbinlog. If the flag is set by the user, then when
establishing the connection to the remote server, the connection
options will include MYSQL_OPT_COMPRESS.

SECURITY CONTEXT
================

No change in security context and no relevant impact here.

UPGRADE/DOWNGRADE and CROSS-VERSION REPLICATION
===============================================

No impact on upgrade/downgrade. For cross-version inter-operability,
this represents no problem, since the MySQL protocol already supports
compression for a long time and has a framework to negotiate
capabilities between peers. So, we are just adding a way to specify
that mysqlbinlog asks for compression support when connecting to the
server.

USER INTERFACE
==============

A new command line option to mysqlbinlog is added:

- NAME: --compress / -C
- TYPE: BOOL
- VALUE: N/A
- DEFAULT: FALSE
- REPLICATED: N/A
- DYNAMIC: N/A
- PERSIST: N/A
- DESCRIPTION: "Use compression in server/client protocol."

Note that this option is symmetric to those in mysql and
mysqldump. Therefore, the description and type are the same when
compared to those other client tools.

OBSERVABILITY
=============

N/A

DEPLOYMENT and INSTALLATION
===========================

Nothing to be done here. It is just that mysqlbinlog gets a new CLI
option.

PROTOCOL
========

mysqlbinlog will now be able to ask for protocol level compression
when connecting to the server. But no real change at the protocol
level.

FAILURE MODEL SPECIFICATION
===========================

N/A
BLOCK DIAGRAM
=============

N/A

INTERFACE SPECIFICATION
=======================

No realy interface specficiation is needed. However, the client API is
going to be engaged. We shall be adding the compression flags where
needed:

+  if (opt_compress)
+  {
+    /* Will use compression */
+    mysql_options(&mysql, MYSQL_OPT_COMPRESS, NullS);
+    client_flag |= CLIENT_COMPRESS;
+  }


DESIGN IMPLEMENTATION STEPS
===========================

1. Add a global var: opt_compress
2. Add a new CLI option: opt_compress
3. Deploy the flag in the client connection if compression option is
   activated by the user