-
Notifications
You must be signed in to change notification settings - Fork 24
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 select() by space_no and index_name #142
Conversation
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.
Looks okay except minor comments.
4cb7778
to
8b8d09e
Compare
bd6232c
to
f3ba38f
Compare
f3ba38f
to
fee11d4
Compare
@LeonidVas Please, look at this briefly if time permits. I think the patch in the good state now, but it would be good if you'll glance. |
Hi! @bigbes , thank you for the PR. Generally LGTM. |
When a space exists, but a client side schema does not know about it at the moment (say, right after connection), and when a user calls select() with a space id (number) and name of an index (string), the problem appears: the client raises the following error: | TarantoolParsingException: Failed to parse schema (index) However it should successfully perform the request. The problem is that when there is no record for a space in client's schema, it is not possible to save a record for an index of this space. The idea of the fix is to verify whether we know about a space even when a numeric ID is already provided. If a client has no record about the space, it fetches a schema and verify whether the space appears. If so, there is no more problem described above. Otherwise the client raises an error that the space with given ID does not exist. While we're here, ensure that return values of tarantool_schema_*() are checked against -1, not Zend's FAILURE macro (which is only guaranteed to be less than zero) in the modified code. Also ensure that the FAILURE macro is returned from the get_spaceno_by_name() function, not -1. Closes tarantool#42 @Totktonada: polish code, polish test, write the description.
fee11d4
to
50d9e71
Compare
@LeonidVas I agree. Fixed and added the following paragraph into the commit message:
|
When a space exists, but a client side schema does not know about it at
the moment (say, right after connection), and when a user calls select()
with a space id (number) and name of an index (string), the problem
appears: the client raises the following error:
However it should successfully perform the request.
The problem is that when there is no record for a space in client's
schema, it is not possible to save a record for an index of this space.
The idea of the fix is to verify whether we know about a space even when
a numeric ID is already provided. If a client has no record about the
space, it fetches a schema and verify whether the space appears. If so,
there is no more problem described above. Otherwise the client raises an
error that the space with given ID does not exist.
While we're here, ensure that return values of tarantool_schema_*() are
checked against -1, not Zend's FAILURE macro (which is only guaranteed
to be less than zero) in the modified code. Also ensure that the FAILURE
macro is returned from the get_spaceno_by_name() function, not -1.
Closes #42