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

Take format changes into account when making queries #54

Closed
knazarov opened this issue Oct 7, 2020 · 3 comments
Closed

Take format changes into account when making queries #54

knazarov opened this issue Oct 7, 2020 · 3 comments

Comments

@knazarov
Copy link
Contributor

knazarov commented Oct 7, 2020

It is possible that space format changes during the query (for example, during insert). Then, the user will get format mismatch error.

There are 2 primary cases we need to consider.

Format changes when inserting objects

In this case, crud.insert_object() should probably re-pack the object and retry, if the schema is still compatible with the object.

Format changes when inserting tuples

This can happen, for example, when the user adds a column on the right. Then there are 2 more cases:

  • The column is nullable. In this case, we may want to re-pack and treat this column as null in our object. Though, I'm not that certain about it.
  • The column is not nullable, or the schema is incompatible in other significant ways. In this case, we need to return an error.

Returning errors

When we return errors about format mismatch, we need to include a specific error type, that will allow connectors to make a decision whether they should retry or not. In many cases, connectors will be written in a way when they accept objects of their host programming language. If this is true, they may want to re-pack the tuple on their side and retry.

@akudiyar
Copy link
Contributor

akudiyar commented Oct 7, 2020

How actual is this problem in stable running environments? Changing schema leads to necessary changes in code, which rarely changes on-the-fly in the stable system.

Consider that in real environments using migrations is recommended for changing the spaces schema, migrations are unlikely to be performed while there are active external connections and, furthermore, active requests to an instance.

@Totktonada
Copy link
Member

I would take a glance on this after we'll arrange information about currently implemented approach (#253): otherwise it is not easy to keep a clear picture in the mind how the code work.

@DifferentialOrange
Copy link
Member

Schema reload is already supported in case of format error mismatch. DDL schema is validated in case of update. See more about schema reload work here: https://github.com/tarantool/crud/blob/ddfc25169ca14ebf8e711bc58db93d4d7a0b89a3/doc/dev/schema.md

It seems that the things discussed in this ticket are not relevant anymore, but feel free to reopen if it's not.

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

No branches or pull requests

4 participants