Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Refactor SQL chunk processing to reduce memory errors #699

Merged
merged 6 commits into from
Feb 20, 2025

Conversation

hoshinotsuyoshi
Copy link
Member

@hoshinotsuyoshi hoshinotsuyoshi commented Feb 7, 2025

User description

closes #410
closes #688

♻️ Refactor SQL chunk processing to reduce memory errors

This refactor increases the likelihood of processing larger .sql files without encountering memory errors.

  • Updated processor to improve error handling and prevent unnecessary semicolon-related logic.
  • Modified processSQLInChunks to track read offsets and adjust chunk sizes dynamically.
  • Improved test cases to ensure SQL chunks are processed correctly, even when split mid-statement.

Cons:

The processing time for mastodon db/structure.sql liam-hq's pg_dump increases 😭( 0.84s -> 4.54s ). (It has not only DDLs, but also a little DMLs.) Reducing the chunk size has resulted in more frequent calls to the parse function. This might lead to more .sql files timing out in erd-web. However, since it reduces the likelihood of errors, I still want to proceed with this change.

Related Issue

Testing

$ pnpm build
$ cd ./frontend/packages/cli
$ time node dist-cli/bin/cli.js erd build --input <sql file> --format=postgres

result:

main branch ( on 0cda4f4 ) :

target lines source result
gitlab db/structure.sql 40052 URL ❌ see #410
my supabase initial pg_dump 5063 1 ❌ see #688
mastodon db/structure.sql, liam-hq's pg_dump 7852 2 ✅ 0.84s
liam-hq/liam sample (./fixtures/input.sql) 11 URL ✅ 0.48s

this PR branch ( on 7e3a65d ) :

target lines source result, time
gitlab db/structure.sql 40052 URL ✅ 38.80s
my supabase initial pg_dump 5063 1 ✅ 7.24s
mastodon db/structure.sql, liam-hq's pg_dump 7852 2 ✅ 4.54s
liam-hq/liam sample (./fixtures/input.sql) 11 URL ✅ 0.51s

Other Information


PR Type

Enhancement, Tests


Description

  • Refactored SQL chunk processing to reduce memory errors.

    • Adjusted chunk size dynamically and improved error handling.
    • Introduced logic to handle incomplete SQL statements in chunks.
  • Enhanced test cases for SQL chunk processing.

    • Added tests for partial chunk handling and read offsets.
    • Updated mock callbacks to simulate realistic scenarios.
  • Added utility function to determine line numbers for error handling.


Changes walkthrough 📝

Relevant files
Enhancement
index.ts
Refactor `processor` for better SQL chunk handling             

