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

Feature/zenko 18/metadata proxy server #498

Merged
merged 1 commit into from
Jun 13, 2018

Conversation

ploki
Copy link
Contributor

@ploki ploki commented Jun 6, 2018

replaces #462

@bert-e
Copy link
Contributor

bert-e commented Jun 6, 2018

Hello ploki,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get
information on this process.

Status report is not available.

@bert-e
Copy link
Contributor

bert-e commented Jun 6, 2018

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • 2 peers

@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

@ghost
Copy link

ghost commented Jun 8, 2018

There were the following issues with this Pull Request

  • Commit: 8f68d62
    • ✖ message may not be empty
      , - ✖ type may not be empty

You may need to change the commit messages to comply with the repository contributing guidelines.


🤖 This comment was generated by commitlint[bot]. Please report issues here.

Happy coding!

@ploki ploki force-pushed the feature/ZENKO-18/metadata-proxy-server branch from 8f68d62 to 670f1c6 Compare June 8, 2018 22:15
@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

vrancurel
vrancurel previously approved these changes Jun 8, 2018
philipyoo
philipyoo previously approved these changes Jun 8, 2018
@ironman-machine ironman-machine dismissed stale reviews from vrancurel, philipyoo, and alexanderchan-scality June 11, 2018 22:25

Do it again human slave!:point_right: :runner: (Oh and the pull request has been updated, by the way.)

@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

@ploki ploki force-pushed the feature/ZENKO-18/metadata-proxy-server branch from a3cf6d4 to b7cf797 Compare June 11, 2018 23:13
@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

ssalaues
ssalaues previously approved these changes Jun 12, 2018
Copy link
Collaborator

@rahulreddy rahulreddy left a comment

Choose a reason for hiding this comment

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

I like your usage of RequestDispatcher in the tests.


_putObject(req, res, bucketName, objectName, objectValue, params, logger) {
return this._metadataWrapper.client.putObject(
bucketName, objectName, JSON.parse(objectValue),
Copy link
Collaborator

Choose a reason for hiding this comment

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

JSON.parse will call cause a server crash if the JSON is malformed. I recommend a try...catch for safe parsing.

* the purpose of this server. The `value' fields are stringified twice and
* have to be deserialized here before being sent to the client.
*/
_destringifyValues(data) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this method being used anywhere or is it a placeholder for future use?

*/
_destringifyValues(data) {
const newContents = data.Contents.map(entry => {
const value = JSON.parse(entry.value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I recommend safe json parsing as above.

*
* @param {http.IncomingMessage} req - request being processed
* @param {http.OutgoingMessage} res - response associated to the request
* @param {object} uriComponents -
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can list here the properties expected to be used in the object.

* @param {string} uri - uri part of the received request
* @param {werelogs.Logger} logger -
* @return {object} ret - contains up to 4 string properties,
* @return {string} ret.namespace
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a one-liner describing what namespace and context are?

const bucketIndex = pathname.indexOf('/', typeIndex + 1);
const objectIndex = pathname.indexOf('/', bucketIndex + 1);

if (typeIndex === -1 || typeIndex === pathname.length - 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion: If you abstract pathname.length - 1 into a var, it will be more readable.

};
} catch (ex) {
logger.error('Invalid URI: failed to parse',
{ uri, error: ex, errorStack: ex.stack });
Copy link
Collaborator

Choose a reason for hiding this comment

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

ex.message is worth logging too.

request.on('data', data => {
body.push(data);
bodyLen += data.length;
}).on('error', cb).on('end', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

http.IncomingMessage emits close if the client abruptly disconnects. We need to add a listener and destroy the stream/cleanup when the close event is emitted. This was the source of our TCP socket leak issue in January.

}),
next => dispatcher.delete(`/default/bucket/${Bucket}/test1`,
err => next(err)),
], err => done(err));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor style comment: In instances like this err => done(err) you can pass the callback directly done.

@ironman-machine ironman-machine dismissed ssalaues’s stale review June 13, 2018 00:34

Do it again human slave!:point_right: :runner: (Oh and the pull request has been updated, by the way.)

@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

@ploki ploki force-pushed the feature/ZENKO-18/metadata-proxy-server branch from 8799960 to e4e3d04 Compare June 13, 2018 00:36
@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

@ploki ploki force-pushed the feature/ZENKO-18/metadata-proxy-server branch from e4e3d04 to 2e02fe1 Compare June 13, 2018 00:41
@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

@ploki ploki force-pushed the feature/ZENKO-18/metadata-proxy-server branch from 2e02fe1 to de77400 Compare June 13, 2018 01:06
@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

rahulreddy
rahulreddy previously approved these changes Jun 13, 2018
@ploki ploki force-pushed the feature/ZENKO-18/metadata-proxy-server branch from de77400 to 32c2a6f Compare June 13, 2018 17:06
@ironman-machine ironman-machine dismissed rahulreddy’s stale review June 13, 2018 17:06

Do it again human slave!:point_right: :runner: (Oh and the pull request has been updated, by the way.)

@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

@bert-e
Copy link
Contributor

bert-e commented Jun 13, 2018

In the queue

The changeset has received all authorizations and has been added to the
relevant queue(s). The queue(s) will be merged in the target development
branch(es) as soon as builds have passed.

The changeset will be merged in:

  • ✔️ development/8.0

There is no action required on your side. You will be notified here once
the changeset has been merged. In the unlikely event that the changeset
fails permanently on the queue, a member of Release Engineering will
contact you to help resolve the matter.

IMPORTANT

Please do not attempt to modify this pull request.

  • Any commit you add on the source branch will trigger a new cycle after the
    current queue is merged.
  • Any commit you add on one of the integration branches will be lost.

If you need this pull request to be removed from the queue, please contact a
member of Release Engineering now.

@bert-e
Copy link
Contributor

bert-e commented Jun 13, 2018

I have successfully merged the changeset of this pull request
into targetted development branches:

  • ✔️ development/8.0

Please check the status of the associated issue ZENKO-18.

Goodbye ploki.

@bert-e bert-e merged commit 32c2a6f into development/8.0 Jun 13, 2018
@ploki ploki deleted the feature/ZENKO-18/metadata-proxy-server branch June 13, 2018 21:48
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.

8 participants