-
-
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 39.96% 39.97% +0.01%
===========================================
Files 1563 1563
Lines 197752 197798 +46
Branches 3634 3640 +6
===========================================
+ Hits 79031 79070 +39
- Misses 118116 118123 +7
Partials 605 605 ☔ 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が取れます。
※2024.12.0より後にしたい
What
各Repositoryが持つinsertOne()メソッドの挙動を少し変更します。
この対応により、insertOne()によるレコード挿入は必ずmasterノードで行うようになります。
Why
fix #10897
Additional info (optional)
Checklist