frontend/packages/db-structure/src/parser/sql/postgresql/index.ts

  • Refactored processor to handle incomplete SQL statements.
  • Adjusted chunk size and error handling logic.
  • Improved merging of database structures.
  • +52/-12 
    processSQLInChunks.ts
    Refactor `processSQLInChunks` for dynamic chunk handling 

    frontend/packages/db-structure/src/parser/sql/postgresql/processSQLInChunks.ts

  • Refactored chunk processing to handle incomplete SQL statements.
  • Added retry logic for error handling and chunk adjustments.
  • Introduced utility to determine line numbers for errors.
  • +90/-27 
    Tests
    processSQLInChunks.test.ts
    Enhance tests for SQL chunk processing                                     

    frontend/packages/db-structure/src/parser/sql/postgresql/processSQLInChunks.test.ts

  • Updated tests to handle partial SQL chunks.
  • Simulated realistic callback responses in tests.
  • Added test for readOffset handling in chunk processing.
  • +29/-12 
    Documentation
    cyan-crabs-kiss.md
    Add changeset for SQL chunk processing refactor                   

    .changeset/cyan-crabs-kiss.md

  • Documented changes to SQL chunk processing.
  • Highlighted improvements in memory error handling.
  • +8/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Footnotes

    1. supabase.sql.txt 2

    2. mastodon-structure.sql.txt 2

    @hoshinotsuyoshi hoshinotsuyoshi self-assigned this Feb 7, 2025
    Copy link

    changeset-bot bot commented Feb 7, 2025

    🦋 Changeset detected

    Latest commit: a387527

    The changes in this PR will be included in the next version bump.

    This PR includes changesets to release 2 packages
    Name Type
    @liam-hq/db-structure Patch
    @liam-hq/cli Patch

    Not sure what this means? Click here to learn what changesets are.

    Click here if you're a maintainer who wants to add another changeset to this PR

    Copy link
    Contributor

    qodo-merge-pro-for-open-source bot commented Feb 7, 2025

    CI Feedback 🧐

    (Feedback updated until commit 7e3a65d)

    A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

    Action: run-e2e / e2e-test

    Failed stage: Run e2e tests [❌]

    Failed test name: tests/e2e/page.test.ts

    Failure summary:

    The E2E tests failed with multiple test failures:

  • Page title test failed: Timed out waiting for page to have title "Liam ERD"
  • Copy link button test failed: Timed out waiting for button click action
  • Table node highlight test failed: Timed out waiting for node click action
  • Toolbar visibility test failed: Timed out waiting for toolbar to be visible
  • Zoom controls tests failed: Timed out waiting for zoom level text content
  • Visual regression test failed: Screenshot comparison mismatch

    The common pattern appears to be timeout issues, suggesting the application is either not loading
    properly or responding too slowly in the test environment.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    189:  Scope: all 11 workspace projects
    190:  Lockfile is up to date, resolution step is skipped
    191:  Progress: resolved 1, reused 0, downloaded 0, added 0
    192:  Packages: +1440
    193:  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    194:  Progress: resolved 1440, reused 1286, downloaded 0, added 0
    195:  Progress: resolved 1440, reused 1420, downloaded 0, added 618
    196:  Progress: resolved 1440, reused 1420, downloaded 0, added 1440, done
    197:  WARN  Failed to create bin at /home/runner/work/liam/liam/frontend/apps/erd-sample/node_modules/.bin/liam. ENOENT: no such file or directory, open '/home/runner/work/liam/liam/frontend/packages/cli/dist-cli/bin/cli.js'
    ...
    
    202:  + @turbo/gen 2.1.2
    203:  + syncpack 13.0.0
    204:  + turbo 2.1.2
    205:  frontend/apps/docs postinstall$ fumadocs-mdx
    206:  frontend/apps/docs postinstall: [MDX] types generated
    207:  frontend/apps/docs postinstall: Done
    208:  frontend/apps/erd-web postinstall$ cp ../../packages/db-structure/node_modules/@ruby/prism/src/prism.wasm prism.wasm
    209:  frontend/apps/erd-web postinstall: Done
    210:  WARN  Failed to create bin at /home/runner/work/liam/liam/frontend/apps/erd-sample/node_modules/.bin/liam. ENOENT: no such file or directory, open '/home/runner/work/liam/liam/frontend/apps/erd-sample/node_modules/@liam-hq/cli/dist-cli/bin/cli.js'
    ...
    
    1455:  PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
    1456:  URL: https://liam-erd-lgei4m3g0-route-06-core.vercel.app
    1457:  ##[endgroup]
    1458:  > @liam-hq/e2e@0.0.0 test:e2e /home/runner/work/liam/liam/frontend/packages/e2e
    1459:  > playwright test
    1460:  Running 7 tests using 1 worker
    1461:  ××F××T××T××F××T××T××F
    1462:  1) [chromium] › tests/e2e/page.test.ts:3:5 › Page has title ──────────────────────────────────────
    1463:  Error: �[31mTimed out 5000ms waiting for �[39m�[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoHaveTitle�[2m(�[22m�[32mexpected�[39m�[2m)�[22m
    ...
    
    1473:  4 |   await page.goto('/')
    1474:  > 5 |   await expect(page).toHaveTitle(/Liam ERD/)
    1475:  |                      ^
    1476:  6 | })
    1477:  7 |
    1478:  8 | test('Copy link button copies current URL to clipboard', async ({
    1479:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/page.test.ts:5:22
    1480:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    1481:  Error: �[31mTimed out 5000ms waiting for �[39m�[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoHaveTitle�[2m(�[22m�[32mexpected�[39m�[2m)�[22m
    ...
    
    1496:  8 | test('Copy link button copies current URL to clipboard', async ({
    1497:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/page.test.ts:5:22
    1498:  attachment #1: trace (application/zip) ─────────────────────────────────────────────────────────
    1499:  test-results/e2e-page-Page-has-title-chromium-retry1/trace.zip
    1500:  Usage:
    1501:  pnpm exec playwright show-trace test-results/e2e-page-Page-has-title-chromium-retry1/trace.zip
    1502:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1503:  Retry #2 ───────────────────────────────────────────────────────────────────────────────────────
    1504:  Error: �[31mTimed out 5000ms waiting for �[39m�[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoHaveTitle�[2m(�[22m�[32mexpected�[39m�[2m)�[22m
    ...
    
    1515:  > 5 |   await expect(page).toHaveTitle(/Liam ERD/)
    1516:  |                      ^
    1517:  6 | })
    1518:  7 |
    1519:  8 | test('Copy link button copies current URL to clipboard', async ({
    1520:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/page.test.ts:5:22
    1521:  2) [chromium] › tests/e2e/page.test.ts:8:5 › Copy link button copies current URL to clipboard ────
    1522:  �[31mTest timeout of 10000ms exceeded.�[39m
    1523:  Error: locator.click: Test timeout of 10000ms exceeded.
    ...
    
    1528:  > 17 |   await copyButton.click()
    1529:  |                    ^
    1530:  18 |
    1531:  19 |   const clipboardContent = await page.evaluate(() =>
    1532:  20 |     navigator.clipboard.readText(),
    1533:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/page.test.ts:17:20
    1534:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    1535:  �[31mTest timeout of 10000ms exceeded.�[39m
    1536:  Error: locator.click: Test timeout of 10000ms exceeded.
    ...
    
    1546:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/page.test.ts:17:20
    1547:  attachment #1: trace (application/zip) ─────────────────────────────────────────────────────────
    1548:  test-results/e2e-page-Copy-link-button-copies-current-URL-to-clipboard-chromium-retry1/trace.zip
    1549:  Usage:
    1550:  pnpm exec playwright show-trace test-results/e2e-page-Copy-link-button-copies-current-URL-to-clipboard-chromium-retry1/trace.zip
    1551:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1552:  Retry #2 ───────────────────────────────────────────────────────────────────────────────────────
    1553:  �[31mTest timeout of 10000ms exceeded.�[39m
    1554:  Error: locator.click: Test timeout of 10000ms exceeded.
    ...
    
    1559:  > 17 |   await copyButton.click()
    1560:  |                    ^
    1561:  18 |
    1562:  19 |   const clipboardContent = await page.evaluate(() =>
    1563:  20 |     navigator.clipboard.readText(),
    1564:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/page.test.ts:17:20
    1565:  3) [chromium] › tests/e2e/page.test.ts:25:5 › Table node should be highlighted when clicked ──────
    1566:  �[31mTest timeout of 10000ms exceeded.�[39m
    1567:  Error: locator.click: Test timeout of 10000ms exceeded.
    ...
    
    1572:  > 33 |   await tableNode.click()
    1573:  |                   ^
    1574:  34 |
    1575:  35 |   const firstChild = await tableNode.evaluate((node: HTMLElement) => {
    1576:  36 |     return node.firstElementChild?.getAttribute('data-erd')
    1577:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/page.test.ts:33:19
    1578:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    1579:  �[31mTest timeout of 10000ms exceeded.�[39m
    1580:  Error: locator.click: Test timeout of 10000ms exceeded.
    ...
    
    1590:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/page.test.ts:33:19
    1591:  attachment #1: trace (application/zip) ─────────────────────────────────────────────────────────
    1592:  test-results/e2e-page-Table-node-should-be-highlighted-when-clicked-chromium-retry1/trace.zip
    1593:  Usage:
    1594:  pnpm exec playwright show-trace test-results/e2e-page-Table-node-should-be-highlighted-when-clicked-chromium-retry1/trace.zip
    1595:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1596:  Retry #2 ───────────────────────────────────────────────────────────────────────────────────────
    1597:  �[31mTest timeout of 10000ms exceeded.�[39m
    1598:  Error: locator.click: Test timeout of 10000ms exceeded.
    ...
    
    1602:  32 |
    1603:  > 33 |   await tableNode.click()
    1604:  |                   ^
    1605:  34 |
    1606:  35 |   const firstChild = await tableNode.evaluate((node: HTMLElement) => {
    1607:  36 |     return node.firstElementChild?.getAttribute('data-erd')
    1608:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/page.test.ts:33:19
    1609:  4) [chromium] › tests/e2e/toolbar.test.ts:12:7 › Desktop Toolbar › should be visible ─────────────
    1610:  Error: �[31mTimed out 5000ms waiting for �[39m�[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m()�[22m
    ...
    
    1618:  13 |     const toolbar = page.getByRole('toolbar', { name: 'Toolbar' })
    1619:  > 14 |     await expect(toolbar).toBeVisible()
    1620:  |                           ^
    1621:  15 |   })
    1622:  16 |
    1623:  17 |   test('zoom in button should increase zoom level', async ({ page }) => {
    1624:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/toolbar.test.ts:14:27
    1625:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    1626:  Error: �[31mTimed out 5000ms waiting for �[39m�[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m()�[22m
    ...
    
    1639:  17 |   test('zoom in button should increase zoom level', async ({ page }) => {
    1640:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/toolbar.test.ts:14:27
    1641:  attachment #1: trace (application/zip) ─────────────────────────────────────────────────────────
    1642:  test-results/e2e-toolbar-Desktop-Toolbar-should-be-visible-chromium-retry1/trace.zip
    1643:  Usage:
    1644:  pnpm exec playwright show-trace test-results/e2e-toolbar-Desktop-Toolbar-should-be-visible-chromium-retry1/trace.zip
    1645:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1646:  Retry #2 ───────────────────────────────────────────────────────────────────────────────────────
    1647:  Error: �[31mTimed out 5000ms waiting for �[39m�[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m()�[22m
    ...
    
    1656:  > 14 |     await expect(toolbar).toBeVisible()
    1657:  |                           ^
    1658:  15 |   })
    1659:  16 |
    1660:  17 |   test('zoom in button should increase zoom level', async ({ page }) => {
    1661:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/toolbar.test.ts:14:27
    1662:  5) [chromium] › tests/e2e/toolbar.test.ts:17:7 › Desktop Toolbar › zoom in button should increase zoom level 
    1663:  �[31mTest timeout of 10000ms exceeded.�[39m
    1664:  Error: locator.textContent: Test timeout of 10000ms exceeded.
    ...
    
    1669:  > 21 |     const zoomLevelBefore = await zoomLevelText.textContent()
    1670:  |                                                 ^
    1671:  22 |
    1672:  23 |     const zoomInButton = toolbar.getByRole('button', { name: 'Zoom in' })
    1673:  24 |     await zoomInButton.click()
    1674:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/toolbar.test.ts:21:49
    1675:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    1676:  �[31mTest timeout of 10000ms exceeded.�[39m
    1677:  Error: locator.textContent: Test timeout of 10000ms exceeded.
    ...
    
    1687:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/toolbar.test.ts:21:49
    1688:  attachment #1: trace (application/zip) ─────────────────────────────────────────────────────────
    1689:  test-results/e2e-toolbar-Desktop-Toolba-edff0--should-increase-zoom-level-chromium-retry1/trace.zip
    1690:  Usage:
    1691:  pnpm exec playwright show-trace test-results/e2e-toolbar-Desktop-Toolba-edff0--should-increase-zoom-level-chromium-retry1/trace.zip
    1692:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1693:  Retry #2 ───────────────────────────────────────────────────────────────────────────────────────
    1694:  �[31mTest timeout of 10000ms exceeded.�[39m
    1695:  Error: locator.textContent: Test timeout of 10000ms exceeded.
    ...
    
    1700:  > 21 |     const zoomLevelBefore = await zoomLevelText.textContent()
    1701:  |                                                 ^
    1702:  22 |
    1703:  23 |     const zoomInButton = toolbar.getByRole('button', { name: 'Zoom in' })
    1704:  24 |     await zoomInButton.click()
    1705:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/toolbar.test.ts:21:49
    1706:  6) [chromium] › tests/e2e/toolbar.test.ts:32:7 › Desktop Toolbar › zoom out button should decrease zoom level 
    1707:  �[31mTest timeout of 10000ms exceeded.�[39m
    1708:  Error: locator.textContent: Test timeout of 10000ms exceeded.
    ...
    
    1713:  > 36 |     const zoomLevelBefore = await zoomLevelText.textContent()
    1714:  |                                                 ^
    1715:  37 |
    1716:  38 |     const zoomOutButton = toolbar.getByRole('button', { name: 'Zoom out' })
    1717:  39 |     await zoomOutButton.click()
    1718:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/toolbar.test.ts:36:49
    1719:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    1720:  �[31mTest timeout of 10000ms exceeded.�[39m
    1721:  Error: locator.textContent: Test timeout of 10000ms exceeded.
    ...
    
    1731:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/toolbar.test.ts:36:49
    1732:  attachment #1: trace (application/zip) ─────────────────────────────────────────────────────────
    1733:  test-results/e2e-toolbar-Desktop-Toolba-9920b--should-decrease-zoom-level-chromium-retry1/trace.zip
    1734:  Usage:
    1735:  pnpm exec playwright show-trace test-results/e2e-toolbar-Desktop-Toolba-9920b--should-decrease-zoom-level-chromium-retry1/trace.zip
    1736:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1737:  Retry #2 ───────────────────────────────────────────────────────────────────────────────────────
    1738:  �[31mTest timeout of 10000ms exceeded.�[39m
    1739:  Error: locator.textContent: Test timeout of 10000ms exceeded.
    ...
    
    1743:  35 |
    1744:  > 36 |     const zoomLevelBefore = await zoomLevelText.textContent()
    1745:  |                                                 ^
    1746:  37 |
    1747:  38 |     const zoomOutButton = toolbar.getByRole('button', { name: 'Zoom out' })
    1748:  39 |     await zoomOutButton.click()
    1749:  at /home/runner/work/liam/liam/frontend/packages/e2e/tests/e2e/toolbar.test.ts:36:49
    1750:  7) [chromium] › tests/vrt/vrt.test.ts:26:5 › top ─────────────────────────────────────────────────
    1751:  Error: �[2mexpect(�[22m�[31mpage�[39m�[2m).�[22mtoHaveScreenshot�[2m(�[22m�[32mexpected�[39m�[2m)�[22m
    ...
    
    1788:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1789:  attachment #2: top-1-actual.png (image/png) ────────────────────────────────────────────────────
    1790:  test-results/vrt-vrt-top-chromium/top-1-actual.png
    1791:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1792:  attachment #3: top-1-diff.png (image/png) ──────────────────────────────────────────────────────
    1793:  test-results/vrt-vrt-top-chromium/top-1-diff.png
    1794:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1795:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    1796:  Error: �[2mexpect(�[22m�[31mpage�[39m�[2m).�[22mtoHaveScreenshot�[2m(�[22m�[32mexpected�[39m�[2m)�[22m
    ...
    
    1838:  test-results/vrt-vrt-top-chromium-retry1/top-1-diff.png
    1839:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1840:  attachment #4: trace (application/zip) ─────────────────────────────────────────────────────────
    1841:  test-results/vrt-vrt-top-chromium-retry1/trace.zip
    1842:  Usage:
    1843:  pnpm exec playwright show-trace test-results/vrt-vrt-top-chromium-retry1/trace.zip
    1844:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1845:  Retry #2 ───────────────────────────────────────────────────────────────────────────────────────
    1846:  Error: �[2mexpect(�[22m�[31mpage�[39m�[2m).�[22mtoHaveScreenshot�[2m(�[22m�[32mexpected�[39m�[2m)�[22m
    ...
    
    1882:  tests/vrt/vrt.test.ts-snapshots/top-1-chromium-linux.png
    1883:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1884:  attachment #2: top-1-actual.png (image/png) ────────────────────────────────────────────────────
    1885:  test-results/vrt-vrt-top-chromium-retry2/top-1-actual.png
    1886:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1887:  attachment #3: top-1-diff.png (image/png) ──────────────────────────────────────────────────────
    1888:  test-results/vrt-vrt-top-chromium-retry2/top-1-diff.png
    1889:  ────────────────────────────────────────────────────────────────────────────────────────────────
    1890:  7 failed
    1891:  [chromium] › tests/e2e/page.test.ts:3:5 › Page has title ───────────────────────────────────────
    1892:  [chromium] › tests/e2e/page.test.ts:8:5 › Copy link button copies current URL to clipboard ─────
    1893:  [chromium] › tests/e2e/page.test.ts:25:5 › Table node should be highlighted when clicked ───────
    1894:  [chromium] › tests/e2e/toolbar.test.ts:12:7 › Desktop Toolbar › should be visible ──────────────
    1895:  [chromium] › tests/e2e/toolbar.test.ts:17:7 › Desktop Toolbar › zoom in button should increase zoom level 
    1896:  [chromium] › tests/e2e/toolbar.test.ts:32:7 › Desktop Toolbar › zoom out button should decrease zoom level 
    1897:  [chromium] › tests/vrt/vrt.test.ts:26:5 › top ──────────────────────────────────────────────────
    1898:  ELIFECYCLE  Command failed with exit code 1.
    1899:  ##[error]Process completed with exit code 1.
    

    @hoshinotsuyoshi hoshinotsuyoshi had a problem deploying to preview - @liam-hq/erd-sample February 7, 2025 10:43 — with GitHub Actions Failure
    Copy link

    vercel bot commented Feb 10, 2025

    The latest updates on your projects. Learn more about Vercel for Git ↗︎

    Name Status Preview Comments Updated (UTC)
    liam-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2025 8:46am
    liam-erd-sample ✅ Ready (Inspect) Visit Preview Feb 20, 2025 8:46am
    liam-erd-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2025 8:46am
    3 Skipped Deployments
    Name Status Preview Comments Updated (UTC)
    test-liam-docs ⬜️ Ignored (Inspect) Feb 20, 2025 8:46am
    test-liam-erd-sample ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2025 8:46am
    test-liam-erd-web ⬜️ Ignored (Inspect) Feb 20, 2025 8:46am

    @hoshinotsuyoshi hoshinotsuyoshi changed the title ♻️ Refactor SQL chunk processing to reduce memory errors WIP: ♻️ Refactor SQL chunk processing to reduce memory errors Feb 12, 2025
    This refactor increases the likelihood of processing larger `.sql` files without encountering memory errors.
    
    - Updated `processor` to improve error handling and prevent unnecessary semicolon-related logic.
    - Modified `processSQLInChunks` to track read offsets and adjust chunk sizes dynamically.
    - Improved test cases to ensure SQL chunks are processed correctly, even when split mid-statement.
    - Added test cases to verify correct handling of `readOffset` when processing SQL chunks with incomplete statements.
    - Added test cases for `errorOffset` handling, including shrinking and expanding modes when parsing SQL statements larger than the chunk size.
    - Introduced a new test case to verify that SQL statements exceeding 500 lines
      (surpassing CHUNK_SIZE) are parsed correctly without errors.
    - Added a `normal` test case in `createParserTestCases` for basic column validation.
    - Updated `index.test.ts` to include a test for handling long SQL statements.
    Copy link
    Member

    @MH4GF MH4GF left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    LGTM 👍🏻
    It looks fine!

    'CREATE TABLE t1 (\n c1 int,\n c2 int,\n c3 int,\n c4 int\n);',
    [null, null, []],
    ],
    ]
    Copy link
    Member

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Test case is easy to understand 👍🏻

    Co-authored-by: Hirotaka Miyagi <31152321+MH4GF@users.noreply.github.com>
    @hoshinotsuyoshi
    Copy link
    Member Author

    Thanks, I'll merge now

    @hoshinotsuyoshi hoshinotsuyoshi added this pull request to the merge queue Feb 20, 2025
    Merged via the queue into main with commit c08b42a Feb 20, 2025
    19 checks passed
    @hoshinotsuyoshi hoshinotsuyoshi deleted the avoid-semicolon-logic branch February 20, 2025 08:49
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Remove multi-line comment in SQL Error when reading GitLab schema
    2 participants