Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correct v2 listing of more than 1000 objects #580

Merged
merged 1 commit into from
May 24, 2017

Conversation

vadmeste
Copy link
Member

@vadmeste vadmeste commented May 21, 2017

Fix listing objects (infinite loop) when there is more than
1000 objects in the server.

Fixes #578

*/
public static void listObject_test5() throws Exception {
int i;
int totalObjsNr = 1050;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objCount or totalObjects is better

String filename = createFile(1);
client.putObject(bucketName, filename, filename);
Files.delete(Paths.get(filename));
filenames[i] = filename;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could do below optimization

String baseFilename = createFile(1);
for (...) {
  objectNames[i] = baseFilename + "-" + i;
  client.putObject(bucketName, objectNames[i], filename);
}
Files.delete(Path.get(baseFilename));

@@ -668,10 +668,41 @@ public static void listObject_test4() throws Exception {
}

/**
* Test: listObjects(bucketName, final String prefix, final boolean recursive, final boolean useVersion1).
* Test: listObjects(bucketName, final String prefix, final boolean recursive).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could indicate the test behavior by prefixing Test: recursive:

*/
public static void listObject_test5() throws Exception {
int i;
int totalObjsNr = 1050;

System.out.println("Test: listObjects(final String bucketName, final String prefix, final boolean recursive)");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could indicate the test behavior by prefixing Test: recursive:


// Check the number of uploaded objects
if (i != totalObjsNr) {
throw new Exception("[FAILED] Test: listObject_test5(), number of items found: " + i);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could indicate expected in the error message "[FAILED] Test: listObject_test5(), expected object count: " + objCount + ", got: " + i

Copy link
Member

@balamurugana balamurugana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could have better commit log by
fix: list object v2 does not work for more than 1000 entries

@vadmeste
Copy link
Member Author

All your comments are addressed @balamurugana, except the commit message, your suggestion was long (>50 chars) so I tried a shorter one.

@harshavardhana
Copy link
Member

@vadmeste

https://repo1.maven.org/maven2/org/abego/treelayout/org.abego.treelayout.core/1.0.1/org.abego.treelayout.core-1.0.1.jar
[ant:checkstyle] C:\projects\minio-java\functional\FunctionalTest.java:677: Line is longer than 120 characters (found 126).
[ant:checkstyle] C:\projects\minio-java\functional\FunctionalTest.java:694: Line is longer than 120 characters (found 132).
:api:checkstyleMain FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':api:checkstyleMain'.
> Checkstyle rule violations were found. See the report at: file:///C:/projects/minio-java/api/build/reports/checkstyle/main.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 55.236 secs
Command

Some stylecheck failures.

@vadmeste
Copy link
Member Author

vadmeste commented May 22, 2017

Fixing style done.

harshavardhana
harshavardhana previously approved these changes May 22, 2017
Copy link
Member

@balamurugana balamurugana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All your comments are addressed @balamurugana, except the commit message, your suggestion was long (>50 chars) so I tried a shorter one.

I would suggest you to prefix fix: in the commit message. Thats the convention followed.

Rest of things are good to go

@vadmeste
Copy link
Member Author

I would suggest you to prefix fix: in the commit message. Thats the convention followed.

Fixed

@harshavardhana harshavardhana changed the title list: Fix v2 listing with more than 1000 elems fix: Correct v2 listing of more than 1000 objects May 23, 2017
harshavardhana
harshavardhana previously approved these changes May 23, 2017
Copy link
Member

@harshavardhana harshavardhana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix listing objects (infinite loop) when there is more than 1000 objets in the server.

There is a typo here objets should be objects

Fix listing objects (infinite loop) when there is more than
1000 objects in the server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants