Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
None
-
None
-
None
Description
I execute the following set of statements 3 times in a row:
CREATE TABLE t1 ( a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT NOT NULL) ;
|
INSERT INTO t1 (b) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
|
INSERT INTO t1 (b) SELECT t1a.b FROM t1 t1a, t1 t1b, t1 t1c, t1 t1d, t1 t1e, t1 t1f LIMIT 131064;
|
SELECT COUNT(*) FROM t1;
|
DROP TABLE t1;
|
wait for innodb to settle (for checkpoint age to become 0), and check memory consumption after each round.
Here are results for a server started in Galera context (as a new node):
Server options:
--innodb --default-storage-engine=innodb --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 --innodb_flush_log_at_trx_commit=0 --innodb_doublewrite=0 --binlog-format=row --log-bin=master-bin --wsrep_provider=/home/elenst/galera-23.2.1-src/libgalera_smm.so --wsrep_cluster_address=gcomm://?'gmcast.listen_addr=tcp://127.0.0.1:4567'
|
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
# Start
|
17380 elenst 20 0 863m 345m 9.8m S 0 4.3 0:00.47 mysqld
|
# After the 1st round
|
17380 elenst 20 0 1060m 603m 14m S 0 7.5 0:35.33 mysqld
|
# After the 2nd round
|
17380 elenst 20 0 1124m 648m 18m S 0 8.1 1:05.34 mysqld
|
# After the 3rd round
|
17380 elenst 20 0 1126m 659m 21m S 1 8.2 1:35.49 mysqld
|
So, we started and ended at the same point (dropped the table that we previously created and populated), however memory consumption has grown ~260 Mb
Nothing like that happens if the server is run in a standalone mode (with otherwise the same parameters):
Server options:
--innodb --default-storage-engine=innodb --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 --innodb_flush_log_at_trx_commit=0 --innodb_doublewrite=0 --binlog-format=row --log-bin=master-bin
|
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
# Start
|
17336 elenst 20 0 611m 318m 7468 S 0 4.0 0:02.41 mysqld
|
# After the 1st round
|
17336 elenst 20 0 615m 329m 9268 S 0 4.1 0:08.40 mysqld
|
# After the 2nd round
|
17336 elenst 20 0 615m 334m 9316 S 0 4.2 0:14.28 mysqld
|
# After the 3rd round
|
17336 elenst 20 0 615m 340m 9316 S 0 4.3 0:20.05 mysqld
|
bzr version-info:
revision-id: seppo.jaakola@codership.com-20120808224721-89h8nxmfk9uvp708
|
date: 2012-08-09 01:47:21 +0300
|
build-date: 2012-08-20 07:00:22 +0400
|
revno: 3343
|
Galera maintains "certification index" to help in tracking dependencies between transactions. This dependency information makes it possible e.g. to enable parallel applying with row level granularity in slave side.
This test will cause several table and row level entries to be appended in the certification index, and this probably accounts for the observed memory image growth. Galera does periodical pruning for the index, but it will be delayed process and does not show here.
To test for memory leaks, it makes sense to run long term SQL load and monitor that memory image will saturate at certain level. Or alternatively run under valgrind.