-
Notifications
You must be signed in to change notification settings - Fork 30
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
[ROQ0fkdz] Reduce the number of transactions we use in triggers #303
Conversation
6234810
to
bd498f4
Compare
bd498f4
to
cd22d1d
Compare
checkInSystemWriter(tx); | ||
checkTargetDatabase(databaseName, tx); |
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.
For these two you don't need to create a new transaction, you can just recycle the one you are in, so I'd suggest reshaping it like:
checkInSystemWriter();
checkTargetDatabase(databaseName);
Map<String,Object> params = (Map)config.getOrDefault("params", Collections.emptyMap());
return withTransaction(tx -> {
TriggerInfo triggerInfo = TriggerHandlerNewProcedures.install(databaseName, name, statement, selector, params, tx);
return Stream.of(triggerInfo);
});
so you only open a new system transaction at the moment where you need it
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.
Changed 👍
5993538
to
cd22d1d
Compare
9df063c
to
05088f7
Compare
…j/apoc#303) * [ROQ0fkdz] Reduce the number of transactions we use in triggers * [ROQ0fkdz] Open new transaction only when needed
…j/apoc#303) * [ROQ0fkdz] Reduce the number of transactions we use in triggers * [ROQ0fkdz] Open new transaction only when needed
…j/apoc#303) (#3482) * [ROQ0fkdz] Reduce the number of transactions we use in triggers * [ROQ0fkdz] Open new transaction only when needed
The ideal solution I suppose is to use
@Context public Transaction tx
, which callsProcedureTransactionImpl
.But with both this and
@Context publicGraphDatabaseAPI
[which calls ProcedureGraphDatabaseAPI] viadb.beginTx()
,I receive the following error if I login with an user with role
admin
(both with the embedded db and with an enterprise instance):
Btw, even trying to explicit
GRANT CREATE NEW NODE LABEL ON DATABASE system TO admin
gives the same result.I also tried changing
mode = Mode.WRITE
toMode.DBMS
but it doesn't change anything.I think the above one might be a bug, or so, not APOC related.
The only working way is to use
@Context public GraphDatabaseAPI
, which callsGraphDatabaseFacade
.