-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Fix flaky Prism Loopback test #36927
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
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c3813ab
Fix flaky Prism Loopback test and remove deprecated Gradle import
aIbrahiim c1a150d
Fix Prism TestStream key
aIbrahiim 2a95d01
Fix Prism TestStream key
aIbrahiim 202ef00
Fix Prism TestStream key
aIbrahiim aeaabf3
Fix Prism TestStream key
aIbrahiim 4425219
Fix Prism TestStream key
aIbrahiim 0f7f900
Fix Prism TestStream key
aIbrahiim e2c62c2
Fix Prism TestStream key
aIbrahiim a59a903
Fix Prism TestStream key
aIbrahiim 6693da9
Fix Prism TestStream key
aIbrahiim 4520d46
Fix Prism TestStream key
aIbrahiim 553f5d8
Fix Prism TestStream key
aIbrahiim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ | |
| package engine | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "fmt" | ||
| "log/slog" | ||
| "time" | ||
|
|
||
|
|
@@ -173,18 +175,40 @@ type tsElementEvent struct { | |
| // Execute this ElementEvent by routing pending element to their consuming stages. | ||
| func (ev tsElementEvent) Execute(em *ElementManager) { | ||
| t := em.testStreamHandler.tagState[ev.Tag] | ||
| if t.pcollection == "" { | ||
| panic(fmt.Sprintf("TestStream tag %q not found in tagState", ev.Tag)) | ||
| } | ||
| info, ok := em.pcolInfo[t.pcollection] | ||
| if !ok { | ||
| panic(fmt.Sprintf("PColInfo not registered for TestStream output PCollection %q (tag %q)", t.pcollection, ev.Tag)) | ||
| } | ||
|
|
||
| var pending []element | ||
| for _, e := range ev.Elements { | ||
| if len(e.Encoded) == 0 { | ||
| panic(fmt.Sprintf("TestStream: empty encoded element for tag %q", ev.Tag)) | ||
| } | ||
| buf := bytes.NewBuffer(e.Encoded) | ||
| elmBytes := info.EDec(buf) | ||
| if len(elmBytes) == 0 { | ||
| panic(fmt.Sprintf("TestStream: decoded element bytes are empty for tag %q, encoded length: %d", ev.Tag, len(e.Encoded))) | ||
| } | ||
|
|
||
| var keyBytes []byte | ||
| if info.KeyDec != nil { | ||
| kbuf := bytes.NewBuffer(elmBytes) | ||
| keyBytes = info.KeyDec(kbuf) | ||
| } | ||
|
|
||
| pending = append(pending, element{ | ||
| window: window.GlobalWindow{}, | ||
| timestamp: e.EventTime, | ||
| elmBytes: e.Encoded, | ||
| elmBytes: elmBytes, | ||
| keyBytes: keyBytes, | ||
| pane: typex.NoFiringPane(), | ||
| }) | ||
| } | ||
|
|
||
| // Update the consuming state. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please keep the comment unless there's a good reason to remove it. It indicates intent of the following code. |
||
| for _, sID := range em.consumers[t.pcollection] { | ||
| ss := em.stages[sID] | ||
| added := ss.AddPending(em, pending) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Unfortunately, KeyDec will always be nil in the current code because we override the coder of the pcollection. Specifically, we length-prefix the coder for the output pcollection of TestStream:
beam/sdks/go/pkg/beam/runners/prism/internal/handlerunner.go
Line 315 in e3afe62
Therefore, the coder will be a lp coder and we won't get a key decoder in the following line.
beam/sdks/go/pkg/beam/runners/prism/internal/execute.go
Line 218 in e3afe62
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 one possible solution for this is not to LP the entire kv coder during preprocessing, but only the value coder part.
In this case, we will keep a KV coder for this pcollection, then a fix like the current one can pick up the key decoder.
WDYT @lostluck ?