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

CREATE TABLE new_table LIKE existing_table WITH DATA #1788

Open
7 of 8 tasks
sanikolaev opened this issue Feb 2, 2024 · 26 comments
Open
7 of 8 tasks

CREATE TABLE new_table LIKE existing_table WITH DATA #1788

sanikolaev opened this issue Feb 2, 2024 · 26 comments
Assignees

Comments

@sanikolaev
Copy link
Collaborator

sanikolaev commented Feb 2, 2024

Manticore already supports CREATE TABLE new_table LIKE existing_table. Let's improve it, so it can copy a table with data by:

  • Calling FREEZE against the existing table
  • Copying the files
  • Calling IMPORT TABLE
  • Calling UNFREEZE

Test it well in terms of copying external files (wordforms, stopwords etc.) properly.

Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

  • Task estimated
  • Specification created, reviewed and approved
  • Implementation completed
  • Tests developed
  • Documentation updated
  • Documentation proofread
  • Changelog updated
  • OpenAPI YAML updated and issue created to rebuild clients
@djklim87
Copy link
Contributor

@sanikolaev JFY Import command performs copy itself. So we can skip 2nd step

@djklim87
Copy link
Contributor

Wait for review manticoresoftware/manticoresearch-buddy#257

@djklim87 djklim87 assigned donhardman and unassigned djklim87 Apr 24, 2024
@donhardman donhardman assigned djklim87 and unassigned donhardman Apr 26, 2024
djklim87 added a commit to manticoresoftware/manticoresearch-buddy that referenced this issue Apr 26, 2024
…#257)

* Stable create like with data #manticoresoftware/manticoresearch/1788 

---------

Co-authored-by: djklim87 <klim@manticoresearch.com>
@djklim87
Copy link
Contributor

@sanikolaev
Copy link
Collaborator Author

Reopening to updated the docs.

@sanikolaev sanikolaev reopened this Apr 29, 2024
@djklim87
Copy link
Contributor

djklim87 commented May 2, 2024

Done in PR #2123

@djklim87 djklim87 assigned sanikolaev and unassigned djklim87 May 2, 2024
@sanikolaev sanikolaev assigned djklim87 and unassigned sanikolaev May 2, 2024
@sanikolaev
Copy link
Collaborator Author

sanikolaev commented May 2, 2024

Pls update the docs. More in the PR

@djklim87
Copy link
Contributor

djklim87 commented May 5, 2024

Done

@djklim87 djklim87 closed this as completed May 5, 2024
@sanikolaev
Copy link
Collaborator Author

Reopening since:

  • it seems to be not working on dev2:
    mysql> show version;
    --------------
    show version
    --------------
    
    +-----------+--------------------------------+
    | Component | Version                        |
    +-----------+--------------------------------+
    | Daemon    | 6.2.13 694cbe53d@24050319 dev  |
    | Columnar  | columnar 2.2.5 0c18998@240424  |
    | Secondary | secondary 2.2.5 0c18998@240424 |
    | KNN       | knn 2.2.5 0c18998@240424       |
    | Buddy     | buddy v2.3.7                   |
    +-----------+--------------------------------+
    5 rows in set (0.00 sec)
    
    mysql> create table name_copy like name with data;
    --------------
    create table name_copy like name with data
    --------------
    
    ERROR 1064 (42000): Failed to parse options
    
  • we need to cover the new functionality with tests

@djklim87
Copy link
Contributor

djklim87 commented May 6, 2024

@djklim87
Copy link
Contributor

djklim87 commented May 6, 2024

Reopening since:

* it seems to be not working on dev2:
  ```
  mysql> show version;
  --------------
  show version
  --------------
  
  +-----------+--------------------------------+
  | Component | Version                        |
  +-----------+--------------------------------+
  | Daemon    | 6.2.13 694cbe53d@24050319 dev  |
  | Columnar  | columnar 2.2.5 0c18998@240424  |
  | Secondary | secondary 2.2.5 0c18998@240424 |
  | KNN       | knn 2.2.5 0c18998@240424       |
  | Buddy     | buddy v2.3.7                   |
  +-----------+--------------------------------+
  5 rows in set (0.00 sec)
  
  mysql> create table name_copy like name with data;
  --------------
  create table name_copy like name with data
  --------------
  
  ERROR 1064 (42000): Failed to parse options
  ```

