Skip to content

WAL Tail API returns only single object #591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
m4ttek opened this issue Jan 8, 2025 · 4 comments · Fixed by #592
Closed

WAL Tail API returns only single object #591

m4ttek opened this issue Jan 8, 2025 · 4 comments · Fixed by #592

Comments

@m4ttek
Copy link

m4ttek commented Jan 8, 2025

The following code always returns single object, even if WAL TAIL API (https://docs.arangodb.com/3.12/develop/http-api/replication/write-ahead-log/#tail-recent-server-operations) returns multiple json objects:

    protected CompletableFuture<Response<OperationResponse[]>> fetchEventsFromCurrentTick(ArangoClientProvider sourceProvider, ProcessingState processingState) {
        Request<OperationResponse[]> tailRequest =
                Request.<OperationResponse[]>builder().path(WAL_TAIL_PATH.formatted(sourceProvider.arangoDBName()))
                        .method(Request.Method.GET)
                        .queryParam("syncerId", processorSettings.walSyncerId)
                        .queryParam("chunkSize", String.valueOf(processorSettings.chunkSize))
                        .queryParam("lastScanned", String.valueOf(processingState.getLastScannedTick()))
                        .queryParam("from", String.valueOf(processingState.getCurrentTick()))
                        .build();

        return sourceProvider.getClient().execute(tailRequest, OperationResponse[].class);
    }

As far as I investigated it, it's caused by Jackson behaviour which only allows for properly defined json objects. Unfortunately, json objects are not wrapped in array in Arango API.

I tried using RawJson type - it doesn't matter.

@rashtao
Copy link
Collaborator

rashtao commented Jan 8, 2025

Hi @m4ttek ,

the problem is caused by the fact that this API return response with content-type: x-arango-dump, which is:

The Content-Type of the result is application/x-arango-dump. This is an easy-to-process format, with all log events going onto separate lines in the response body. Each log event itself is a JSON object, …

But the serde only supports Json or Velocypack content types, therefore cannot handle these payloads.

To work around it, in #592 I have fixed the issue for deserialization targets RawBytes and RawJson.

@rashtao rashtao reopened this Jan 8, 2025
@m4ttek
Copy link
Author

m4ttek commented Jan 8, 2025

@rashtao great, many thanks for quick response and fix. I'm looking forward to a new version of arango driver

@rashtao
Copy link
Collaborator

rashtao commented Jan 9, 2025

released in https://github.com/arangodb/arangodb-java-driver/releases/tag/v7.16.0

@rashtao rashtao closed this as completed Jan 9, 2025
@m4ttek
Copy link
Author

m4ttek commented Jan 10, 2025

I've checked it and it's working now. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants