-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
⚠Caching won't work with replication enabled #5919
Labels
Comments
matiasmir
changed the title
Caching won't work with replication enabled
⚠Caching won't work with replication enabled
Apr 21, 2020
Same for MySQL. Cache is not working That doesn't produce errors but it hits DB per each request, but not a cache |
I created a dedicated repository to reproduce the error using Docker to mount a master/slave environment git clone https://github.com/madeindjs/typeorm_bug
cd typeorm_bug
docker-compose up This will produce the following error
|
madeindjs
added a commit
to madeindjs/typeorm
that referenced
this issue
May 28, 2021
7 tasks
madeindjs
added a commit
to madeindjs/typeorm
that referenced
this issue
May 31, 2021
madeindjs
added a commit
to madeindjs/typeorm
that referenced
this issue
May 31, 2021
madeindjs
added a commit
to madeindjs/typeorm
that referenced
this issue
May 31, 2021
madeindjs
added a commit
to madeindjs/typeorm
that referenced
this issue
Jun 1, 2021
madeindjs
added a commit
to madeindjs/typeorm
that referenced
this issue
Nov 13, 2021
pleerock
pushed a commit
that referenced
this issue
Nov 16, 2021
* FIX Insert cache only on master connection close #5919 * FIX release queryRunner created
HeartPattern
pushed a commit
to HeartPattern/typeorm
that referenced
this issue
Nov 29, 2021
* FIX Insert cache only on master connection close typeorm#5919 * FIX release queryRunner created
HeartPattern
pushed a commit
to HeartPattern/typeorm
that referenced
this issue
Nov 29, 2021
* FIX Insert cache only on master connection close typeorm#5919 * FIX release queryRunner created
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue type:
[ ] question
[ x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[ ]
mysql
/mariadb
[ ]
oracle
[x ]
postgres
[ ]
cockroachdb
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[x ]
latest
[ ]
@next
[ ]
0.x.x
(or put your version here)Steps to reproduce or a small repository showing the problem:
Hi everyone, I've configured typeorm with replication using two instances, a master(read-write) and a slave(read), so if my understading is correct all the select/get queries are executed in the slave instance and all the updates/set/insert/etc are executed in the master db but today I've enabled caching for my db and it doesn't work, it shows the following error when I try to get something from the db:
{ error: cannot execute INSERT in a read-only transaction at Connection.parseE (/app/node_modules/pg/lib/connection.js:604:13) at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:403:19) at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:123:22) at Socket.emit (events.js:198:13) at Socket.EventEmitter.emit (domain.js:448:20) at addChunk (_stream_readable.js:287:12) at readableAddChunk (_stream_readable.js:268:11) at Socket.Readable.push (_stream_readable.js:223:10) at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) name: 'error', length: 118, severity: 'ERROR', code: '25006', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'utility.c', line: '246', routine: 'PreventCommandIfReadOnly' }
I suppose that this is being caused when a get request is received on my API and then typeorm selects the slave database in order to execute the query and then it tries to do a
INSERT
to chache the results using the slave instance and because it isREAD ONLY
it throws that error, so I guess that this is a bug, correct me if I'm wrong, thanks in advance!The text was updated successfully, but these errors were encountered: