Fix comments.
Fix a bug in make_valid().
Change sync time (when the average should be pushed to the server EMA)
to only depend on time, not use sample_max. This decreases the amount of
sync calls, and allows for a much shorter sync time. Testing shows this to be
more stabel and allow better control of the sample_max.
As buffers are meant to be used only within a particular session, the
atomic operations are no longer necessary and can thus be removed. This
removes the extra overhead that the atomic operations add.
By biasing the values of all counter type scores to positive integers, the
server weights are always taken into use.
This fixes the case when weights were ignored until all score base values
were larger than zero (the mxs922_server test).
If the DCB is closed in handleError, it would be NULL in closeSession. To
only close the DCB in one place, the handleError can be reduced to writing
an error to the client and marking the failure as a fatal one.
The reads now read as much of the data as is available to reduce the
number of distinct malloc calls that need to be made. The SSL_read also
now allocates the buffer before reading into it so that the amount of
copying is reduced.
Also removed some of the not quite helpful debug messages.
No longer writes events to the master, as this creates problems if the
promoted server was not the overall master. Instead, the slave status
output is inspected.
If the log file is successfully opened, both stdout and stderr are
redirected to it. This helps catch ASAN reports without having to read the
system journal files.
As the output is redirected to a file, some of the output was made visible
only in non-daemon mode. This helps keep the log file clean and readable.
The client connections had the Nagle algorithm enabled which could cause
bad performance with smaller workloads. The common network configuration
code in utils.cc, currently used by the backend connections, sets it
properly.
Clean up, comments and enhancements. StopWatch lap() didn't mean lap-time, but elapsed time. Changed meaning to lap-time and added split() for split-time.
Cherry-picking the commit from develop since it's also needed for 2.2.
FindASAN did not look for so version 5 and TSAN referred to ASAN. Disable
leak checks for unit tests as some objects always leak, namely servers.