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
Added special case for existing DB throwing as unknown error #319
base: main
Are you sure you want to change the base?
Conversation
no issue - during database creation, connection is expected to throw errno=1007 to know if initialization should be skipped. - errors from some db providers, e.g. PlanetScale, are throwing as unknown error (errno=1105) - this causes the initialization to crash when using this providers - workaround is to add special condition to catch errno=1105 with "database exists" message.
Hi @JustroX, thanks for submitting! Aiming to review this (and hopefully merge) by end of this week |
@ErisDS John mentioned you might be interested in taking a look at this as well 😀 |
Hi @JustroX , apologies for the delay! I tried to run Ghost using this PR locally, and it fixes the initial error where Ghost throws an error because the database already exists, but ultimately the migrations are still failing due to a transaction timeout (console output below). It looks like PlanetScale has a hard limit of 20 seconds for all transactions, which the Ghost migrations seem to exceed. I'm just using one of PlanetScale's free plan DBs, so it could be that it's just too slow to finish in time, but ideally we could get this working on the free/hobby plan. Is this something you ran into yourself? Just curious if I'm doing something wrong or missing a config that you used.
|
hmm interesting. I haven't encountered this before. Also, haven't used any
other config.
…On Wed, 14 Feb 2024, 07:50 Chris Raible, ***@***.***> wrote:
Hi @JustroX <https://github.com/JustroX> , apologies for the delay! I
tried to run Ghost using this PR locally, and it fixes the initial error
where Ghost throws an error because the database already exists, but
ultimately the migrations are still failing due to a transaction timeout
(console output below).
It looks like PlanetScale has a hard limit of 20 seconds for all
transactions, which the Ghost migrations seem to exceed. I'm just using one
of PlanetScale's free plan DBs, so it could be that it's just too slow to
finish in time, but ideally we could get this working on the free/hobby
plan.
Is this something you ran into yourself?
[ghost] [2024-02-13 15:39:51] INFO Ghost is running in development...
[ghost] [2024-02-13 15:39:51] INFO Listening on: 127.0.0.1:2368
[ghost] [2024-02-13 15:39:51] INFO Url configured as: http://localhost:2368/
[ghost] [2024-02-13 15:39:51] INFO Ctrl+C to shut down
[ghost] [2024-02-13 15:39:51] INFO Ghost server started in 0.838s
[ghost] [2024-02-13 15:39:53] WARN Database state requires initialisation.
[admin] WARNING: Node v18.14.2 is not tested against Ember CLI on your platform. We recommend that you use the most-recent "Active LTS" version of Node.js. See https://git.io/v7S5n for details.
[ghost] [2024-02-13 15:39:55] INFO Creating table: users
[ghost] [2024-02-13 15:39:56] INFO Creating table: posts_authors
[admin] Recrawled this watch 15 times, most recently because:
[admin] MustScanSubDirs UserDroppedTo resolve, please review the information on
[admin] https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
[admin] To clear this warning, run:
[admin] `watchman watch-del '/Users/chris/Developer/Ghost' ; watchman watch-project '/Users/chris/Developer/Ghost'`
[admin] - building...
[ghost] [2024-02-13 15:39:56] INFO Creating table: roles
[ghost] [2024-02-13 15:39:57] INFO Creating table: roles_users
[ghost] [2024-02-13 15:39:57] INFO Creating table: permissions
[ghost] [2024-02-13 15:39:57] INFO Creating table: permissions_users
[ghost] [2024-02-13 15:39:57] INFO Creating table: permissions_roles
[ghost] [2024-02-13 15:39:57] INFO Creating table: settings
[ghost] [2024-02-13 15:39:58] INFO Creating table: tags
[ghost] [2024-02-13 15:39:58] INFO Creating table: posts_tags
[ghost] [2024-02-13 15:39:58] INFO Creating table: invites
[ghost] [2024-02-13 15:39:59] INFO Creating table: brute
[ghost] [2024-02-13 15:39:59] INFO Creating table: sessions
[ghost] [2024-02-13 15:39:59] INFO Creating table: integrations
[ghost] [2024-02-13 15:39:59] INFO Creating table: webhooks
[ghost] [2024-02-13 15:40:00] INFO Creating table: api_keys
[ghost] [2024-02-13 15:40:00] INFO Creating table: mobiledoc_revisions
[ghost] [2024-02-13 15:40:00] INFO Creating table: post_revisions
[ghost] [2024-02-13 15:40:01] INFO Creating table: members
[ghost] [2024-02-13 15:40:02] INFO Creating table: products
[ghost] [2024-02-13 15:40:02] INFO Creating table: offers
[ghost] [2024-02-13 15:40:03] INFO Creating table: benefits
[ghost] [2024-02-13 15:40:03] INFO Creating table: products_benefits
[ghost] [2024-02-13 15:40:03] INFO Creating table: members_products
[ghost] [2024-02-13 15:40:04] INFO Creating table: posts_products
[ghost] [2024-02-13 15:40:05] INFO Creating table: members_created_events
[ghost] [2024-02-13 15:40:05] INFO Creating table: members_cancel_events
[ghost] [2024-02-13 15:40:05] INFO Creating table: members_payment_events
[ghost] [2024-02-13 15:40:06] INFO Creating table: members_login_events
[ghost] [2024-02-13 15:40:06] INFO Creating table: members_email_change_events
[ghost] [2024-02-13 15:40:06] INFO Creating table: members_status_events
[ghost] [2024-02-13 15:40:07] INFO Creating table: members_product_events
[ghost] [2024-02-13 15:40:07] INFO Creating table: members_paid_subscription_events
[ghost] [2024-02-13 15:40:07] INFO Creating table: labels
[ghost] [2024-02-13 15:40:08] INFO Creating table: members_labels
[ghost] [2024-02-13 15:40:08] INFO Creating table: members_stripe_customers
[admin] Build successful (11862ms) – Serving on http://localhost:4200/
[admin] Slowest Nodes (totalTime >= 5%) | Total (avg)
[admin] -+-
[admin] PostcssCompiler (2) | 4660ms (2330 ms)
[admin] ember-auto-import-webpack (1) | 1964ms
[ghost] [2024-02-13 15:40:09] INFO Creating table: subscriptions
[ghost] [2024-02-13 15:40:10] INFO Creating table: members_stripe_customers_subscriptions
[ghost] [2024-02-13 15:40:11] INFO Creating table: members_subscription_created_events
[ghost] [2024-02-13 15:40:11] INFO Creating table: offer_redemptions
[ghost] [2024-02-13 15:40:12] INFO Creating table: members_subscribe_events
[ghost] [2024-02-13 15:40:13] INFO Creating table: donation_payment_events
[ghost] [2024-02-13 15:40:13] INFO Creating table: stripe_products
[ghost] [2024-02-13 15:40:13] INFO Creating table: stripe_prices
[ghost] [2024-02-13 15:40:14] INFO Creating table: actions
[ghost] [2024-02-13 15:40:14] INFO Creating table: emails
[ghost] [2024-02-13 15:40:15] INFO Creating table: email_batches
[ghost] [2024-02-13 15:40:15] INFO Creating table: email_recipients
[ghost] [2024-02-13 15:40:16] INFO Creating table: email_recipient_failures
[ghost] [2024-02-13 15:40:17] INFO Creating table: tokens
[ghost] [2024-02-13 15:40:17] INFO Creating table: snippets
[ghost] [2024-02-13 15:40:17] INFO Creating table: custom_theme_settings
[ghost] [2024-02-13 15:40:18] INFO Creating table: members_newsletters
[ghost] [2024-02-13 15:40:18] INFO Creating table: comments
[ghost] [2024-02-13 15:40:19] INFO Creating table: comment_likes
[ghost] [2024-02-13 15:40:19] INFO Creating table: comment_reports
[ghost] [2024-02-13 15:40:20] INFO Creating table: jobs
[ghost] [2024-02-13 15:40:20] INFO Creating table: redirects
[ghost] [2024-02-13 15:40:21] INFO Creating table: members_click_events
[ghost] [2024-02-13 15:40:21] INFO Creating table: members_feedback
[ghost] [2024-02-13 15:40:22] INFO Creating table: suppressions
[ghost] [2024-02-13 15:40:22] INFO Creating table: email_spam_complaint_events
[ghost] [2024-02-13 15:40:23] INFO Creating table: mentions
[ghost] [2024-02-13 15:40:23] INFO Creating table: milestones
[ghost] [2024-02-13 15:40:23] INFO Creating table: temp_mail_events
[ghost] [2024-02-13 15:40:23] INFO Creating table: collections
[ghost] [2024-02-13 15:40:24] INFO Creating table: collections_posts
[ghost] [2024-02-13 15:40:24] INFO Creating table: recommendations
[ghost] [2024-02-13 15:40:24] INFO Creating table: recommendation_click_events
[ghost] [2024-02-13 15:40:25] INFO Creating table: recommendation_subscribe_events
[ghost] (node:13775) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
[ghost] (Use `node --trace-warnings ...` to show where the warning was created)
[ghost] [2024-02-13 15:40:29] INFO Model: Collection
[ghost] [2024-02-13 15:40:29] INFO Model: Product
[ghost] [2024-02-13 15:40:30] INFO Model: Newsletter
[ghost] [2024-02-13 15:40:30] INFO Model: Tag
[ghost] [2024-02-13 15:40:30] INFO Model: Permission
[ghost] [2024-02-13 15:40:48] ERROR insert into `permissions` (`action_type`, `created_at`, `created_by`, `id`, `name`, `object_id`, `object_type`, `updated_at`, `updated_by`) values ('add', '2024-02-13 23:40:47', '1', '65cbfdff3ab5ad35cf305f1d', 'Add offers', NULL, 'offer', '2024-02-13 23:40:47', '1') - target: ghost-2.-.primary: vttablet: rpc error: code = Aborted desc = transaction 1707867144391487564: ended at 2024-02-13 23:40:47.836 UTC (exceeded timeout: 20s) (CallerID: zhofo666srsjb0x0wjww)
[ghost]
[ghost] insert into `permissions` (`action_type`, `created_at`, `created_by`, `id`, `name`, `object_id`, `object_type`, `updated_at`, `updated_by`) values ('add', '2024-02-13 23:40:47', '1', '65cbfdff3ab5ad35cf305f1d', 'Add offers', NULL, 'offer', '2024-02-13 23:40:47', '1') - target: ghost-2.-.primary: vttablet: rpc error: code = Aborted desc = transaction 1707867144391487564: ended at 2024-02-13 23:40:47.836 UTC (exceeded timeout: 20s) (CallerID: zhofo666srsjb0x0wjww)
[ghost] {"config":{"transaction":true},"name":"2-create-fixtures.js"}
[ghost] "Error occurred while executing the following migration: 2-create-fixtures.js"
[ghost] Error ID:
[ghost] 300
[ghost] Error Code:
[ghost] ER_UNKNOWN_ERROR
[ghost] ----------------------------------------
[ghost] Error: insert into `permissions` (`action_type`, `created_at`, `created_by`, `id`, `name`, `object_id`, `object_type`, `updated_at`, `updated_by`) values ('add', '2024-02-13 23:40:47', '1', '65cbfdff3ab5ad35cf305f1d', 'Add offers', NULL, 'offer', '2024-02-13 23:40:47', '1') - target: ghost-2.-.primary: vttablet: rpc error: code = Aborted desc = transaction 1707867144391487564: ended at 2024-02-13 23:40:47.836 UTC (exceeded timeout: 20s) (CallerID: zhofo666srsjb0x0wjww)
[ghost] at /Users/chris/Developer/knex-migrator/lib/index.js:1032:19
[ghost] at Packet.asError (/Users/chris/Developer/knex-migrator/node_modules/mysql2/lib/packets/packet.js:728:17)
[ghost] at Query.execute (/Users/chris/Developer/knex-migrator/node_modules/mysql2/lib/commands/command.js:29:26)
[ghost] at Connection.handlePacket (/Users/chris/Developer/knex-migrator/node_modules/mysql2/lib/connection.js:489:32)
[ghost] at PacketParser.onPacket (/Users/chris/Developer/knex-migrator/node_modules/mysql2/lib/connection.js:94:12)
[ghost] at PacketParser.executeStart (/Users/chris/Developer/knex-migrator/node_modules/mysql2/lib/packet_parser.js:75:16)
[ghost] at TLSSocket.<anonymous> (/Users/chris/Developer/knex-migrator/node_modules/mysql2/lib/connection.js:388:25)
[ghost] at TLSSocket.emit (node:events:513:28)
[ghost] at TLSSocket.emit (node:domain:489:12)
[ghost] at addChunk (node:internal/streams/readable:324:12)
[ghost] at readableAddChunk (node:internal/streams/readable:297:9)
[ghost] at Readable.push (node:internal/streams/readable:234:10)
[ghost] at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
—
Reply to this email directly, view it on GitHub
<#319 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFLJG3BT5SQYIGEUSF6XDGTYTP355AVCNFSM6AAAAABCDBG7HWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBSHA3DOMJUGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
no issue