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

fix(NODE-3528): add support for snappy 7 #2939

Merged
merged 6 commits into from Aug 23, 2021
Merged

fix(NODE-3528): add support for snappy 7 #2939

merged 6 commits into from Aug 23, 2021

Conversation

nbbeeken
Copy link
Contributor

Pulling this fix out of the larger deps upgrade PR.

Reworked the bson-ext and custom fle build variants to share the custom tasks. cleans up the EVG view a bit.

Test both snappy 6 and 7.

also upgrades our connection string dep

if ('kModuleError' in Snappy) {
return callback(Snappy['kModuleError']);
}
Snappy.compress(dataToBeCompressed, callback);
const snappyResult = Snappy.compress(dataToBeCompressed, callback);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we check function length here as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

not sure what you are asking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could assert the function length is what we expect it to be before assuming the last arg takes a callback, but might be brittle?

(function(){}).length === 0
(function(a){}).length === 1
(function(a, b){}).length === 2

Copy link
Contributor

Choose a reason for hiding this comment

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

so the danger I am seeing with assuming that the compress parameter takes a callback is that a future snappy might be updated to do something different with that second argument... it would be nice if we could determine the snappy version before calling the function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added some logic to check the dependency version, let me know what you think.

Comment on lines -34 to -39
"peerOptionalDependencies": {
"kerberos": "^1.1.0",
"mongodb-client-encryption": "^1.0.0",
"snappy": "^6.1.1",
"bson-ext": "^2.0.0"
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is unused IIUC

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused, isn't this what specifies the compatible versions of these dependencies? e.g., for us it's snappy 6 or 7?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

only implicitly in the sense that it happens to have some versions numbers which are kinda accurate (bson-ext is wrong). The peerOptionalDependencies was used in 3.5 by our old require_optional dependency. It's not a standard field and it isn't respected by any npm install logic, so I think dropping it, maybe in favor of a support table in our readme or docs would be better, thoughts?

Copy link
Contributor

@dariakp dariakp Aug 19, 2021

Choose a reason for hiding this comment

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

do we have an optional dependencies file that's a single point of entry for all these? because that's where I'd want to specify these; alternatively, I suppose a table in the README for an optional dependencies section would not be out of place since I guess this is how we'd tell users about these optional customizations? (let's not include bson-ext there at all though, it has worse performance than js-bson)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made NODE-3562 which recommends something more than a table in our README, but could be used to track that, sound good?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, looks good, tyvm!

@dariakp dariakp self-assigned this Aug 18, 2021
@dariakp dariakp self-requested a review August 18, 2021 15:07
@dariakp dariakp added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Aug 18, 2021
Comment on lines -34 to -39
"peerOptionalDependencies": {
"kerberos": "^1.1.0",
"mongodb-client-encryption": "^1.0.0",
"snappy": "^6.1.1",
"bson-ext": "^2.0.0"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused, isn't this what specifies the compatible versions of these dependencies? e.g., for us it's snappy 6 or 7?

test/unit/snappy.test.js Outdated Show resolved Hide resolved
test/unit/snappy.test.js Outdated Show resolved Hide resolved
test/unit/snappy.test.js Outdated Show resolved Hide resolved
src/deps.ts Outdated Show resolved Hide resolved
@dariakp dariakp added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Aug 20, 2021
test/unit/snappy.test.js Outdated Show resolved Hide resolved
@dariakp dariakp requested review from emadum and dariakp August 20, 2021 19:55
Copy link
Contributor

@emadum emadum left a comment

Choose a reason for hiding this comment

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

LGTM

@dariakp dariakp merged commit 0f7f300 into 4.1 Aug 23, 2021
@dariakp dariakp deleted the NODE-3528/snappy-7 branch August 23, 2021 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
3 participants