Additional has clause causes long query time


#1

Unsure if this is related to Tiny graph with long query time. Still need further clarification on exactly what is needed to fix that issue.

Grakn version: 1.2.0
OS: Ubuntu 16.04
Recreate issue: https://github.com/BFergerson/grakn-additional-has-test

Essentially I have an insert query:

match
    $x isa file has file_name <xName>;
    $y isa function has function_name <yName>;

insert
(has_defines: $x, is_defines: $y) isa defines
    has create_date <createDate>
    has start_offset @long(<startOffset>)
has end_offset @long(<endOffset>);

and all is good:

Importing definitions
Migrating data /home/brandon/IdeaProjects/grakn-additional-has-test/data/relationship-defines.txt using Grakn Engine localhost:4567 into graph grakn
Loaded 6787 statements
Migration complete.
Imported definitions - Took: 14718ms

But the moment I add one additional has clause (has commit_sha1 <commitSha1>) I get:

match
    $x isa file has file_name <xName>;
    $y isa function has function_name <yName> has commit_sha1 <commitSha1>;

insert
(has_defines: $x, is_defines: $y) isa defines
    has create_date <createDate>
    has start_offset @long(<startOffset>)
has end_offset @long(<endOffset>);

which leads to:

Importing definitions
Migrating data /home/brandon/IdeaProjects/grakn-additional-has-test/data/relationship-defines.txt using Grakn Engine localhost:4567 into graph grakn
6/23/18 12:19:06 PM ============================================================

-- Meters ----------------------------------------------------------------------
ai.grakn.client.BatchExecutorClient$CommandQueries.attempt
             count = 0
         mean rate = 0.00 events/second
     1-minute rate = 0.00 events/second
     5-minute rate = 0.00 events/second
    15-minute rate = 0.00 events/second
ai.grakn.client.BatchExecutorClient.failure
             count = 0
         mean rate = 0.00 events/second
     1-minute rate = 0.00 events/second
     5-minute rate = 0.00 events/second
    15-minute rate = 0.00 events/second
ai.grakn.migration.base.Migrator.success
             count = 0
         mean rate = 0.00 events/second
     1-minute rate = 0.00 events/second
     5-minute rate = 0.00 events/second
    15-minute rate = 0.00 events/second
ai.grakn.migration.base.Migrator.total
             count = 6787
         mean rate = 113.09 events/second
     1-minute rate = 542.76 events/second
     5-minute rate = 1130.02 events/second
    15-minute rate = 1276.93 events/second

-- Timers ----------------------------------------------------------------------
ai.grakn.client.BatchExecutorClient$CommandQueries.execute
             count = 0
         mean rate = 0.00 calls/second
     1-minute rate = 0.00 calls/second
     5-minute rate = 0.00 calls/second
    15-minute rate = 0.00 calls/second
               min = 0.00 milliseconds
               max = 0.00 milliseconds
              mean = 0.00 milliseconds
            stddev = 0.00 milliseconds
            median = 0.00 milliseconds
              75% <= 0.00 milliseconds
              95% <= 0.00 milliseconds
              98% <= 0.00 milliseconds
              99% <= 0.00 milliseconds
            99.9% <= 0.00 milliseconds
ai.grakn.client.BatchExecutorClient.add
             count = 0
         mean rate = 0.00 calls/second
     1-minute rate = 0.00 calls/second
     5-minute rate = 0.00 calls/second
    15-minute rate = 0.00 calls/second
               min = 0.00 milliseconds
               max = 0.00 milliseconds
              mean = 0.00 milliseconds
            stddev = 0.00 milliseconds
            median = 0.00 milliseconds
              75% <= 0.00 milliseconds
              95% <= 0.00 milliseconds
              98% <= 0.00 milliseconds
              99% <= 0.00 milliseconds
            99.9% <= 0.00 milliseconds
ai.grakn.migration.base.Migrator.parse.template
             count = 6787
         mean rate = 113.09 calls/second
     1-minute rate = 542.76 calls/second
     5-minute rate = 1130.02 calls/second
    15-minute rate = 1276.93 calls/second
               min = 0.14 milliseconds
               max = 28.20 milliseconds
              mean = 0.31 milliseconds
            stddev = 1.02 milliseconds
            median = 0.25 milliseconds
              75% <= 0.29 milliseconds
              95% <= 0.44 milliseconds
              98% <= 0.70 milliseconds
              99% <= 0.97 milliseconds
            99.9% <= 27.87 milliseconds


Error in execution: java.lang.RuntimeException: Unexpected exception while retrying, 1299 queries failed.
Error in execution: java.lang.RuntimeException: Unexpected exception while retrying, 2473 queries failed.
Error in execution: java.lang.RuntimeException: Unexpected exception while retrying, 1915 queries failed.
Loaded 1100 statements
Migration complete.
Imported definitions - Took: 64975ms

Everything was working beautifully till the additional has clause but unfortunately I need this clause to ensure data integrity. What’s causing this issue and how do I remedy? I do not believe it has anything to do with the migrator. The queries are also slow in the console.