Skip to content

Index creation hinders async record creation #310

Description

@Jurgen-Aquilina

ArcadeDB Version: 22.1.3

JDK Version: Corretto 11

OS: Windows 10

Expected behavior

ArcadeDb should internally balance the creation of indexes with the record creation so that the create record calls are not lost. Alternatively, an exception should be thrown to alert the user that such operations are not supported.

Actual behavior

The index and vertex creation are executed without errors, but the edge creation fails since a subset of "Software" vertices are not created.

Steps to reproduce

To create the scenario and trigger an exception using edge creation:

for (i in 0..250000) {
        val vertex = database.newVertex("Tester")
        vertex.set("id", i.toString())

        database.async().createRecord(vertex) {}
    }

    database.schema.createTypeIndex(Schema.INDEX_TYPE.LSM_TREE, true, "Tester", "id")

    for (i in 0..250000) {
        val vertex = database.newVertex("Software")
        vertex.set("id", i.toString())

        database.async().createRecord(vertex) {}
    }

    database.schema.createTypeIndex(Schema.INDEX_TYPE.LSM_TREE, true, "Software", "id")

    database.async().waitCompletion()

    for (i in 0..250000) {
        database.async().newEdgeByKeys(
            "Tester",
            arrayOf("id"),
            arrayOf(i),
            "Software",
            arrayOf("id"),
            arrayOf(i),
            false,
            "testerOf",
            false,
            true,
            null
        )
    }

After running the above, running a SELECT query will show that the required "Software" vertex is indeed not present.

Temporary workaround: add database.async().waitCompletion() before index creation.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions