-
Notifications
You must be signed in to change notification settings - Fork 177
Description
Hi @osheroff
There is a long ago memory leak issue in EventDeserializer caused by tableMapEventByTableId. I saw you fixed it by using a bounded map which has size limit of 10000
code here:
Line 69 in a93b785
this.tableMapEventByTableId = new LRUCache<>(100, 0.75f, 10000); |
It can avoid the huge memory usage when there are large amount of tables in one MySQL instance, but it still could take a lot of memory if this map is almost full. We got this issue in Debezium.
However, according to this post: https://dba.stackexchange.com/questions/51873/replication-binary-log-parsingtableid-generation-on-delete-cascade-handling
(a better investigation post but in Chinese: http://blog.chinaunix.net/uid-26896862-id-3329896.html)
Table id is not a constant value in one MySQL instance, it will assign a new id when there is no cached table id found, or roll to a new id when the cache in MySQL server my_hash_search_using_hash_value
is full. Thus, it is not necessary keeping this tableMapEventByTableId map all the time.
I have a fix for this issue by just cleaning this map regularly after receiving a MySQL binlog ROTATE event (definition here: https://dev.mysql.com/doc/internals/en/event-meanings.html)