[ 
https://issues.apache.org/jira/browse/RATIS-1277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17256807#comment-17256807
 ] 

runzhiwang edited comment on RATIS-1277 at 12/31/20, 3:02 AM:
--------------------------------------------------------------

[~szetszwo] 
You can find the following output, the request type is STREAM_DATA, but the 
reply type is STREAM_HEADER, clientId also is different. I will test the 
previous version I have test again.
{code:java}
succ:true reply written:0 expected:1000000 
clientId:client-6C3D34F237DA,type:STREAM_HEADER,streamId4,offset:0,datalength:0 
localWrite:1927248929 remoteWrites:789787006 
request:DataStreamRequestByteBuf:clientId=client-F1F2794DEFF0,type=STREAM_DATA,id=4,offset=48000000,length=1000000
{code}


{code:java}
composeAsync(info.getPrevious(), requestExecutor, n -> 
JavaUtils.allOf(remoteWrites)
        .thenCombineAsync(localWrite, (v, bytesWritten) -> {
          if (request.getType() == Type.STREAM_HEADER
              || (request.getType() == Type.STREAM_DATA && !close)) {
            for (CompletableFuture<DataStreamReply> replyFuture : remoteWrites) 
{
              final DataStreamReply reply = replyFuture.join();
              if (!reply.isSuccess() || reply.getBytesWritten() != 
bytesWritten) {
               +  System.err.println("succ:" + reply.isSuccess() + " reply 
written:" + reply.getBytesWritten() +
                    " expected:" + bytesWritten + " clientId:" + 
reply.getClientId() + ",type:" + reply.getType() + ",streamId" +
                    reply.getStreamId() + ",offset:" + reply.getStreamOffset() 
+ ",datalength:" + reply.getDataLength() +
                    " localWrite:" + localWrite.hashCode() + " remoteWrites:" + 
remoteWrites.hashCode() + " request:" + request);
              }
            }
            sendReply(remoteWrites, request, bytesWritten, ctx, close);
          }
{code}




was (Author: yjxxtd):
[~szetszwo] 
You can find the following output, the request type is STREAM_DATA, but the 
reply type is STREAM_HEADER. I will test the previous version I have test again.
{code:java}
succ:true reply written:0 expected:1000000 
clientId:client-6C3D34F237DA,type:STREAM_HEADER,streamId4,offset:0,datalength:0 
localWrite:1927248929 remoteWrites:789787006 
request:DataStreamRequestByteBuf:clientId=client-F1F2794DEFF0,type=STREAM_DATA,id=4,offset=48000000,length=1000000
{code}


{code:java}
composeAsync(info.getPrevious(), requestExecutor, n -> 
JavaUtils.allOf(remoteWrites)
        .thenCombineAsync(localWrite, (v, bytesWritten) -> {
          if (request.getType() == Type.STREAM_HEADER
              || (request.getType() == Type.STREAM_DATA && !close)) {
            for (CompletableFuture<DataStreamReply> replyFuture : remoteWrites) 
{
              final DataStreamReply reply = replyFuture.join();
              if (!reply.isSuccess() || reply.getBytesWritten() != 
bytesWritten) {
               +  System.err.println("succ:" + reply.isSuccess() + " reply 
written:" + reply.getBytesWritten() +
                    " expected:" + bytesWritten + " clientId:" + 
reply.getClientId() + ",type:" + reply.getType() + ",streamId" +
                    reply.getStreamId() + ",offset:" + reply.getStreamOffset() 
+ ",datalength:" + reply.getDataLength() +
                    " localWrite:" + localWrite.hashCode() + " remoteWrites:" + 
remoteWrites.hashCode() + " request:" + request);
              }
            }
            sendReply(remoteWrites, request, bytesWritten, ctx, close);
          }
{code}



> FileStore write failed because out of order
> -------------------------------------------
>
>                 Key: RATIS-1277
>                 URL: https://issues.apache.org/jira/browse/RATIS-1277
>             Project: Ratis
>          Issue Type: Sub-task
>            Reporter: runzhiwang
>            Assignee: runzhiwang
>            Priority: Major
>         Attachments: screenshot-2.png, screenshot-3.png
>
>
>  !screenshot-3.png! 
> As the following image and code shows, the code check the byteWritten of 
> STREAM_HEADER, i.e. 0,  equals to 10000, of course failed.
>  !screenshot-2.png! 
> {code:java}
> static boolean 
> checkSuccessRemoteWrite(List<CompletableFuture<DataStreamReply>> 
> replyFutures, long bytesWritten) {
>     for (CompletableFuture<DataStreamReply> replyFuture : replyFutures) {
>       final DataStreamReply reply = replyFuture.join();
>       if (!reply.isSuccess() || reply.getBytesWritten() != bytesWritten) {
>         + System.err.println("succ:" + reply.isSuccess() + " reply written:" 
> + reply.getBytesWritten() +
>         +    " expected:" + bytesWritten + " clientId:" + reply.getClientId() 
> + ",type:" + reply.getType() + ",streamId" +
>         +    reply.getStreamId() + ",offset:" + reply.getStreamOffset() + 
> ",datalength:" + reply.getDataLength());
>         return false;
>       }
>     }
>     return true;
>   }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to