vaticle / typedb

TypeDB: the polymorphic database powered by types
https://typedb.com
Mozilla Public License 2.0
3.72k stars 337 forks source link

Importing empty data file results in exception #6773

Open izmalk opened 1 year ago

izmalk commented 1 year ago

Description

Importing an empty data file (from an empty database) throws an exception.

Environment

  1. OS (where TypeDB server runs): macOS 12.6.3
  2. TypeDB version (and platform): 2.16.1
  3. TypeDB client: -
  4. Other environment details:

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Create a new database.
  2. Load Schema.
  3. Export data (to create an empty data file) typedb server export --database=cti --port=1729 --file=cti.typedb.
  4. Create a second new database.
  5. Load Schema into the second new database.
  6. Import the empty data file typedb server import --database=new-db --port=1729 --file=cti.typedb.

Expected Output

Attribute: 0 Entity: 0 Relation: 0 Total: 0/0 (NaN%);

Actual Output

vladimir@Vladimirs-MacBook-Pro conf % typedb server import --database=new-db --port=1729 --file=cti.typedb

================================================================
     ________ __      __ _____    _______  _____    _____
    |__    __|\  \  /  /|   _  \ |   _   ||   _  \ |   _  \
       |  |    \  \/  / |  | |  ||  | |__||  | |  ||  | |  |
       |  |     \    /  |  |/  / |  |___  |  | |  ||  |/  /
       |  |      |  |   |   __/  |   ___| |  | |  ||   _  \
       |  |      |  |   |  |     |  |  __ |  | |  ||  | |  |
       |  |      |  |   |  |     |  |_|  ||  |/  / |  |/  /
       |__|      |__|   |__|     |_______||_____/  |_____/

                    A STRONGLY-TYPED DATABASE
================================================================

$x isa Import,
    has status "in progress";

Attribute: 0; \
io.grpc.StatusRuntimeException: INTERNAL: com.vaticle.typedb.core.common.exception.TypeDBException: java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "com.vaticle.typedb.core.TypeDB$Transaction.close()" because "this.transaction" is null
    at io.grpc.Status.asRuntimeException(Status.java:535)
$x isa Import,
    has status "in progress";

Attribute: 0; |

    at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722)
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1589)

Additional information

schema_cti.tql.zip

cti.typedb.zip

SullivanDaly commented 1 year ago

Added a new step on the "Reproducible Steps" section (adding the schema on the new database was missing).