Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
124637: sql: adjust memory limits in COPY a bit r=yuzefovich a=yuzefovich When deciding how many rows can be processed by COPY at once (meaning that a single KV BatchRequest will handle all of them), we use a fraction of the raft command size. This is needed so that we can safely perform the necessary writes without getting "command is too large" error. Previously, we would always use one third of the command size for COPY. However, this can be problematic when the table has multiple indexes since each input row will then get a separate InitPut command for each secondary index. As a result, we could be too optimistic when using the current fraction as we've seen the COPY roachtest occasionally fail with "command is too large". This commit attempts to alleviate this problem by making the fraction depend on the number of indexes: we still keep 1/3 as the upper bound that is used with no secondary indexes, but each secondary index deducts 1.5%, and we have the lower bound of 0.1 which is achieved at about 16 secondary indexes. Note that I still don't know why the roachtest failure is non-deterministic - perhaps it's due to hitting the intent tracking limit for a txn. Additionally, this commit introduces a cluster setting that controls this fraction, with the default value of 0 meaning using the strategy as described above. Fixes: cockroachdb#121413. Release note: None Co-authored-by: Yahor Yuzefovich <[email protected]>
- Loading branch information