← Back to team overview

drizzle-discuss team mailing list archive

Re: about replacing loadfile with filesystem storage engine


On Jul 29, 2010, at 2:04 PM, Stewart Smith wrote:

> On Thu, 29 Jul 2010 23:39:42 +0800, ZQ <ziminq@xxxxxxxxx> wrote:
>> You once mentioned one thing I can do is to replace load file with this my
>> file system storage engine,
>> do you mean I should abstract some general code from my storage engine and
>> plug it into load file code path?
>> I would like to know what's the potential problem with the original load
>> file functionality?
> Hi!
> Basically, I don't think we need two blocks of code doing relatively
> similar things.
> I think we can replace the LOAD DATA INFILE with some code that does the
> following:
> - create temporary table using filesystem_engine
> - open target table
> - open temporary table
> - read row from temporary table
> - write row to target table
> - repeat until done
> - close tables.

I don't think many people are using LOAD DATA INFILE with direct file access on the servers. Thats just a really bad paradigm, especially since the code that does that in MySQL is really flaky (for instance, does not check for errors during read, so if your NFS mount where your source file hiccups, you just go "Oh, EOF, return" instead of "Hey user your data wasn't fully loaded!" LOAD DATA LOCAL INFILE is far more common, and has its own set of weirdness.

I'd much rather see the LOAD DATA commands dropped in favor of the way postgresql does this, with the COPY command. With COPY, you can basically just say "COPY INTO table" and it uses the socket as a data stream of text to fill the table.

It would be awesome if this command can leverage the code that the filesystem_engine uses, but I don't know if it makes sense to have the engine itself be at the core.

Follow ups