[GitHub] sijie commented on a change in pull request #244: Issue#243 - asyncAddEntry fails with NPE with LedgerHandlerAdv

2017-07-17 Thread git
sijie commented on a change in pull request #244: Issue#243 - asyncAddEntry 
fails with NPE with LedgerHandlerAdv
URL: https://github.com/apache/bookkeeper/pull/244#discussion_r127842876
 
 

 ##
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
 ##
 @@ -720,8 +720,7 @@ public void asyncAddEntry(final byte[] data, final 
AddCallback cb,
  * @param ctx
  *some control object
  */
-public void asyncAddEntry(final long entryId, final byte[] data, final 
AddCallback cb, final Object ctx)
-throws BKException {
+public void asyncAddEntry(final long entryId, final byte[] data, final 
AddCallback cb, final Object ctx) {
 
 Review comment:
   I don't understand why do we need this. The LedgerHandleAdv can just 
override the method and fail the request before initiating the add ops.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] sijie commented on a change in pull request #244: Issue#243 - asyncAddEntry fails with NPE with LedgerHandlerAdv

2017-07-17 Thread git
sijie commented on a change in pull request #244: Issue#243 - asyncAddEntry 
fails with NPE with LedgerHandlerAdv
URL: https://github.com/apache/bookkeeper/pull/244#discussion_r127800976
 
 

 ##
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
 ##
 @@ -720,8 +720,7 @@ public void asyncAddEntry(final byte[] data, final 
AddCallback cb,
  * @param ctx
  *some control object
  */
-public void asyncAddEntry(final long entryId, final byte[] data, final 
AddCallback cb, final Object ctx)
-throws BKException {
+public void asyncAddEntry(final long entryId, final byte[] data, final 
AddCallback cb, final Object ctx) {
 
 Review comment:
   in LedgerHandleAdv, we should not allow adding entries without providing any 
entry id. Otherwise, the semantic is too complicated to maintain. As it is hard 
to tell, -1 is a user provided entry id or it is provided by calling addEntry 
without an entry id.
   
   /cc @jvrao 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] sijie commented on a change in pull request #244: Issue#243 - asyncAddEntry fails with NPE with LedgerHandlerAdv

2017-07-17 Thread git
sijie commented on a change in pull request #244: Issue#243 - asyncAddEntry 
fails with NPE with LedgerHandlerAdv
URL: https://github.com/apache/bookkeeper/pull/244#discussion_r127800142
 
 

 ##
 File path: 
bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieWriteLedgerTest.java
 ##
 @@ -179,6 +180,27 @@ public void testLedgerCreateAdv() throws Exception {
 }
 
 /**
+ * Verify that LedgerHandleAdv can handle asynchAddEntry without the 
entryId
+ *
+ * @throws Exception
+ */
+@Test(timeout = 6)
+public void testAsynchAddEntryLedgerCreateAdv() throws Exception {
 
 Review comment:
   Asynch => Async
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] sijie commented on a change in pull request #244: Issue#243 - asyncAddEntry fails with NPE with LedgerHandlerAdv

2017-07-14 Thread git
sijie commented on a change in pull request #244: Issue#243 - asyncAddEntry 
fails with NPE with LedgerHandlerAdv
URL: https://github.com/apache/bookkeeper/pull/244#discussion_r127568518
 
 

 ##
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
 ##
 @@ -720,8 +720,7 @@ public void asyncAddEntry(final byte[] data, final 
AddCallback cb,
  * @param ctx
  *some control object
  */
-public void asyncAddEntry(final long entryId, final byte[] data, final 
AddCallback cb, final Object ctx)
-throws BKException {
+public void asyncAddEntry(final long entryId, final byte[] data, final 
AddCallback cb, final Object ctx) {
 
 Review comment:
   since we are touching this function now, I'd like to also raise one 
discussing about the semantic here. Currently it is totally the application's 
responsibility on managing the semantic on using this API. it would be good to 
add some constraints on this API:
   
   - if entryId is negative  (the fix @eolivelli tried to fix)
   - if entryId is smaller than LAC, that means this entry is a duplicated entry
   
   in both cases, we should fail the addEntry with exceptions.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] sijie commented on a change in pull request #244: Issue#243 - asyncAddEntry fails with NPE with LedgerHandlerAdv

2017-07-14 Thread git
sijie commented on a change in pull request #244: Issue#243 - asyncAddEntry 
fails with NPE with LedgerHandlerAdv
URL: https://github.com/apache/bookkeeper/pull/244#discussion_r127567837
 
 

 ##
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandleAdv.java
 ##
 @@ -165,6 +165,11 @@ public void asyncAddEntry(final long entryId, final 
byte[] data, final int offse
  */
 @Override
 protected void doAsyncAddEntry(final PendingAddOp op, final ByteBuf data, 
final AddCallback cb, final Object ctx) {
+if (op.entryId < 0 ) {
 
 Review comment:
   when will this happen? I think this change volatiles the semantic of 
LedgerHandleAdv#asyncAddEntry. if the entry id is negative, we should reject 
this add with illegal arguments. 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services