Bug in EbeanServer.save(Collection)?

Discussion in 'Plugin Development' started by axefan, May 17, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    axefan

    I've been using the EbeanServer object to persist several different types of objects succesfully, but when I try to save a large list of objects (>10,000 objects) using EbeanServer.save(Collection), the results are inconsistent.

    Here's a typical line of code used for saving a list of objects:
    Code:
    int result = this.getDatabase().save(entries);
    When this fails, no exception is raised and the result variable indicates that all objects were written. But when querying the database, not all objects are present.

    I've created a plugin to demonstrate the issue:

    https://github.com/axefan/DatabaseErrorDemo

    So, is this a known problem with the EbeanServer object or am I missing something?

    Update: This problem is not isolated to the EbeanServer.save(Collection) method.

    I've update the demo plugin so that there are 2 separate test cases: one that uses transactions and not Lists and another that does not use transactions but saves a List. Both methods start failing at around 10000 objects.

    Is anyone else seeing the same results?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 16, 2016
  2. Offline

    axefan

    More Info: This happens for both the MySQL and SqLite drivers! I've also tested this on two different machines (both win7).
     
  3. Offline

    Sammy

    Try and see how the BigBrother plugin developers do it, I think they need to save large amount of data too.
    Sorry I never had this problem
     
  4. Offline

    phaed

    BigBrother doesn't use Ebeans.

    I haven't had a chance to test this yet, I'll let you know how it goes.
     
  5. Offline

    Sammy

    I said that because it saves large amount of data too, maybe he could find a better way, Ebeans has some annoying limitations
     
  6. Offline

    phaed

    You're missing the point of this thread.
     
  7. Offline

    Sammy

    And you are taking the day to bother me !
    The point is that Ebeans has some bugs since forever, if this is one of them the best solution is just not using bukkit's persistence!
    EDIT: so you don't think Im just being a smart ass ;)
     
  8. Offline

    axefan

    Actually. I'm comming to the same conclusion. Dang! That would have been a nice solution if it worked. I guess I'll have to roll my own DB connections and hope that the plugin users know how to setup MySQL properly.

    I'll take a look at big brother, but I really need a database, so managing my own MySQL connection is probably the only way to go.
     
  9. Offline

    Sammy

    Well that maybe THE solution sadly, but try making a jdbc sqlite connection first, its easier for the users.
     
  10. Offline

    axefan

    Thanks for the posts. I've never used Ebeans much, so I wasn't aware of the problems. The SQLite JDBC connection is working fine for me. In my tests, I am able to save 1M records in a single transaction with no loss.
     
  11. Offline

    LennardF1989

    In attempt to raise the awareness a little, I reimplemented the Ebean Persistance Layer which fixes a lot of these issues, including the SQLite Add Constraint limitation, have a look. Link is in my signature :)
     
  12. Offline

    axefan

    Good to hear. I'll run some tests when I have time, but honestly, I've aleardy implemented my own solution, so I'll probably be using that going forward.
     
  13. Offline

    Lolmewn Retired Staff

    If you are going for MySQL databases, I recommend @alta189 's library. It's great =D
     
  14. Offline

    axefan

    I'm sure it's great, but setting up the connections explicitly is not that hard and by creating my own interface I can optimize the code for my specific use cases, plus now there's no worry about dependencies becoming out of date.
     
Thread Status:
Not open for further replies.

Share This Page