Fix bug with on-disk triggers (#1134)

* Fix TriggerContext adaptation for accessors.
* Fix edge deserialization in case of the deleted vertex.
This commit is contained in:
Aidar Samerkhanov 2023-08-08 11:37:14 +03:00 committed by GitHub
parent 260660f1dd
commit 271b1a5ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -3781,7 +3781,8 @@ void Interpreter::Abort() {
namespace {
void RunTriggersIndividually(const utils::SkipList<Trigger> &triggers, InterpreterContext *interpreter_context,
TriggerContext trigger_context, std::atomic<TransactionStatus> *transaction_status) {
TriggerContext original_trigger_context,
std::atomic<TransactionStatus> *transaction_status) {
// Run the triggers
for (const auto &trigger : triggers.access()) {
utils::MonotonicBufferResource execution_memory{kExecutionMemoryBlockSize};
@ -3790,6 +3791,9 @@ void RunTriggersIndividually(const utils::SkipList<Trigger> &triggers, Interpret
auto storage_acc = interpreter_context->db->Access();
DbAccessor db_accessor{storage_acc.get()};
// On-disk storage removes all Vertex/Edge Accessors because previous trigger tx finished.
// So we need to adapt TriggerContext based on user transaction which is still alive.
auto trigger_context = original_trigger_context;
trigger_context.AdaptForAccessor(&db_accessor);
try {
trigger.Execute(&db_accessor, &execution_memory, interpreter_context->config.execution_timeout_sec,

View File

@ -17,14 +17,14 @@ disk_template_cluster: &disk_template_cluster
cluster:
main:
args: ["--bolt-port", *bolt_port, "--log-level=TRACE", "--storage-properties-on-edges=True"]
log_file: "triggers-e2e.log"
setup_queries: []
log_file: "triggers-e2e-disk.log"
setup_queries: ["storage mode on_disk_transactional"]
validation_queries: []
disk_storage_properties_edges_false: &disk_storage_properties_edges_false
cluster:
main:
args: ["--bolt-port", *bolt_port, "--log-level=TRACE", "--also-log-to-stderr", "--storage-properties-on-edges=False"]
log_file: "triggers-e2e.log"
log_file: "triggers-e2e-disk.log"
setup_queries: []
validation_queries: []