* we need to cover the new functionality with tests

Fixed in 60c90e774faeb9d38b23ea8ab24919aad3bdd7c3

@djklim87 djklim87 removed their assignment May 6, 2024
@sanikolaev
Copy link
Collaborator Author

Fixed in 60c90e774faeb9d38b23ea8ab24919aad3bdd7c3

LGTM now.

@sanikolaev
Copy link
Collaborator Author

sanikolaev commented May 8, 2024

at the moment on the initial table without data everything works

Not working for me on dev2:

snikolaev@dev2:~$ mysql -P9306 -h0 -e "drop table if exists t; create table t; drop table if exists t2; create table t2 like t with data; show table t2 status"
ERROR 1064 (42000) at line 1: SHOW TABLE STATUS requires an existing table

Version info:

snikolaev@dev2:~$ mysql -P9306 -h0 -e "show version"
+-----------+--------------------------------+
| Component | Version                        |
+-----------+--------------------------------+
| Daemon    | 6.2.13 a9b48600c@24050806 dev  |
| Columnar  | columnar 2.2.5 0c18998@240424  |
| Secondary | secondary 2.2.5 0c18998@240424 |
| KNN       | knn 2.2.5 0c18998@240424       |
| Buddy     | buddy v2.3.7                   |
+-----------+--------------------------------+

@djklim87
Copy link
Contributor

djklim87 commented May 8, 2024

Blocked by #2154

@sanikolaev sanikolaev added the rel::upcoming Upcoming release label May 9, 2024
@sanikolaev
Copy link
Collaborator Author

Blocked by #2154

Unblocked.

@sanikolaev
Copy link
Collaborator Author

sanikolaev commented May 10, 2024

Copying an empty table is still not working for me on the latest dev version:

snikolaev@dev2:~$ mysql -P9306 -h0 -v
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1892
Server version: 6.2.13 db4442c8b@24051014 dev (columnar 2.2.5 0c18998@240424) (secondary 2.2.5 0c18998@240424) (knn 2.2.5 0c18998@240424) git branch master...origin/master

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Reading history-file /home/snikolaev/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> drop table if exists t; create table t(f text); drop table if exists t2; create table t2 like t with data; show table t2 settings;
--------------
drop table if exists t
--------------

Query OK, 0 rows affected (0.01 sec)

--------------
create table t(f text)
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
drop table if exists t2
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
create table t2 like t with data
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
show table t2 settings
--------------

ERROR 1064 (42000): SHOW TABLE SETTINGS requires an existing table

@djklim87
Copy link
Contributor

Yes, it's correct. I didn't release my fixes yet

@djklim87
Copy link
Contributor

Waiting for review manticoresoftware/manticoresearch-buddy#285

@djklim87 djklim87 assigned donhardman and unassigned djklim87 May 13, 2024
@donhardman
Copy link
Contributor

I left my comments, all is good, just need to fix approach how we get searchd data dir: manticoresoftware/manticoresearch-buddy#285 (review)

@donhardman donhardman assigned djklim87 and unassigned donhardman May 13, 2024
@djklim87
Copy link
Contributor

I answered to your suggestions. Review again, please

@djklim87 djklim87 assigned donhardman and djklim87 and unassigned djklim87 and donhardman May 13, 2024
@sanikolaev
Copy link
Collaborator Author

Reopening to:

  • confirm it works fine
  • add tests

@sanikolaev sanikolaev reopened this May 14, 2024
@sanikolaev sanikolaev assigned PavelShilin89 and unassigned djklim87 May 14, 2024
@djklim87 djklim87 assigned djklim87 and unassigned PavelShilin89 May 14, 2024
@djklim87
Copy link
Contributor

It still blocked by #2154

@sanikolaev
Copy link
Collaborator Author

It still blocked by #2154

Unblocked now.

@sanikolaev sanikolaev added rel::6.3.0 Released in 6.3.0 and removed rel::upcoming Upcoming release labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants