Skip to content

Call stack size exceeded with r.args #11

@Calavoow

Description

@Calavoow

In the case where we want to update 100k documents by id at once, we want to perform a selection on 100k ids. However, the JavaScript library throws an Error when constructing a getAll(...ids) where ids.length === 1e6:

    RangeError: Uncaught error: Maximum call stack size exceeded
    at /.../node_modules/rethinkdb/ast.js:1087:43
    at Table.RDBVal.getAll (/.../node_modules/rethinkdb/ast.js:1089:7)
    ....

To resolve this error I made a proof of concept modification to the ast.coffee library file that supports such large operations without giving an error. It is available here: https://gist.github.com/Calavoow/714705fa6bdeeb2479af6f2db531be76/. When calling getAll(ids) (note: no rest arguments) the query completes successfully. Thus RethinkDB itself is able to handle this operation, but the JavaScript interface is not.

Of course this poses is an issue for indices that are arrays. But I think it would be a good addition to support large selections so that batch updates do not have to be chunked. Honestly, to us it seems that getAll should rather take indices as elements of an array rather than arguments. Since it maps a list of ids to a list of results. It would be the list analogue of get. I.e. getAll = [ids].map(get). Alternatively, another operator could be introduced requiring the ids as a list. For example a getBatch function.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions