Skip to content

WIP: MDEV-18827: Create utility to parse frm files and print their DDL#2191

Draft
mazrex wants to merge 13 commits intoMariaDB:10.10from
mazrex:bb-10.10-MDEV-18827
Draft

WIP: MDEV-18827: Create utility to parse frm files and print their DDL#2191
mazrex wants to merge 13 commits intoMariaDB:10.10from
mazrex:bb-10.10-MDEV-18827

Conversation

@mazrex
Copy link
Copy Markdown

@mazrex mazrex commented Jul 16, 2022

  • The Jira issue number for this PR is: MDEV-18827

Description

The utility program parses a .frm file and generates the "CREATE TABLE" statement for the table.

How can this PR be tested?

mariafrm.test

Basing the PR against the correct MariaDB version

  • This is a new feature and the PR is based against the latest MariaDB development branch
  • This is a bug fix and the PR is based against the earliest branch in which the bug can be reproduced

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jul 16, 2022

CLA assistant check
All committers have signed the CLA.

@mazrex
Copy link
Copy Markdown
Author

mazrex commented Jul 16, 2022

It is work in progress @cvicentiu

@cvicentiu cvicentiu self-assigned this Jul 19, 2022
@cvicentiu
Copy link
Copy Markdown
Member

Hi @mazrex !

This is a good first commit. Here is my feedback on it:

  1. It is important that you are more consistent with when you allocate time on the project. I understand this is a part time project and you had other commitments, but we need to have some consistency so that I know we are on track. Moving forward, do not be worried about publishing work-in-progress commits or code that is not ready.
    If the commit begins with WIP, it means that it's not finished. If I am to offer any comments, I will take that into consideration. :)
  2. There are some stylistic changes I would do, such as move all files to the client folder as that's where such commands are located. But this is a "trivial" task that can end up eating a lot of your time so let's leave this for later. (and I haven't quite decided on this one yet). All in all you've followed the MariaDB coding style quite well so any "errors" I will point out once we have the functionality in.
  3. You are obviously missing some error checks. For example the code crashes when I run mariadb-frm --help. We will need to fix this, but for starters let's do the following: we need to set up some tests for this binary. I would like us to also have some unit tests for the functions within the binary themselves, but before we set up those I propose the following addition to mysql-test-run.pl:

In your next commit implement the bare minimum syntax for create table and one or two column types, say INT and VARCHAR. Basically, your code should only work for tables of the form:
CREATE TABLE t1 (a int, b varchar(100)) engine=MyISAM.

Then, create an mysql-test-run (useful article) test case. Within the test case, create a table, run show create table on it and then run mariafrm on the corresponding FRM. You should get the same exact output.

Here's a test file that shows how you can run external commands as well as reference the datadirectory from within MTR.
You will need to extend MTR to provide a path for mariafrm. Have a look at this line and this line

Feel free to reach out if you get stuck. :)

@cvicentiu cvicentiu marked this pull request as draft July 19, 2022 06:48
@mazrex
Copy link
Copy Markdown
Author

mazrex commented Jul 19, 2022

Thanks for the feedback :) @cvicentiu

@cvicentiu
Copy link
Copy Markdown
Member

Hi @mazrex!

How is it going with implementing the review feedback? I'd like to see it done before the GSoC midterm evaluation deadline.

@mazrex
Copy link
Copy Markdown
Author

mazrex commented Jul 25, 2022

Hi @mazrex!

How is it going with implementing the review feedback? I'd like to see it done before the GSoC midterm evaluation deadline.

I have been working on it. I will make a commit soon.

@mazrex
Copy link
Copy Markdown
Author

mazrex commented Jul 26, 2022

I have implemented the review feedback work. @cvicentiu

@cvicentiu
Copy link
Copy Markdown
Member

cvicentiu commented Aug 23, 2022

Hi @mazrex !

I see some more work has gone into this.

What would be good is if you can expand the test suite with more cases, such as partitioned tables, what happens when the program gets called on a non-existing frm or what happens when using custom data types, such as inet datatype.

https://mariadb.com/kb/en/inet6/

Improving testing will help us understand what we're missing functionality wise :)

Also, note that your program doesn't compile on linux distributions. Have a look at the failing checks (click on details)
image

and see if you can fix those too.

@mazrex
Copy link
Copy Markdown
Author

mazrex commented Aug 23, 2022

Hi @cvicentiu!

I have fixed the problem with Linux distributions. I will work on expanding the test suite :)

@mazrex mazrex force-pushed the bb-10.10-MDEV-18827 branch from fa7a5c3 to 115a90b Compare September 4, 2022 10:02
@mazrex mazrex force-pushed the bb-10.10-MDEV-18827 branch from 115a90b to 934f09c Compare September 4, 2022 15:38
@grooverdan
Copy link
Copy Markdown
Member

To fix the other deb packaging builds - can you add usr/bin/mariadb-frm to debian/mariadb-client.install please.

@mazrex
Copy link
Copy Markdown
Author

mazrex commented Sep 5, 2022

To fix the other deb packaging builds - can you add usr/bin/mariadb-frm to debian/mariadb-client.install please.

Sure. I will work on it. :)

@mazrex mazrex force-pushed the bb-10.10-MDEV-18827 branch from 0f59d8a to efec22d Compare September 27, 2022 17:22
@Hinal-Srivastava
Copy link
Copy Markdown

Hello,
I am interested in contributing to this project. Can you please tell me some resources to get started and also guide me towards some first timer tasks?
Thank you! Looking forward to hearing from you

@mazrex
Copy link
Copy Markdown
Author

mazrex commented Jan 28, 2023

Hello, I am interested in contributing to this project. Can you please tell me some resources to get started and also guide me towards some first timer tasks? Thank you! Looking forward to hearing from you

Hi Hinal,
Currently, I am working on MDEV-18827. Due to academic work, I had to pause working on it. But still, this is nearly complete.
You can hit me up on Zulip, btw. I can tell you about my GSoC experience.

@cvicentiu cvicentiu added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Nov 26, 2024
@cvicentiu cvicentiu added GSoC and removed GSOC2022 labels Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. GSoC

Development

Successfully merging this pull request may close these issues.

5 participants