Commit 645f5457 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

addresses #861

now DB's are removed with db->remove and unlink

git-svn-id: file:///svn/mysql/tokudb-engine/src@4252 c7de825b-a66e-492c-adef-691d508d4ae1
parent d8212ed6
...@@ -2856,14 +2856,43 @@ static int rmall(const char *dname) { ...@@ -2856,14 +2856,43 @@ static int rmall(const char *dname) {
sprintf(fname, "%s/%s", dname, dirent->d_name); sprintf(fname, "%s/%s", dname, dirent->d_name);
if (dirent->d_type == DT_DIR) { if (dirent->d_type == DT_DIR) {
error = rmall(fname); error = rmall(fname);
} else { }
if (tokudb_debug & TOKUDB_DEBUG_OPEN) else {
TOKUDB_TRACE("unlink:%s\n", fname); if (tokudb_debug & TOKUDB_DEBUG_OPEN) {
error = unlink(fname); TOKUDB_TRACE("removing:%s\n", fname);
} }
if (error != 0) { //
error = errno; // if clause checks if the file is a .tokudb file
break; //
if (strlen(fname) >= strlen (ha_tokudb_ext) &&
strcmp(fname + (strlen(fname) - strlen(ha_tokudb_ext)), ha_tokudb_ext) == 0)
{
//
// if this fails under low memory conditions, gracefully exit and return error
// user will be notified that something went wrong, and he will
// have to deal with it
//
DB* db = NULL;
error = db_create(&db, db_env, 0);
if (error) {
break;
}
//
// it is ok to do db->remove on any .tokudb file, because any such
// file was created with db->open
//
db->remove(db, fname, NULL, 0);
}
else {
//
// in case we have some file that is not .tokudb, we just delete it
//
error = unlink(fname);
if (error != 0) {
error = errno;
break;
}
}
} }
} }
closedir(d); closedir(d);
...@@ -2872,8 +2901,10 @@ static int rmall(const char *dname) { ...@@ -2872,8 +2901,10 @@ static int rmall(const char *dname) {
if (error != 0) if (error != 0)
error = errno; error = errno;
} }
} else }
else {
error = errno; error = errno;
}
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment