GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Issue after update with compose index before compaction · Issue #1233 · ArcadeData/arcadedb

Issue after update with compose index before compaction #1233

New issue
Copy link
New issue
Copy link
Closed
#2474
Closed
Issue after update with compose index before compaction#1233
#2474
Copy link
Assignees
lvca
Milestone
23.11.1

Description

@vic0824
vic0824
opened on Sep 8, 2023
Issue body actions

ArcadeDB Version:

v23.7.1 (build 3213507/1692051585396/main)

OS and JDK Version:

Windows 10 10.0 - OpenJDK 64-Bit Server VM 11.0.20.1 (Corretto-11.0.20.9.1)

Expected behavior

After Inserting documents in async mode, updating one document, updating again the same document, the index should be updated accordingly.

Actual behavior

if the number of documents inserted asynchronously is > parallel level, the index is not updated.
If the number of docs inserted is < parallel level, the index is updated correctly.

Steps to reproduce

Execute the attached testWhereAfterAsyncInsert test case.
Sorry, it's a bit verbose, but if I try to simplify it, it does not reproduce the problem.
If you find what is the actual root cause of the problem, we can design a simpler test case.
In the test case I execute the first update asynchronously and the second update synchronously. but I have verified that also the other two combinations (both async or both sync) produce a failure.

testWhereAfterAsyncInsert.zip

Activity

