From c20554ff49dc923530c1191a3cf2079e5532fcc8 Mon Sep 17 00:00:00 2001
From: tomwei7 <tomwei7g@gmail.com>
Date: Wed, 4 Sep 2024 17:19:25 +0800
Subject: [PATCH] export EventCacheCount on Canal Config

---
 canal/canal.go  | 1 +
 canal/config.go | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/canal/canal.go b/canal/canal.go
index 20e09952e..1ba0c5165 100644
--- a/canal/canal.go
+++ b/canal/canal.go
@@ -462,6 +462,7 @@ func (c *Canal) prepareSyncer() error {
 		Logger:                  c.cfg.Logger,
 		Dialer:                  c.cfg.Dialer,
 		Localhost:               c.cfg.Localhost,
+		EventCacheCount:         c.cfg.EventCacheCount,
 		RowsEventDecodeFunc: func(event *replication.RowsEvent, data []byte) error {
 			pos, err := event.DecodeHeader(data)
 			if err != nil {
diff --git a/canal/config.go b/canal/config.go
index e2b848f5e..16692287d 100644
--- a/canal/config.go
+++ b/canal/config.go
@@ -107,6 +107,11 @@ type Config struct {
 
 	// Set Localhost
 	Localhost string
+
+	// EventCacheCount is the capacity of the BinlogStreamer internal event channel.
+	// the default value is 10240.
+	// if you table contain large columns, you can decrease this value to avoid OOM.
+	EventCacheCount int
 }
 
 func NewConfigWithFile(name string) (*Config, error) {