Skip to content

The queue does not work, if I add more than 255 elements #3

@Hixon10

Description

@Hixon10

Hello,

To reproduce this case, you need to perform the following steps:

  1. create queue
  2. enqueue 500 elements
  3. close the application (it helps to reset your in-memory pointer com.me.rocks.queue.RocksQueue#head
  4. start the application (in this moment, your queue load in-memory pointer from the disk)
  5. consume 500 elements
  6. you will notice, that you receive the wrong elements

The reason, that you use BigEndian order for bytes, but uint64add merge operator assumes to have LITTLE_ENDIAN - facebook/rocksdb#7243 and https://github.com/facebook/rocksdb/blob/main/utilities/merge_operators/uint64add.cc

I don't know how to fix it. Java Rocksdb API does not allow to create a new merge operator. Also, we cannot use LITTLE_ENDIAN, because it breaks the queue order.

I saw golang implementation of the queue. They created the own merge operator, but we cannot do it. https://github.com/mijia/rocksq/blob/master/merge.go

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions