← Back to team overview

drizzle-discuss team mailing list archive

Re: File Deletion issues for Storage Engines

 

Hi Paul,

> But it makes me wonder about something else: where is the list of tables
> coming from?

I'm not entirely confident but in the current storage API, there is,
StrorageEngine::doGetTableNames() where you must provide/set the name
of tables to the provided reference to a std::set<string> object.

You do this by iterating over the CacheDirectory object that you're
given as a parameter. I suspect that this, CachedDirectory has listing
of directories and files inside them. This is how it's used:

for (CachedDirectory::Entries::iterator entry_iter = entries.begin();
     entry_iter != entries.end(); ++entry_iter)
{
  CachedDirectory::Entry *entry = *entry_iter;
  string *filename = &entry->filename;

  /* check if 'filename' corresponds to a table. If so, set it
     to the provided std::set WITHOUT the extension. */
}

What I can't answer yet is how the CachedDirectory object is generated
inside the kernel. I'll dig a little further and let you know when I
discover more information.

Cheers,
Toru

On Fri, Dec 11, 2009 at 10:27 PM, Paul McCullagh
<paul.mccullagh@xxxxxxxxxxxxx> wrote:
> Hi Toru,
>
> I agree that (1) would make the job very simple for engine developers. And
> there is probably no reason why this should not work.
>
> But it makes me wonder about something else: where is the list of tables
> coming from?
>
> In MySQL it is simple:
>
> The list of databases is the list of directories in the data directory, and
> the list of tables is the list of .FRM files in the directories.
>
> In Drizzle, how is the list of table built?
>
> On Dec 11, 2009, at 3:45 AM, Toru Maesaka wrote:
>
>> Hi Paul, Jobin,
>>
>> Awesome! We should discuss how StorageEngine::doDropDatabase() should
>> be done. I think there are several approaches so lemmie jot down my
>> thoughts...
>>
>> (1) doDropDatabase() will provide a reference to a vector that
>> contains table names (full path) as a parameter. The storage engine
>> would then use each string to remove the file(s).
>>
>> (2) Engine calls StorageEngine::doGetTableNames() inside
>> doDropDatabase() and deletes files based on that information. This
>> means we need easy access to CachedDirectory.
>>
>> (3) Engine maintains/housekeeps paths to files that it had generated.
>> doDropDatabase() will provide a path to the directory.
>>
>> Personally, I'm towards (1) since this would make the implementation
>> easy and short :)
>>
>> Toru
>>
>>
>> On Fri, Dec 11, 2009 at 11:27 AM, Jobin Augustine <jobinau@xxxxxxxxx>
>> wrote:
>>>
>>> ++
>>> I think the option :
>>>
>>> Let storage engine manage the files of it.
>>> (including the deletion)
>>>
>>> is the right approach.
>>>
>>>
>>> Thank you,
>>> Jobin.
>>>
>>>
>>
>>
>>
>> --
>> Toru Maesaka <dev@xxxxxxxxx>
>
>
>
> --
> Paul McCullagh
> PrimeBase Technologies
> www.primebase.org
> www.blobstreaming.org
> pbxt.blogspot.com
>
>
>
>



-- 
Toru Maesaka <dev@xxxxxxxxx>



Follow ups

References