-
Marc Alff authored
This change fixes issues affecting the socket instrumentation in general. 1) When a call to socket() fails, there is no socket created, but the performance schema instrumentation api mysql_socket_socket() did create instrumentation for the (non existent) socket anyway. This is a bug, that can: - cause statistical errors in various socket summaries, as there is an extra socket counted - cause leaks of instrumented sockets, because the extra socket created is not destroyed, - cause the socket_instance table to become full in the long term, causing the socket instrumentation to totally fail after a while. The fix is to only create instrumentation for a socket if creating the socket worked. 2) When creating instrumentation for a socket, the code calls: - init_socket(), to create instrumentation. - set_socket_info(), to set some attributes. Making both calls each time a socket is created is un necessary overhead. A more efficient way is to pass all the needed parameters to init_socket(), so that a single call creates an instrumented socket, with optional attributes if needed. This is a performance improvement, affecting the same area as 1) 3) When bind() fails for a socket, the instrumentation api mysql_socket_bind() did set attributes on the socket used in the bind, regardless of whether the bind operation actually worked or not. This can lead to a confusing instrumented state, where the performance schema reports that a socket is bound to a specific address, even when such operation failed. This is a minor bug, fixed in mysql_socket_bind().
Marc Alff authoredThis change fixes issues affecting the socket instrumentation in general. 1) When a call to socket() fails, there is no socket created, but the performance schema instrumentation api mysql_socket_socket() did create instrumentation for the (non existent) socket anyway. This is a bug, that can: - cause statistical errors in various socket summaries, as there is an extra socket counted - cause leaks of instrumented sockets, because the extra socket created is not destroyed, - cause the socket_instance table to become full in the long term, causing the socket instrumentation to totally fail after a while. The fix is to only create instrumentation for a socket if creating the socket worked. 2) When creating instrumentation for a socket, the code calls: - init_socket(), to create instrumentation. - set_socket_info(), to set some attributes. Making both calls each time a socket is created is un necessary overhead. A more efficient way is to pass all the needed parameters to init_socket(), so that a single call creates an instrumented socket, with optional attributes if needed. This is a performance improvement, affecting the same area as 1) 3) When bind() fails for a socket, the instrumentation api mysql_socket_bind() did set attributes on the socket used in the bind, regardless of whether the bind operation actually worked or not. This can lead to a confusing instrumented state, where the performance schema reports that a socket is bound to a specific address, even when such operation failed. This is a minor bug, fixed in mysql_socket_bind().
Loading