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
Issue 550: add readLastAddConfirmedAndEntry in ReadHandle for long poll read #729
Conversation
FAILURE --none-- |
* It is used for readLastAddConfirmedAndEntry. | ||
*/ | ||
@Data | ||
class LastConfirmedAndEntry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better that this class is not an inner class but a top level class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move it out of ReadHandle.java, make it an interface
interface LastConfirmedAndEntry extends AutoCloseable {
long getLastAddConfirmed();
boolean hasEntry();
LedgerEntry getEntry();
}
create a class LastConfirmedAndEntryImpl to implement the interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @eolivelli @sijie , will change it.
* | ||
* @param entryId | ||
* next entry id to read | ||
* @param timeOutInMillis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case of THIS timeout the CompletableFuture will return null ? or is will be completed exceptionally ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will return null
entry and latest lac on timeout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. In LedgerHandle, most of the similar situation will return null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a line which explains? That was my real request, sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a line which explains? That was my real request, sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. sure will add it.
FAILURE --none-- |
1 similar comment
FAILURE --none-- |
@@ -17,12 +17,12 @@ | |||
*/ | |||
package org.apache.bookkeeper.client; | |||
|
|||
import static org.apache.bookkeeper.client.LedgerHandle.LOG; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It is originally there, this change adjust the order of importing, will handle it.
* It is used for readLastAddConfirmedAndEntry. | ||
*/ | ||
@Data | ||
class LastConfirmedAndEntry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move it out of ReadHandle.java, make it an interface
interface LastConfirmedAndEntry extends AutoCloseable {
long getLastAddConfirmed();
boolean hasEntry();
LedgerEntry getEntry();
}
create a class LastConfirmedAndEntryImpl to implement the interface.
* | ||
* @param entryId | ||
* next entry id to read | ||
* @param timeOutInMillis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will return null
entry and latest lac on timeout.
FAILURE --none-- |
@@ -21,6 +21,7 @@ | |||
package org.apache.bookkeeper.client.api; | |||
|
|||
import java.util.concurrent.CompletableFuture; | |||
import lombok.Data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't this import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right. will remove it.
} | ||
|
||
/** | ||
* {@inheritDoc } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no space before '}'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will change it.
} | ||
|
||
/** | ||
* {@inheritDoc } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no space before '}'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will change it.
} | ||
|
||
/** | ||
* {@inheritDoc } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no space before '}'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will change it.
* This contains LastAddConfirmed entryId and a LedgerEntry wanted to read. | ||
* It is used for readLastAddConfirmedAndEntry. | ||
*/ | ||
public class LastConfirmedAndEntryImpl implements LastConfirmedAndEntry{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can simplify this class using lombok. you don't need to write constructor and getters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I got your idea, but since this is an implementation for interface, explict these method seems more easy to read.
* This contains LastAddConfirmed entryId and a LedgerEntry wanted to read. | ||
* It is used for readLastAddConfirmedAndEntry. | ||
*/ | ||
public class LastConfirmedAndEntryImpl implements LastConfirmedAndEntry{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space before '{'
LGTM |
FAILURE --none-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@jiazhai can you address @eolivelli 's comment on timeoutMillis
? then we can move forward.
@sijie , thanks. have added it. |
FAILURE --none-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @jiazhai maybe the test could become flaky. Do you think we can enhance it
|
||
// test readLastAddConfirmedAndEntry | ||
LastConfirmedAndEntry lastConfirmedAndEntry = | ||
result(reader.readLastAddConfirmedAndEntry(0, 999, false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a 999 timeout less then 1 second. This test could be flaky.
Maybe we can do a loop until the condition is verified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eolivelli Thanks.
This is only for test the interface works, There are other tests for the functionality of asyncReadLastConfirmedAndEntry().
Here it read an old entry, which has already been there, so ideally it need no wait time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @jiazhai maybe the test could become flaky. Do you think we can enhance it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 looks good
…oll read Descriptions of the changes in this PR: 1, add a class LastAddConfirmedAndEntry and metnod readLastAddConfirmedAndEntry() in ReadHandle; 2, add implementation for readLastAddConfirmedAndEntry in LedgerHandler; 3, add testcase in BookKeeperApiTest; 4, remove un-used imports, break down long lines, fix wrong comments. Author: Jia Zhai <zhaijia@apache.org> Reviewers: Enrico Olivelli <eolivelli@gmail.com>, Sijie Guo <sijie@apache.org>, Venkateswararao Jujjuri (JV) <None> This closes #729 from zhaijack/issue-550, closes #550 (cherry picked from commit c9a1b8a) Signed-off-by: Sijie Guo <sijie@apache.org>
…long poll read Descriptions of the changes in this PR: 1, add a class LastAddConfirmedAndEntry and metnod readLastAddConfirmedAndEntry() in ReadHandle; 2, add implementation for readLastAddConfirmedAndEntry in LedgerHandler; 3, add testcase in BookKeeperApiTest; 4, remove un-used imports, break down long lines, fix wrong comments. Author: Jia Zhai <zhaijia@apache.org> Reviewers: Enrico Olivelli <eolivelli@gmail.com>, Sijie Guo <sijie@apache.org>, Venkateswararao Jujjuri (JV) <None> This closes apache#729 from zhaijack/issue-550, closes apache#550
…by mistake during maven migration Author: Fangmin Lyu <fangmin@apache.org> Reviewers: andor@apache.org Closes apache#729 from lvfangmin/ZOOKEEPER-3207
Descriptions of the changes in this PR:
1, add a class LastAddConfirmedAndEntry and metnod readLastAddConfirmedAndEntry() in ReadHandle;
2, add implementation for readLastAddConfirmedAndEntry in LedgerHandler;
3, add testcase in BookKeeperApiTest;
4, remove un-used imports, break down long lines, fix wrong comments.