2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-23 01:53:28 +00:00

Avoid inifinite replay loop on bad previouslogfile

If circumstances result in a log file after rollover
pointing at itself, break out rather than looping trying
to get the same data from itself.
This commit is contained in:
Jarrod Johnson 2016-10-18 11:18:57 -04:00
parent 7f9394b33a
commit 4eaab9db37

View File

@ -613,8 +613,14 @@ class Logger(object):
struct.unpack(">BBIHIBBH", recbytes)
# rolling events found.
if ltype == DataTypes.event and evtdata == Events.logrollover:
textpath, binpath = parse_last_rolling_files(textfile, offset,
datalen)
txtpath, bpath = parse_last_rolling_files(textfile, offset,
datalen)
if txtpath == textpath:
break
if bpath == binpath:
break
textpath = txtpath
binpath = bpath
# Rolling event detected, close the current bin file, then open
# the renamed bin file.
flock(binfile, LOCK_UN)