Next
  1. vic0824 commented on Sep 11, 2023

    @vic0824
    vic0824
    on Sep 11, 2023
    Author
    More actions

    I have also found that if I change the index on (status, id) to not unique, the problem does not occur.

  2. vic0824 commented on Sep 11, 2023

    @vic0824
    vic0824
    on Sep 11, 2023
    Author
    More actions

    But now other things start to break, e.g. updates are not reflected in indexes anymore, so this is not a viable solution.

  3. lvca commented on Sep 13, 2023

    @lvca
    lvca
    on Sep 13, 2023
    Member
    More actions

    Testing your code I get this:

    org.opentest4j.AssertionFailedError: 
    Expected :1
    Actual   :2
    	at com.arcadedb.server.AsyncUpdateTest.testWhereAfterAsyncInsert(AsyncUpdateTest.java:176)
    

    Is it the same output as you?

  4. vic0824 commented on Sep 14, 2023

    @vic0824
    vic0824
    on Sep 14, 2023
    Author
    More actions

    Yes, the query should return the record with Id = 1, but it returns the record with Id = 2

  5. vic0824 commented on Sep 14, 2023

    @vic0824
    vic0824
    on Sep 14, 2023
    Author
    More actions

    The resubmitOrder method call sets status = PENDING where id = 1, so the query SELECT id, processor, trigger, vstart, vstop, status FROM Order WHERE status = ? ORDER BY id ASC LIMIT ? called with parameters 'PENDING' and 1 should return the record with id = 1, but it doesn't, because the composite index has not been updated.

  6. vic0824 commented on Sep 16, 2023

    @vic0824
    vic0824
    on Sep 16, 2023
    Author
    More actions

    By the way, in the meantime I have completed the migration of my project from Hsqldb to ArcadeDB and I've put it into production (with the bug described in this issue).
    I will be presenting it at a conference later this month, and in my powerpoint presentation I have put in some good words about ArcadeDB. I cannot publish the presentation yet (it will be done some time after the conference), but if you want I can share a copy privately with you.

    Reacted by Luca Garulli
  7. vic0824 commented on Sep 16, 2023

    @vic0824
    vic0824
    on Sep 16, 2023
    Author
    More actions

    Additional info on the test case: if I replace WHERE status = 'PENDING' in the last select query with WHERE status != 'ERROR', then it works. I hope this can help you troubleshooting the problem.

  8. vic0824 commented on Sep 20, 2023

    @vic0824
    vic0824
    on Sep 20, 2023
    Author
    More actions

    As a workaround, I have replaced the update with a combination of delete + insert, but it's not very efficient and the code is unnecessarily verbose.

  9. lvca commented on Sep 20, 2023

    @lvca
    lvca
    on Sep 20, 2023
    Member
    More actions

    @vic0824 That's great! is the presentation going to be public at a certain point?

    About the issue, it's in my todo list for today. I keep you posted.

  10. vic0824 commented on Sep 21, 2023

    @vic0824
    vic0824
    on Sep 21, 2023
    Author
    More actions

    Yes, the presentation is going to be published after the conference.

  11. lvca commented on Nov 15, 2023

    @lvca
    lvca
    on Nov 15, 2023
    Member
    More actions

    @vic0824 I'm back on this issue. I've the test case in the ArcadeDB test suite now (local branch) and it fails as you mentioned. I tried to put a

    database.async().waitCompletion();

    Before the query, but it's the same. So it's not an async timing issue, but rather the index is not updated in async mode? Is this what you were trying to tell me?

  12. lvca commented on Nov 16, 2023

    @lvca
    lvca
    on Nov 16, 2023
    Member
    More actions

    I removed the async part transforming the method in synchronous, and I've got the same error. Maybe it's not in the async API, there is something with the way the index iterator works. Checking on it.

  13. lvca commented on Nov 16, 2023

    @lvca
    lvca
    on Nov 16, 2023
    Member
    More actions

    Ok, I found the issue. During the update to PENDING,1, the entry in the index is not correctly appended at the end of the key entries. It was a corner case with composite + update of the same key + before compaction. Checking for regressions, otherwise I should be able to push the change.

  14. lvca
    added a commit that references this issue on Nov 16, 2023

    fix: issue with composite index + update before compaction

    02e861f
  15. lvca commented on Nov 16, 2023

    @lvca
    lvca
    on Nov 16, 2023
    Member
    More actions

    Fixed

  16. 1 remaining item

  17. lvca
    added this to the 23.11.1 milestone on Nov 16, 2023
  18. lvca
    changed the title [-]Async API does not update index in some cases[/-] [+]Issue after update with compose index before compaction[/+] on Nov 16, 2023
  19. lvca
    self-assigned this
    on Nov 16, 2023
  20. lvca
    added
    bug
    fixed
    on Nov 16, 2023
  21. vic0824 commented on Nov 16, 2023

    @vic0824
    vic0824
    on Nov 16, 2023
    Author
    More actions

    Excellent, thanks!
    So the issue was not with the async API itself, that's why I had such a hard time coming up with a simple test to reproduce it.
    I'm glad it's fixed now.

    Reacted by Luca Garulli
  22. lvca commented on Nov 16, 2023

    @lvca
    lvca
    on Nov 16, 2023
    Member
    More actions

    I did it go your presentation?

  23. vic0824 commented on Nov 17, 2023

    @vic0824
    vic0824
    on Nov 17, 2023
    Author
    More actions

    It went very well, thanks.
    I still don't know if the presentations will be published, I'll let you know if they will.

    Reacted by Luca Garulli
  24. mergify
    added a commit that references this issue on Sep 8, 2025

    chore(deps): bump org.codehaus.mojo:versions-maven-plugin from 2.18.0…

    This issue will close once commit 686f577 is merged into the 'main' branch.
    686f577
  25. mergify
    added 2 commits that reference this issue on Feb 22, 2026

    chore(deps-dev): bump testcontainers from 11.11.0 to 11.12.0 in /e2e-…

    11d5bc1

    chore(deps-dev): bump testcontainers from 11.11.0 to 11.12.0 in /e2e-…

    8f261ca
  26. tae898
    added 4 commits that reference this issue on Jun 28, 2026

    fix: issue with composite index + update before compaction

    592c668

    chore(deps): bump org.codehaus.mojo:versions-maven-plugin from 2.18.0…

    686edd5

    chore(deps-dev): bump testcontainers from 11.11.0 to 11.12.0 in /e2e-…

    a561246

    chore(deps-dev): bump testcontainers from 11.11.0 to 11.12.0 in /e2e-…

    6039f50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @lvca
    lvca

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    • 23.11.1

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.