Hi Rajat,

Foreign keys in MySQL or MariaDB are a bit of a second-class citizen, only implemented inside InnoDB. Even the foreign key metadata is only stored inside InnoDB. Also, foreign keys only work between InnoDB tables.

I think that once those issues have been fixed (once we have foreign keys implemented avobe the storage engine layer, working on any transactional tables), it should be more feasible to implement a multi-table truncate operation. We certainly want the operation to be atomic, so it would have to work something like this:

1. Lock all the tables, and check that all criteria are met.
2. Atomically write transaction log records to TRUNCATE every table.
3. Truncate the tables.
4. Remove the transaction log records.
5. Unlock the tables and return to the client.

Even if we ignore other storage engines than InnoDB, step 2 is a problem. The logging of TRUNCATE was rewritten in WL#6501 in MySQL 5.7 in a way that makes it challenging for tools like Mariabackup or xtrabackup to work. That logging would have to be rewritten. I think that we need a transactional "ddl_fixup" table that could also be used for implementing transactional, fully crash-safe DDL operations with .frm files.

As you can see, the task is rather complex. There are many things that would have to be refactored first. I do not know how much of this we can do within the 10.4 release. Soon we will release MariaDB 10.3 as beta, to be released as GA some time next year. This definitely cannot be done in 10.3.

Best regards,

Marko

On Sat, Nov 11, 2017 at 4:38 PM, Rajat Rawat <rajatrawat1997@gmail.com> wrote:

Respected Sir/Mam

 

Hello, Myself Rajat from India. I wanted to contribute/work with Mariadb.

 

As we know that Mariadb dosen’t have cascade truncate function available yet, so I want to contribute to Mariadb towards this topic.

My topic is “Cascade Truncate”.

 

Since we can’t truncate the parent table unless the referential integrity constraints are present in the child table also. Hence, we can do a way that we can provide a command that truncate the child table as well.


This enhancement is already provided in the Oracle Database in their 12c Version, by using the truncate cascade command.

 

It is better to truncate the child table at the time when we want to truncate our parent table.


As we know that we have already on Delete Cascade command available, but that command works only row by row and not for all rows at one time.

  So, at one time if we want to truncate our whole table then Cascade Truncate is a better Option.

 

That’s all about my proposal. If you like my proposal, then let me know about about it.

 

I am very eager to contribute for you. I also forked and downloaded on my local machine, the file of Maraidb which is available on Github,  and currently I am reading/understanding all the patches, but I am confused with only 1 thing that from where should I start.

 

So, if you like proposal then let me know about it and please guide me that from where should I start contributing for it.

 

My skills: C, C++, Java, SQL, PL/SQL

Achievement: Oracle Certified Associate Java Programmer SE 7.

 

By  contributing for you I will definitely learn many new things and implement my ideas, while working with you.

 

Hope I could be of any help for you.

 

Your sincerely

Rajat


_______________________________________________
Mailing list: https://launchpad.net/~maria-discuss
Post to     : maria-discuss@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-discuss
More help   : https://help.launchpad.net/ListHelp




--
Marko Mäkelä, Lead Developer InnoDB
MariaDB Corporation