From 24ae6069f0dabe9cfb468c4ff857f2ec34041d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= <benjamin.antal@memgraph.io> Date: Wed, 1 Feb 2023 14:31:56 +0100 Subject: [PATCH] Split edge creation into batches --- tests/mgbench/dataset_creator_unwind.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/mgbench/dataset_creator_unwind.py b/tests/mgbench/dataset_creator_unwind.py index c9f9a12df..4fe537275 100644 --- a/tests/mgbench/dataset_creator_unwind.py +++ b/tests/mgbench/dataset_creator_unwind.py @@ -107,7 +107,7 @@ def main(): f.write("\n] AS props CREATE (:Identity {uuid: props.uuid, name: props.name});\n") f.write("UNWIND [") - wrote_anything = False + created = 0 for outer_index in range(0, number_of_files): for inner_index in range(0, number_of_identities): @@ -116,17 +116,27 @@ def main(): if random.random() <= percentage_of_permissions: - if wrote_anything: + if created > 0: f.write(",") f.write( f'\n {{permUuid: {uuid}, permName: "name_permission_{uuid}", fileUuid: {file_uuid}, identityUuid: {identity_uuid}}}' ) - wrote_anything = True + created += 1 uuid += 1 + + if created == 5000: + f.write( + """\n] AS props +MATCH (file:File {uuid:props.fileUuid}), (identity:Identity {uuid: props.identityUuid}) +CREATE (permission:Permission {uuid: props.permUuid, name: props.permName}) +CREATE (permission)-[: IS_FOR_FILE]->(file) +CREATE (permission)-[: IS_FOR_IDENTITY]->(identity); +UNWIND [""" + ) + created = 0 f.write( - """ -\n] AS props + """\n] AS props MATCH (file:File {uuid:props.fileUuid}), (identity:Identity {uuid: props.identityUuid}) CREATE (permission:Permission {uuid: props.permUuid, name: props.permName}) CREATE (permission)-[: IS_FOR_FILE]->(file)