Project

General

Profile

Bug #10432

getObjects return null at the last iteration of nextObjects

Added by Mingfai Ma over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
% Done:

0%

Source:
other
Tags:
Backport:
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Say there are 11 items, and do a IoCTX.listObjectsPartial(10), the first 10 items can be retrieved after call the first nextObjects().
However, at the 2nd iteration after calling nextObjects, the returned "number of ids" is correct as 1, but getObjects() return null.
Basically, the last iteration always fail to return anything.

reference:

public int nextObjects() throws RadosException {
        if (list == null) {
            return 0;
        }
        Pointer entry = new Memory(Pointer.SIZE);
        int i = 0;
        while (i < limit && rados.rados_objects_list_next(list.getPointer(0), entry, null) == 0) {
            ids[i] = entry.getPointer(0).getString(0);
            i++;
        }
        if (i < limit) {
            // closing it
            rados.rados_objects_list_close(list.getPointer(0));
            list = null;
        }
        this.size = i;
        return this.size;
    }

Also available in: Atom PDF