Skip to content

Commit c0bdfd8

Browse files
authored
[bugfix] 支持同一个pipeline生成的数据同步到不同的es索引;
1 parent b87a2a8 commit c0bdfd8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

mysqlsmom.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def handle_binlog_stream(config):
166166
cache.set_log_file(binlogevent.next_binlog)
167167
cache.set_log_pos(binlogevent.position)
168168
else:
169-
print(binlogevent.packet.log_pos)
169+
print binlogevent.packet.log_pos
170170
for row in binlogevent.rows:
171171
event = {"host": binlogevent._ctl_connection.host, "schema": binlogevent.schema,
172172
"table": binlogevent.table,
@@ -191,7 +191,11 @@ def handle_binlog_stream(config):
191191
pipeline = job["pipeline"]
192192
rows = do_pipeline(pipeline, event["values"])
193193
dest = job["dest"]
194-
to_dest(dest, rows)
194+
if isinstance(dest, list):
195+
for d in dest:
196+
to_dest(d, rows)
197+
else:
198+
to_dest(dest, rows)
195199

196200
cache.set_log_pos(binlogevent.packet.log_pos)
197201
logging.info(json.dumps(event, cls=DateEncoder))
@@ -208,4 +212,4 @@ def handle_binlog_stream(config):
208212
if config_module.STREAM == "INIT":
209213
handle_init_stream(config_module)
210214
elif config_module.STREAM == "BINLOG":
211-
handle_binlog_stream(config_module)
215+
handle_binlog_stream(config_module)

0 commit comments

Comments
 (0)