Skip to content

Java driver does not comply with API? #15

@thestarmaker

Description

@thestarmaker

Hi guys,

I was writing some integration test for my side project. As part of the test I am creating some documents and then creating a search view on top. I wanted to avoid Thread.sleep in the test so decided to specify 0 in the consolidationIntervalMsec option property hoping to effectively have instant commits.

I have discovered that if consolidationIntervalMsec is set to ANY value at all, then the search view setup fails with the following exception:

Caused by: com.arangodb.ArangoDBException: Response: 400, Error: 10 - expecting body to be of the form {name: <string>, type: <string>, properties: <object>}
	at com.arangodb.internal.velocystream.VstCommunicationAsync.lambda$execute$0(VstCommunicationAsync.java:132)
	at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
	at com.arangodb.internal.velocystream.VstConnectionAsync$1.call(VstConnectionAsync.java:101)
	at com.arangodb.internal.velocystream.VstConnectionAsync$1.call(VstConnectionAsync.java:97)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at com.arangodb.internal.velocystream.internal.MessageStore.consume(MessageStore.java:64)
	at com.arangodb.internal.velocystream.internal.ChunkStore.checkCompleteness(ChunkStore.java:66)
	at com.arangodb.internal.velocystream.internal.ChunkStore.checkCompleteness(ChunkStore.java:60)
	at com.arangodb.internal.velocystream.internal.VstConnection$1.call(VstConnection.java:147)
	at com.arangodb.internal.velocystream.internal.VstConnection$1.call(VstConnection.java:124)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

I suspect that the request object is not serialised to the format expected by the api if the consolidationIntervalMsec property is present:

{
    "name": "ThingsSearchView",
    "consolidationIntervalMsec": 60000,
    "links": {
        "Thing": {
            "fields": {
                "name": {
                    "analyzers": ["identity"]
                }
            }
        }
    },
    "type": "arangosearch"
}

Dependency used:

<dependency>
    <groupId>com.arangodb</groupId>
    <artifactId>arangodb-java-driver-async</artifactId>
    <version>5.0.4</version>
</dependency>

Arangodb version: 3.4.3

Unit Test to reproduce:


    @Test
    public void experiment() {
        ArangoDBAsync arango = new ArangoDBAsync.Builder()
                .user("root")
                .password("developer")
                .build();


        ArangoDatabaseAsync db = arango.db("database_of_things");
        if (db.exists().join()) {
            db.drop().join();
        }

        db.create().join();

        db.collection("Thing").create().join();

        db.createArangoSearch("ThingsSearchView", new ArangoSearchCreateOptions()
                .consolidationIntervalMsec(60000L) //<== This line breaks it
                .link(CollectionLink.on("Thing")
                        .fields(FieldLink.on("name")
                                .analyzers("identity"))))
                .join();

    }

P.S.
sorry about .join() everywhere, tried to keep it callback-free for ease of understanding

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions