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

Update connector definitions upon server start #5723

Merged
merged 8 commits into from
Sep 1, 2021

Conversation

tuliren
Copy link
Contributor

@tuliren tuliren commented Aug 29, 2021

What

How

  • Currently the configs database will skip the seed loading step if the database has already been initialized.
  • When loading data from the seed persistence, update connector definitions if the database has been initialized.

@tuliren tuliren linked an issue Aug 31, 2021 that may be closed by this pull request
@tuliren tuliren requested review from cgardens, marcosmarxm, Phlair and ChristopheDuong and removed request for Phlair and cgardens August 31, 2021 23:41
@tuliren tuliren marked this pull request as ready for review August 31, 2021 23:42
Copy link
Contributor

@davinchia davinchia left a comment

Choose a reason for hiding this comment

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

Looks great!

@tuliren tuliren merged commit 1f7edaa into master Sep 1, 2021
@tuliren tuliren deleted the liren/reload-seed-upon-server-start branch September 1, 2021 07:48
@philippeboyd
Copy link
Contributor

@tuliren Could this PR be linked to a new bug we're getting in 0.29.14 upon server start where we get duplicate key (unique constraint)

2021-09-03 21:47:12 INFO i.a.c.p.DatabaseConfigPersistence(updateConfigRecord):239 - {workspace_app_root=/tmp/workspace/server/logs} - Updating STANDARD_SOURCE_DEFINITION record fe2b4084-3386-4d3b-9ad6-308f61a6f1e6
2021-09-03 21:47:12 INFO i.a.c.p.DatabaseConfigPersistence(updateConfigRecord):239 - {workspace_app_root=/tmp/workspace/server/logs} - Updating STANDARD_SOURCE_DEFINITION record bad83517-5e54-4a3d-9b53-63e85fbd4d7c
2021-09-03 21:47:12 INFO i.a.c.p.DatabaseConfigPersistence(insertConfigRecord):222 - {workspace_app_root=/tmp/workspace/server/logs} - Inserting STANDARD_SOURCE_DEFINITION record 932e6363-d006-4464-a9f5-102b82e07c06
2021-09-03 21:47:12 INFO i.a.c.p.DatabaseConfigPersistence(insertConfigRecord):222 - {workspace_app_root=/tmp/workspace/server/logs} - Inserting STANDARD_SOURCE_DEFINITION record 5e6175e5-68e1-4c17-bff9-56103bbb0d80
Exception in thread "main" org.jooq.exception.DataAccessException: SQL [insert into "public"."airbyte_configs" ("config_id", "config_type", "config_blob", "created_at", "updated_at") values (?, ?, cast(? as jsonb), cast(? as timestamp with time zone), cast(? as timestamp with time zone))]; ERROR: duplicate key value violates unique constraint "airbyte_configs_type_id_idx"
  Detail: Key (config_type, config_id)=(STANDARD_SOURCE_DEFINITION, 5e6175e5-68e1-4c17-bff9-56103bbb0d80) already exists.
	at org.jooq_3.13.4.POSTGRES.debug(Unknown Source)
	at org.jooq.impl.Tools.translate(Tools.java:2753)
	at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:755)
	at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:385)
	at org.jooq.impl.AbstractDelegatingQuery.execute(AbstractDelegatingQuery.java:119)
	at io.airbyte.config.persistence.DatabaseConfigPersistence.insertConfigRecord(DatabaseConfigPersistence.java:230)
	at io.airbyte.config.persistence.DatabaseConfigPersistence.updateConnectorDefinitions(DatabaseConfigPersistence.java:348)
	at io.airbyte.config.persistence.DatabaseConfigPersistence.updateConfigsFromSeed(DatabaseConfigPersistence.java:309)
	at io.airbyte.config.persistence.DatabaseConfigPersistence.lambda$loadData$0(DatabaseConfigPersistence.java:80)
	at io.airbyte.db.Database.lambda$transaction$0(Database.java:51)
	at org.jooq.impl.DefaultDSLContext.lambda$transactionResult0$0(DefaultDSLContext.java:564)
	at org.jooq.impl.Tools$12$1.block(Tools.java:4926)
	at java.base/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3137)
	at org.jooq.impl.Tools$12.get(Tools.java:4923)
	at org.jooq.impl.DefaultDSLContext.transactionResult0(DefaultDSLContext.java:616)
	at org.jooq.impl.DefaultDSLContext.transactionResult(DefaultDSLContext.java:533)
	at io.airbyte.db.Database.transaction(Database.java:51)
	at io.airbyte.db.ExceptionWrappingDatabase.transaction(ExceptionWrappingDatabase.java:51)
	at io.airbyte.config.persistence.DatabaseConfigPersistence.loadData(DatabaseConfigPersistence.java:77)
	at io.airbyte.server.ServerApp.getServer(ServerApp.java:182)
	at io.airbyte.server.ServerApp.main(ServerApp.java:256)
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "airbyte_configs_type_id_idx"
  Detail: Key (config_type, config_id)=(STANDARD_SOURCE_DEFINITION, 5e6175e5-68e1-4c17-bff9-56103bbb0d80) already exists.
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:473)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:393)
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164)
	at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:153)
	at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
	at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
	at org.jooq.tools.jdbc.DefaultPreparedStatement.execute(DefaultPreparedStatement.java:209)
	at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:453)
	at org.jooq.impl.AbstractDMLQuery.execute(AbstractDMLQuery.java:904)
	at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:371)
	... 17 more

@tuliren
Copy link
Contributor Author

tuliren commented Sep 4, 2021

@philippeboyd, thank you for flagging this. I am taking a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configs database should auto update connector definitions UI is not getting new sources in setting page
3 participants