Skip to content

Conversation

DoubleSpout
Copy link
Contributor

@DoubleSpout DoubleSpout commented Sep 10, 2025

When using etcd's cli:readdir, if the value in this path is too large (by default: exceeding 4MB), you will encounter the

following error:

rpc error: code = ResourceExhausted desc = grpc: received message larger than max (8653851 vs. 4194304).

Therefore, we need to read this directory in batches.

local cli, _ = etcd.new([option:table])

local res, err
local start_key = '/path/to/dir'
local last_key = start_key
local range_end = cli.rangeend(start_key)
local data = {}
while(1) do
    res, err = cli:readdir(last_key, {
        timeout = 3000,
        range_end = range_end,
        revision = -1,
        limit = 20, -- batch size 
        sort_order = 'ASCEND',
        sort_target = 'KEY',
    })
    -- error handle
    if err or not res then
        break
    end
    -- collect res.body
    table.insert(data, res.body)
    local last_kv_key = res.body.kvs[#res.body.kvs].key
    last_key = cli.nextkey(last_key)
    if not res.body.more then
        break
    end
end

for _, body in ipairs(data) do
    -- handle data
end

This commit also fixes some testing bugs in continuous integration, update ci image from ubuntu-20.04 to ubuntu-22.04.

@DoubleSpout
Copy link
Contributor Author

GitHub Actions has deprecated the Ubuntu 20.04 runner image ( ubuntu-20.04 ). The deprecation process began on February 1, 2025, and the image became fully unsupported on April 1, 2025.
This means that workflows in GitHub Actions using runs-on: ubuntu-20.04 will no longer be officially supported and may experience failures or unexpected behavior.
Reason for Deprecation:
The deprecation of ubuntu-20.04 is a standard practice as newer Long Term Support (LTS) versions of Ubuntu are released and become available as runner images (e.g., ubuntu-22.04, ubuntu-24.04). This ensures that the GitHub Actions environment remains up-to-date, secure, and compatible with the latest software and dependencies.
Action Required:
Users with workflows still utilizing ubuntu-20.04 are advised to migrate to a newer supported Ubuntu runner image, such as ubuntu-latest, ubuntu-22.04, or ubuntu-24.04, to ensure the continued functionality and stability of their CI/CD pipelines.

@DoubleSpout DoubleSpout force-pushed the master branch 5 times, most recently from ebf63cd to 6ef8997 Compare September 10, 2025 06:45
ignore grpc test case

fix test case

resume ci.yml

try to fix old unit test code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant