fix(batch-processor): we didn't free stale object actually (#5700)

This commit is contained in:
罗泽轩 2021-12-06 10:02:13 +08:00 committed by GitHub
parent 319f6208ba
commit 4df272c548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 15 deletions

View File

@ -26,6 +26,7 @@ local format = string.format
local concat = table.concat
local buffers = {}
local ipairs = ipairs
local pairs = pairs
local tostring = tostring
local stale_timer_running = false
local timer_at = ngx.timer.at
@ -120,7 +121,7 @@ local function remove_stale_objects(premature)
return
end
for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))

View File

@ -18,7 +18,7 @@
local core = require("apisix.core")
local ngx = ngx
local tostring = tostring
local ipairs = ipairs
local pairs = pairs
local ngx_timer_at = ngx.timer.at
local http = require("resty.http")
local log_util = require("apisix.utils.log-util")
@ -128,7 +128,7 @@ local function remove_stale_objects(premature)
return
end
for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, route id:", tostring(key))
buffers[key] = nil

View File

@ -25,6 +25,7 @@ local plugin = require("apisix.plugin")
local ngx = ngx
local tostring = tostring
local ipairs = ipairs
local pairs = pairs
local timer_at = ngx.timer.at
local plugin_name = "http-logger"
@ -166,7 +167,7 @@ local function remove_stale_objects(premature)
return
end
for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))

View File

@ -23,7 +23,6 @@ local plugin = require("apisix.plugin")
local math = math
local pairs = pairs
local type = type
local ipairs = ipairs
local plugin_name = "kafka-logger"
local stale_timer_running = false
local timer_at = ngx.timer.at
@ -164,7 +163,7 @@ local function remove_stale_objects(premature)
return
end
for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))

View File

@ -28,7 +28,7 @@ local ngx_re = require("ngx.re")
local ngx = ngx
local tostring = tostring
local tonumber = tonumber
local ipairs = ipairs
local pairs = pairs
local timer_at = ngx.timer.at
local plugin_name = "skywalking-logger"
@ -130,7 +130,7 @@ local function remove_stale_objects(premature)
return
end
for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))

View File

@ -26,6 +26,7 @@ local tcp = ngx.socket.tcp
local buffers = {}
local tostring = tostring
local ipairs = ipairs
local pairs = pairs
local table = table
local schema = {
type = "object",
@ -116,7 +117,7 @@ local function remove_stale_objects(premature)
return
end
for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, route id:", tostring(key))
buffers[key] = nil

View File

@ -22,7 +22,7 @@ local logger_socket = require("resty.logger.socket")
local plugin_name = "syslog"
local ngx = ngx
local buffers = {}
local ipairs = ipairs
local pairs = pairs
local stale_timer_running = false;
local timer_at = ngx.timer.at
@ -121,7 +121,7 @@ local function remove_stale_objects(premature)
return
end
for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))

View File

@ -22,7 +22,7 @@ local tostring = tostring
local buffers = {}
local ngx = ngx
local tcp = ngx.socket.tcp
local ipairs = ipairs
local pairs = pairs
local stale_timer_running = false
local timer_at = ngx.timer.at
@ -106,7 +106,7 @@ local function remove_stale_objects(premature)
return
end
for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))

View File

@ -22,7 +22,7 @@ local tostring = tostring
local buffers = {}
local ngx = ngx
local udp = ngx.socket.udp
local ipairs = ipairs
local pairs = pairs
local stale_timer_running = false;
local timer_at = ngx.timer.at
@ -90,7 +90,7 @@ local function remove_stale_objects(premature)
return
end
for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))