View rollback: version files and column directories aren't deleted

anymore to prevent indexer bug, and fixed a freeing bug
This commit is contained in:
Celine Mercier
2017-11-15 17:27:26 +01:00
parent 9a50803c00
commit 3ba7ce1c91
2 changed files with 33 additions and 29 deletions

View File

@ -957,6 +957,11 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
return NULL;
}
if (strcmp(column_name, "merged") == 0)
{
fprintf(stderr, "\nversion nb = %d\n", version_number);
}
// Build the indexer name if needed
if ((data_type == OBI_STR) || (data_type == OBI_SEQ) || (data_type == OBI_QUAL) || tuples)
{
@ -1997,10 +2002,10 @@ int obi_clean_unfinished_columns(OBIDMS_p dms)
char* column_dir_path;
char* col_name;
char* col_version_str;
char* version_file;
// char* version_file;
obiversion_t col_version;
OBIDMS_column_header_p col_header;
int n;
// int n;
char* col_to_delete[1000];
char* dir_to_delete[1000];
int ddir;
@ -2124,27 +2129,28 @@ int obi_clean_unfinished_columns(OBIDMS_p dms)
}
// Add column dir in list to delete if it's empty
n = count_dir(column_dir_path);
if (n == 1) // Only file left is the version file
{
// Delete the version file
version_file = obi_version_file_full_path(dms, col_name);
if (version_file == NULL)
{
obidebug(1, "\nError getting a version file path when deleting unfinished columns");
ret_value = -1;
continue;
}
if (remove(version_file) < 0)
{
obi_set_errno(OBICOL_UNKNOWN_ERROR);
obidebug(1, "\nError deleting a version file when deleting unfinished columns: file %s", version_file);
ret_value = -1;
}
free(version_file);
dir_to_delete[ddir] = column_dir_path;
ddir++;
}
// TODO commented because causes bug when cloning AVL using column version for name. to discuss
// n = count_dir(column_dir_path);
// if (n == 1) // Only file left is the version file
// {
// // Delete the version file
// version_file = obi_version_file_full_path(dms, col_name);
// if (version_file == NULL)
// {
// obidebug(1, "\nError getting a version file path when deleting unfinished columns");
// ret_value = -1;
// continue;
// }
// if (remove(version_file) < 0)
// {
// obi_set_errno(OBICOL_UNKNOWN_ERROR);
// obidebug(1, "\nError deleting a version file when deleting unfinished columns: file %s", version_file);
// ret_value = -1;
// }
// free(version_file);
// dir_to_delete[ddir] = column_dir_path;
// ddir++;
// }
free(col_name);
}