[ 
https://issues.apache.org/jira/browse/BEAM-9746?focusedWorklogId=422411&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-422411
 ]

ASF GitHub Bot logged work on BEAM-9746:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Apr/20 22:55
            Start Date: 14/Apr/20 22:55
    Worklog Time Spent: 10m 
      Work Description: youngoli commented on pull request #11413: [BEAM-9746] 
check for 0 length copies from state
URL: https://github.com/apache/beam/pull/11413#discussion_r408481881
 
 

 ##########
 File path: sdks/go/pkg/beam/core/runtime/harness/statemgr_test.go
 ##########
 @@ -258,6 +261,167 @@ func TestStateChannel(t *testing.T) {
        }
 }
 
+// TestStateKeyReader validates ordinary Read cases
+func TestStateKeyReader(t *testing.T) {
+       const readLen = 4
+       tests := []struct {
+               name     string
+               buflens  []int // sizes of the buffers received on the state 
channel.
+               numReads int
 
 Review comment:
   Is the number of reads something that needs to be predictable to whatever 
code uses the reader? To me it seems like one of those implementation details 
that doesn't need to be unit tested because it's invisible to the caller.
   
   The reason this stood out to me is that the `numReads` in all the test cases 
below seem a bit inscrutable, and it would cause these tests to fail if the 
implementation of the `stateKeyReader` was changed slightly, which is just an 
annoyance unless it would actually break code.
   
   On the other hand, if the number of reads _is_ a detail that users should 
know, and correctness does rely on it staying consistent, that seems like it 
should be explicitly documented on `stateKeyReader.Read`.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 422411)

> [Go SDK] Empty side inputs causing spurious zero elements
> ---------------------------------------------------------
>
>                 Key: BEAM-9746
>                 URL: https://issues.apache.org/jira/browse/BEAM-9746
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-go
>            Reporter: Robert Burke
>            Assignee: Robert Burke
>            Priority: Major
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> A user discovered that empty side inputs would spuriously provide a single 
> zero element.
> The error was narrowed down to the Go SDK's state manager codeĀ  copying the 
> stateGetResponse data wasn't checking that the original data source even had 
> any bytes in it, leading it in particular to interpret length prefixed data 
> as having 0 length, which would cause zero value elements to be generated. 
> Notably, this caused empty strings.



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

Reply via email to