Skip to content

How to clear consumed items in order to reduce data on disk ? #38

Description

@yanggeorge

I create a bigqueue, and enqueue many items, then dequeue all.
But the size of bigqueue on disk will become bigger and bigger.

        String queueDir = "/Users/ym/data/bigqueue";
        String queueName = "demo";
        IBigQueue bigQueue = null;
        try {
            bigQueue = new BigQueueImpl(queueDir, queueName);


            for (int i = 0; i < 1000000; i++) {
                String item = String.valueOf(i);
                bigQueue.enqueue(item.getBytes());
            }

            // dequeue some items
            for (int i = 0; i < 1000000; i++) {
                String item = new String(bigQueue.dequeue());
                System.out.println(item);
            }
        } finally {
            bigQueue.close();
        }

How to release space or reduce file ?

I have tried IBigQueue.gc() , but not working .
IBigQueue.removeAll() will reduce the file, but I only want to clear consumed items.

Activity

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

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