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

Readonly table error message should not be Internal Error #3653

Closed
tisonkun opened this issue Apr 7, 2024 · 5 comments · Fixed by #4233
Closed

Readonly table error message should not be Internal Error #3653

tisonkun opened this issue Apr 7, 2024 · 5 comments · Fixed by #4233
Labels
C-user-experience Category User Experience

Comments

@tisonkun
Copy link
Contributor

tisonkun commented Apr 7, 2024

What type of enhancement is this?

User experience

What does the enhancement do?

mysql> SELECT * FROM build_info;
+---------------------+------------------------------------------+------------------+-----------+-------------+
| git_branch          | git_commit                               | git_commit_short | git_dirty | pkg_version |
+---------------------+------------------------------------------+------------------+-----------+-------------+
| checkpoint_checksum | 7e13a8edc970e5c3d383709dcbefda5f88c7fa77 | 7e13a8e          | false     | 0.7.1       |
+---------------------+------------------------------------------+------------------+-----------+-------------+
1 row in set (0.01 sec)

mysql> INSERT INTO build_info VALUES();
ERROR 1815 (HY000): Invalid SQL, error: column count mismatch, columns: 5, values: 0
mysql> INSERT INTO build_info VALUES('', '', '', '', '');
ERROR 1815 (HY000): Internal error: 1003
2024-04-07T14:27:24.166624Z ERROR on_query{protocol="mysql"}:mysql::do_query:do_query: frontend::instance: Failed to execute query: INSERT INTO build_info VALUES('', '', '', '', '') err=0: Table operation error, at src/frontend/src/instance.rs:272:14
1: Missing time index column, at src/operator/src/req_convert/insert.rs:39:10
2: Missing time index column in table: build_info, at src/operator/src/req_convert/insert.rs:36:10

We'd better to check readonly tables and return more friendly message.

Implementation challenges

No response

@killme2008 killme2008 added the C-user-experience Category User Experience label Apr 8, 2024
@CookiePieWw
Copy link
Collaborator

CookiePieWw commented Apr 29, 2024

Hi, I'd like to have a try to solve this. It seems the failure happens because the table does not have a time-index column. I wonder if it's appropriate to treat all tables without a time-index column as read-only, or there's some other method to identify a read-only table?

@tisonkun
Copy link
Contributor Author

@waynexia @killme2008 what do you think about the comment above?

IIRC read-only table is a different concept and we shouldn't depend on the coincidence it can be related to the existence of time-index column.

Also cc @MichaelScofield this can be related to the access control design. That is, no users should have write permission on these system tables.

@killme2008
Copy link
Contributor

In this case, i think we can just treat all the tables in information_schema to be read-only. @killme2008 @CookiePieWw

@CookiePieWw
Copy link
Collaborator

@killme2008 Thanks! I'll try to add some error messages for it.

I've noticed that it's allowed to create a table inside information_schema currently, maybe we need to restrict that as well? Otherwise it would be strange that we could create a table but can't insert into it.

@killme2008
Copy link
Contributor

@killme2008 Thanks! I'll try to add some error messages for it.

I've noticed that it's allowed to create a table inside information_schema currently, maybe we need to restrict that as well? Otherwise it would be strange that we could create a table but can't insert into it.

Agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-user-experience Category User Experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants