session, executor: support setting tidb_enable_stmt_summary in session scope #12217 #12308
cherry-pick #12217 to release-3.0, with little conflict-resolve
What problem does this PR solve?
Support setting tidb_enable_stmt_summary in session scope. It was only supported in global scope. Actually, session scope here equals server scope, and global scope here equals cluster scope.
What is changed and how it works?
When statement summary is enabled in global scope, it'll work immediately on the current server and work in 2 seconds on the other servers in the cluster.