Skip to content
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

Download segment data only once for verification #1393

Merged
merged 4 commits into from
Mar 9, 2020

Conversation

mk-livepeer
Copy link
Contributor

Broadcaster nodes should download segment data once for both sig verification and pixel count verification

closes #1382

Copy link
Member

@yondonfu yondonfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to make sure params.Renditions is populated as mentioned in #1382

verification/verify_test.go Outdated Show resolved Hide resolved
verification/verify_test.go Show resolved Hide resolved
mk-livepeer pushed a commit that referenced this pull request Feb 21, 2020
mk-livepeer pushed a commit that referenced this pull request Feb 21, 2020
@yondonfu yondonfu force-pushed the mk/download-segment-data-once#1382 branch from 0bb3a78 to 08842a3 Compare March 5, 2020 00:02
@yondonfu yondonfu dismissed their stale review March 5, 2020 00:03

Dismissing my own review because the latest changes I pushed resolves the request.

@yondonfu yondonfu requested a review from j0sh March 5, 2020 00:23
renditionData := make([][]byte, len(segData))
for i := range segData {
renditionData[i] = make([]byte, len(segData[i]))
copy(renditionData[i], segData[i])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just do renditionData[i] = segData[i] ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally copied the data in segData[i] because changes to segData[i] would result in changes to params.Renditions[i] since they would point to the same slice header. But, segData is not used anywhere in server/broadcast.go besides in verify() so it should be safe to set params.Renditions to segData. In 75f9d11, I updated a few tests to allocate a new slice for segData whenever passing it as an argument to verify() (otherwise, some tests would fail because mutations to the same slice for segData would mutate the values for params.Renditions).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I see, I would be okay with not mutating as a good practice here as well. I'll leave it up to you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to keep this change as avoiding the copy of segment data (which can be largeish) is nice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes didn't think about the size, good point.

server/broadcast_test.go Outdated Show resolved Hide resolved
server/broadcast_test.go Outdated Show resolved Hide resolved
@kyriediculous
Copy link
Contributor

Changes look good. I'll leave that one decision up to you whether you want to drop 75f9d11 or not.

Can we rebase and resolve conflicts?

@yondonfu yondonfu force-pushed the mk/download-segment-data-once#1382 branch from 75f9d11 to edde06d Compare March 9, 2020 23:09
@yondonfu
Copy link
Member

yondonfu commented Mar 9, 2020

Rebased.

Copy link
Contributor

@kyriediculous kyriediculous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@yondonfu yondonfu merged commit cf3e4e5 into master Mar 9, 2020
@yondonfu yondonfu deleted the mk/download-segment-data-once#1382 branch March 9, 2020 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

B should download segment data once for both sig verification and pixel count verification
4 participants