-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
レプリケーション設定時におけるinsertOne()の挙動を調整 #15109
base: develop
Are you sure you want to change the base?
レプリケーション設定時におけるinsertOne()の挙動を調整 #15109
Conversation
このPRによるapi.jsonの差分 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #15109 +/- ##
============================================
+ Coverage 18.82% 38.67% +19.85%
============================================
Files 766 1605 +839
Lines 111400 204701 +93301
Branches 1234 3868 +2634
============================================
+ Hits 20966 79163 +58197
- Misses 89845 124930 +35085
- Partials 589 608 +19 ☔ View full report in Codecov by Sentry. |
open |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(pendingのままだった)
const opt = this.manager.connection.options as PostgresConnectionOptions; | ||
if (opt.replication) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
configに設定したreplicationの値が巡り巡ってこの値に入っています。
レプリケーションが無効の時はnull(かundefinedかは忘れましたが)になっているので、else(=今までの処理)に流れます。
@@ -92,14 +103,31 @@ export const miRepository = { | |||
return this.metadata.columns.filter(column => column.isSelect && !column.isVirtual).map(column => column.databaseName); | |||
}, | |||
async insertOne(entity, findOptions?) { | |||
const opt = this.manager.connection.options as PostgresConnectionOptions; | |||
if (opt.replication) { | |||
const queryRunner = this.manager.connection.createQueryRunner('master'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これによりmasterノードでクエリを実行してくれるrunnerが取れます。
# Conflicts: # CHANGELOG.md # packages/backend/src/postgres.ts
※2024.12.0より後にしたい
What
各Repositoryが持つinsertOne()メソッドの挙動を少し変更します。
この対応により、insertOne()によるレコード挿入は必ずmasterノードで行うようになります。
Why
fix #10897
Additional info (optional)
Checklist