WL#12438: mysql-server-mock: exec_time for handshakes

Affects: Server-8.0   —   Status: Complete   —   Priority: Medium

Motivation

Testing timeout handling on network connections in MySQL Router involves simulating servers which are slow to connect.

Having a predictable slow server allows to verify that connect-timeouts are triggered in time.

The mysql-server-mock already handles the handshake of the classic protocol and supports simulating execution of responses for statements, but currently has no way to express the same for the handshake messages.

User Stories

  1. As a tester I want to delay messages of the handshakes to test timeout handling in the client applications.
  2. As a test-recorder I want replay handshakes with the same timing as they were capture to reproduce production environments in the lab.

Goal

  • added a exec_time handling to the messages of the handshake
  • allow to specify exec_time in .json and .js files.

Design Considerations

The schema changes should take into account that in the future other fields of the handshake may be specified in the tracefile, not just the exec_time of the initial connect.

FR1
exec_time MUST be settable from json files
FR2
exec_time MUST be settable from js files
FR3
initial packet MUST be delayed by specified exec_time
FR4
if not exec_time for the initial packet is specified, exec_time MUST be 0

tracefile changes

The tracefile gets new fields:

  • handshake (object) [optional]
  • handshake.greeting (object) [optional]
  • handshake.greeting.exec_time (positive number, milliseconds) [optional]

Example

{
  "handshake": {
    "greeting": {
      "exec_time": 23.423
    }
  },
  "stmts": [ ... ]
}