Fix: Large table causes sql error#2242
Conversation
410c7ff to
e497d0b
Compare
4e43530 to
f792683
Compare
3eb630d to
491ee41
Compare
b0c0685 to
b26b1e0
Compare
f599f40 to
8ca7e61
Compare
8ca7e61 to
5ce5c0f
Compare
b26b1e0 to
696cb1a
Compare
006839e to
75d3196
Compare
691a826 to
45ae426
Compare
45ae426 to
2dfe1f2
Compare
2a8feb5 to
deb1979
Compare
deb1979 to
c6912b7
Compare
c86e7ec to
cfc722b
Compare
There was a problem hiding this comment.
This import path writes cells directly via the cell mapper, bypassing Row2Mapper, so tables_row_sleeves.cached_cells is never populated for imported rows?
There was a problem hiding this comment.
I didn't get the context. Is it the same as #2242 (comment) ? Otherwise can you provide affected method names?
| $row->setLastEditAt($sleeve['last_edit_at']); | ||
| $row->setTableId((int)$sleeve['table_id']); | ||
|
|
||
| $cachedCells = json_decode($sleeve['cached_cells'] ?? '{}', true); |
There was a problem hiding this comment.
RowService::importRow and TablesMigrator::importRowCells write sleeves and cells directly without setting cached_cells, and the repair step won't re-run (the cachingSleeveCellsComplete flag is already set), so those rows come back blank, i think. Is it better to fallback to NormalizedRowLoader?
There was a problem hiding this comment.
we should update the migration name. It's been so long since this was started, new migrations have been added now
There was a problem hiding this comment.
updated. Also bumped version from 2.2 to 2.3
| @@ -768,9 +670,12 @@ public function update(Row2 $row, ?string $userId = null): Row2 { | |||
| $this->columnMapper->preloadColumns(array_column($changedCells, 'columnId')); | |||
|
|
|||
| // write all changed cells to its db-table | |||
| $cachedCells = $sleeve->getCachedCellsArray(); | |||
| foreach ($changedCells as $cell) { | |||
| $this->insertOrUpdateCell($sleeve->getId(), $cell['columnId'], $cell['value']); | |||
| $cachedCells[$cell['columnId']] = $this->insertOrUpdateCell($sleeve->getId(), $cell['columnId'], $cell['value']); | |||
| } | |||
| $sleeve->setCachedCellsArray($cachedCells); | |||
| $this->rowSleeveMapper->update($sleeve); | |||
There was a problem hiding this comment.
update() writes the sleeve twice per row edit. Can we fold the metadata change and the cached_cells update into a single update() call.
There was a problem hiding this comment.
I did some changes here, testing now.
TBH would be nice to wrap all this db changes into a transaction. But this is completely separate topic
|
|
||
| /** | ||
| * @param int[] $ids | ||
| * @return RowSleeve[] |
There was a problem hiding this comment.
confused why raw data is better performance
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
cfc722b to
0d16156
Compare
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
e974ce9 to
7f43314
Compare
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
7f43314 to
a150684
Compare

This PR built on top of #2238.
Closes #1490.
It fixes loading of the large tables. Right now it is not possible to load a table with 30k rows and 8 columns due to an error:
PR contains 2 commits: fix itself and performance improvement.
I've measured latency for a various scenarios for
/row/table/{tableId}endpoint:📹 Video for performance comparison
Next step: move filtering/sorting/pagination to BE side and speedup FE. But this is completely separate topic which will be implemented in upcoming PRs.