-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
45282: import,backup,engine: re-work bulk "row" counting r=dt a=dt Bulk operations use a low-level – c++ in some cases – row counter to track what they process, such as how many rows are backed up, how many bytes are imported, etc. While iterating individual KVs during an export or import operation, a counter inspects each KV to maintain the count of rows, index entries and total data size processed. As mentioned above, these is done at a very low-level for performance reasons, for example in BACKUP the entire construction of the resulting data files is pushed all the way down to c++ so a single cgo call can iterate directly from rocksdb into the result file. Thus this "row" counter is a simple utility and doesn't use our higher level SQL decoding libraries which use the actual table metadata, and instead used a hardcoded comparison of the extracted index ID to 1 to determine if that KV belonged to the primary key and this represented a "row". However, with the addition of ALTER PRIMARY KEY in 20.1, this logic that assumes ID 1 is the PK is no longer correct: the PK have ID 7 in one table and ID 4 in another table. To fix this the row counter now just counts how many entries it sees in each index of each table, returning these to the caller and letting it decide which, if any, it wants to call out as 'rows' based on its knowledge of which indexes are primary vs secondary. Fixes #44998. Release note: none. Co-authored-by: David Taylor <[email protected]>
- Loading branch information
Showing
19 changed files
with
1,426 additions
and
880 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.