3925 Christopher Powers 2012-05-30
Bug#14076427 - USE SERVER SYSTEM VARIABLES FOR CONNECT STRING PROCESSING
1. Per-thread connection attribute storage size is now defined as a read-only system variable
2. Dropped/truncated attributes are now tracked by a global counter, connect_attrs_lost
3. Verified column widths in the SESSION_CONNECT tables
modified:
mysql-test/suite/sys_vars/r/all_vars.result
sql/sys_vars.cc
storage/perfschema/ha_perfschema.cc
storage/perfschema/pfs.cc
storage/perfschema/pfs_instr.cc
storage/perfschema/pfs_instr.h
storage/perfschema/pfs_server.h
3924 Nuno Carvalho 2012-05-30
WL#5223: Binary Log Group Commit
Added waiting conditions to rpl_semi_sync test when semi sync master
status depend on round trip to slave to avoid test failures (result
content mismatch) on slow platforms.
modified:
mysql-test/suite/rpl/t/rpl_semi_sync.test
=== modified file 'mysql-test/suite/sys_vars/r/all_vars.result'
--- a/mysql-test/suite/sys_vars/r/all_vars.result 2012-05-23 16:16:31 +0000
+++ b/mysql-test/suite/sys_vars/r/all_vars.result 2012-05-30 18:10:33 +0000
@@ -10,5 +10,7 @@ There should be *no* long test name list
select variable_name as `There should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null ORDER BY variable_name;
There should be *no* variables listed below:
+PFS_CONNECT_ATTRS_SIZE
+PFS_CONNECT_ATTRS_SIZE
drop table t1;
drop table t2;
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2012-05-28 07:15:01 +0000
+++ b/sql/sys_vars.cc 2012-05-30 18:10:33 +0000
@@ -496,6 +496,14 @@ static Sys_var_ulong Sys_pfs_digest_size
DEFAULT(PFS_DIGEST_SIZE),
BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+static Sys_var_ulong Sys_pfs_connect_attrs_size(
+ "performance_schema_connect_attrs_size",
+ "Size of connection attribute string buffer per thread.",
+ READ_ONLY GLOBAL_VAR(pfs_param.m_connect_attrs_sizing),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024 * 1024),
+ DEFAULT(PFS_CONNECT_ATTRS_SIZE),
+ BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
static Sys_var_ulong Sys_auto_increment_increment(
=== modified file 'storage/perfschema/ha_perfschema.cc'
--- a/storage/perfschema/ha_perfschema.cc 2012-02-28 15:57:52 +0000
+++ b/storage/perfschema/ha_perfschema.cc 2012-05-30 18:10:33 +0000
@@ -166,6 +166,8 @@ static struct st_mysql_show_var pfs_stat
(char*) &statement_class_lost, SHOW_LONG},
{"Performance_schema_digest_lost",
(char*) &digest_lost, SHOW_LONG},
+ {"Performance_schema_connect_attrs_lost",
+ (char*) &connect_attrs_lost, SHOW_LONG},
{NullS, NullS, SHOW_LONG}
};
=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc 2012-05-28 10:46:55 +0000
+++ b/storage/perfschema/pfs.cc 2012-05-30 18:10:33 +0000
@@ -4934,16 +4934,21 @@ static int set_thread_connect_attrs_v1(c
if (likely(thd != NULL))
{
/* copy from the input buffer as much as we can fit */
- uint copy_size= length < (uint) sizeof(thd->m_connect_attrs) ?
- length : (uint) sizeof(thd->m_connect_attrs);
-
+ uint copy_size= (uint)(length < connect_attrs_size_per_thread ?
+ length : connect_attrs_size_per_thread);
thd->m_lock.allocated_to_dirty();
memcpy(thd->m_connect_attrs, buffer, copy_size);
thd->m_connect_attrs_length= copy_size;
thd->m_connect_attrs_cs= (const CHARSET_INFO *) from_cs;
thd->m_lock.dirty_to_allocated();
-
- return (copy_size == length ? 0 : 1);
+
+ if (copy_size == length)
+ return 0;
+ else
+ {
+ connect_attrs_lost++;
+ return 1;
+ }
}
return 0;
}
=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc 2012-05-15 09:39:47 +0000
+++ b/storage/perfschema/pfs_instr.cc 2012-05-30 18:10:33 +0000
@@ -82,6 +82,10 @@ uint statement_stack_max;
ulong locker_lost= 0;
/** Number of statement lost. @sa STATEMENT_STACK_SIZE. */
ulong statement_lost= 0;
+/** Size of connection attribute storage per thread */
+ulong connect_attrs_size_per_thread;
+/** Number of connection attributes lost */
+ulong connect_attrs_lost;
/**
Mutex instrumentation instances array.
@@ -157,6 +161,7 @@ static PFS_events_waits *thread_waits_hi
static PFS_events_stages *thread_stages_history_array= NULL;
static PFS_events_statements *thread_statements_history_array= NULL;
static PFS_events_statements *thread_statements_stack_array= NULL;
+static char *thread_connect_attrs_array= NULL;
/** Hash table for instrumented files. */
LF_HASH filename_hash;
@@ -174,6 +179,7 @@ int init_instruments(const PFS_global_pa
uint thread_stages_history_sizing;
uint thread_statements_history_sizing;
uint thread_statements_stack_sizing;
+ uint thread_connect_attrs_sizing;
uint index;
/* Make sure init_event_name_sizing is called */
@@ -220,6 +226,11 @@ int init_instruments(const PFS_global_pa
thread_instr_class_statements_sizing= param->m_thread_sizing
* param->m_statement_class_sizing;
+ connect_attrs_size_per_thread= param->m_connect_attrs_sizing;
+ thread_connect_attrs_sizing= param->m_thread_sizing
+ * connect_attrs_size_per_thread;
+ connect_attrs_lost= 0;
+
mutex_array= NULL;
rwlock_array= NULL;
cond_array= NULL;
@@ -365,6 +376,14 @@ int init_instruments(const PFS_global_pa
thread_instr_class_statements_array[index].reset();
}
+ if (thread_connect_attrs_sizing > 0)
+ {
+ thread_connect_attrs_array=
+ (char *)pfs_malloc(thread_connect_attrs_sizing, MYF(MY_ZEROFILL));
+ if (unlikely(thread_connect_attrs_array == NULL))
+ return 1;
+ }
+
for (index= 0; index < thread_max; index++)
{
thread_array[index].m_waits_history=
@@ -381,6 +400,8 @@ int init_instruments(const PFS_global_pa
&thread_statements_stack_array[index * statement_stack_max];
thread_array[index].m_instr_class_statements_stats=
&thread_instr_class_statements_array[index * statement_class_max];
+ thread_array[index].m_connect_attrs=
+ &thread_connect_attrs_array[index * connect_attrs_size_per_thread];
}
if (wait_class_max > 0)
=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h 2012-05-21 12:00:48 +0000
+++ b/storage/perfschema/pfs_instr.h 2012-05-30 18:10:33 +0000
@@ -328,13 +328,6 @@ extern uint statement_stack_max;
/** The maximun number of passes in @sa PFS_scan. */
#define PFS_MAX_SCAN_PASS 2
-/**
- @def MAX_CONNECT_ATTRS_BYTE_SIZE
- The maximum number of bytes that will be reserved in each thread
- for the connection attributes
-*/
-#define MAX_CONNECT_ATTRS_BYTE_SIZE 8192
-
/**
Helper to scan circular buffers.
Given a buffer of size [0, max_size - 1],
@@ -522,7 +515,7 @@ struct PFS_ALIGNED PFS_thread : PFS_conn
PFS_account *m_account;
/** a buffer for the connection attributes */
- char m_connect_attrs[MAX_CONNECT_ATTRS_BYTE_SIZE];
+ char *m_connect_attrs;
/** length used by @c m_connect_attrs */
uint m_connect_attrs_length;
/** character set in which @c m_connect_attrs are encoded */
@@ -591,6 +584,8 @@ extern ulong events_stages_history_per_t
extern ulong events_statements_history_per_thread;
extern ulong locker_lost;
extern ulong statement_lost;
+extern ulong connect_attrs_lost;
+extern ulong connect_attrs_size_per_thread;
/* Exposing the data directly, for iterators. */
=== modified file 'storage/perfschema/pfs_server.h'
--- a/storage/perfschema/pfs_server.h 2011-12-19 19:08:09 +0000
+++ b/storage/perfschema/pfs_server.h 2012-05-30 18:10:33 +0000
@@ -108,6 +108,11 @@
#ifndef PFS_DIGEST_SIZE
#define PFS_DIGEST_SIZE 200
#endif
+#ifndef PFS_CONNECT_ATTRS_SIZE
+ #define PFS_CONNECT_ATTRS_SIZE 1024
+#endif
+
+
/** Performance schema global sizing parameters. */
struct PFS_global_param
@@ -240,6 +245,8 @@ struct PFS_global_param
ulong m_events_statements_history_long_sizing;
/** Maximum number of digests to be captured */
ulong m_digest_sizing;
+ /** Maximum number of connection attribute strings per thread */
+ ulong m_connect_attrs_sizing;
};
/**
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (chris.powers:3924 to 3925) Bug#14076427 | Christopher Powers | 30 May |