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

add rpc #24

Merged
merged 4 commits into from
Nov 14, 2023
Merged

add rpc #24

merged 4 commits into from
Nov 14, 2023

Conversation

zklgame
Copy link
Contributor

@zklgame zklgame commented Nov 12, 2023

No description provided.

application/json:
schema:
$ref: '#/components/schemas/ApiErrorResponse'
'404':
Copy link
Contributor

@longquanzheng longquanzheng Nov 13, 2023

Choose a reason for hiding this comment

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

We also want to return different user/application side status code for:

  • Global Attribute operation failure like unique key conflict or column doesn't exists etc. I have used 424 for this in start API.
  • RPC execution error from worker : Maybe 412 (expectation failure) for this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expectation failutre seems to be related to the Expect field in the header.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/417

But I didn't find another better code, so will use this one for now.

content:
application/json:
schema:
$ref: '#/components/schemas/ProcessRpcRequest'
Copy link
Contributor

Choose a reason for hiding this comment

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

This name is hard to distinguish with the other two: ProcessExecutionRpcRequest and ProcessExecutionRpcResponse.

How about ProcessRpcWorkerRequest and ProcessRpcWorkerResponse?

$ref: '#/components/schemas/LoadGlobalAttributeResponse'
ProcessRpcResponse:
type: object
description: the output of the rpc API
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the response of the worker RPC API

Copy link
Contributor

@longquanzheng longquanzheng left a comment

Choose a reason for hiding this comment

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

Maybe 412?

Copy link
Contributor

@longquanzheng longquanzheng left a comment

Choose a reason for hiding this comment

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

I feel like 412 is slightly better 🤔

@longquanzheng
Copy link
Contributor

longquanzheng commented Nov 14, 2023

Or maybe it's better use 424 for both, and differentiate them in API Error model. Because I am worried that 412/417 will be confusing

@zklgame
Copy link
Contributor Author

zklgame commented Nov 14, 2023

Or maybe it's better use 424 for both, and differentiate them in API Error model. Because I am worried that 412/417 will be confusing

Agree. I also feel 424 is better than 412/417.

@zklgame zklgame merged commit 7afb641 into main Nov 14, 2023
1 check passed
@zklgame zklgame deleted the add_rpc branch November 14, 2023 08:11
schema:
$ref: '#/components/schemas/ApiErrorResponse'
'424':
description: global attributes write failure / worker RPC execution failure
Copy link
Contributor

Choose a reason for hiding this comment

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

With this direction(I like it), I think we need to add a enum to tell which error type it is, like in iWF: https://github.com/indeedeng/iwf-idl/blob/af1891eb032c534b0b75894c611ead7e2954777d/iwf.yaml#L612

Otherwise, SDK won't be able to differentiate the two types of error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe SDK can just throw the error messages with the same status code?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not about message. User may need to get status code for different handling.
E.g. for global attr DB operation error, there should be a Postgres error code to use, in addition to the error message.

for error from worker execution, it may just be the http status code.

When you are doing that, I think it's better to rename
originalWorkerErrorStatus to originalWorkerErrorCode, and change from integer to string, so that it can be more generic.

https://github.com/xdblab/xdb-apis/blob/eb0596e22fb87e960cee8b80b8378b0dbaa2b2ea/api-schema/xdb.yaml#L544

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 am confused about the content you are talking, because I am thinking global attributes updating error is not a worker side error, it's server side.

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.

None yet

2 participants