sidorares / sidorares/node-mysql2

[Need help]Streamming rows problem

Open
#322 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs investigation question
Dominant language
TypeScript
Stars
4.4k
Forks
680
Avg merge
9h 7m
Merged PRs (30d)
59

Description

I'm using a pool, get one connection to fetch rows, use another one to update rows back to mysql.
When the dataset is very small, like 100 rows, it works. But when it's little bigger, it stuck, the updateRow seems never invoked.any one could help?

pool.getConnection(function (err, conn) {
    conn.query("SELECT * FROM table")
            .on('result', function (row) {
                conn.pause()
                updateRow(row, function(){conn.resume()}) //update it back
            })
})
function updateRow(row, resume) {
    pool.getConnection(function (err, conn) {
        conn.query('UPDATE table SET ....', function(err, result) {
            resume()
        })
    })   
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the pooled-connection streaming example from the issue with a small and larger dataset. Inspect how result streaming, conn.pause(), and pool.getConnection interact during the UPDATE callback. Done means identifying and documenting or fixing why updates stop being invoked, with a verified reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mysql, node.js
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.