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:
@ -957,6 +957,11 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(column_name, "merged") == 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\nversion nb = %d\n", version_number);
|
||||||
|
}
|
||||||
|
|
||||||
// Build the indexer name if needed
|
// Build the indexer name if needed
|
||||||
if ((data_type == OBI_STR) || (data_type == OBI_SEQ) || (data_type == OBI_QUAL) || tuples)
|
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* column_dir_path;
|
||||||
char* col_name;
|
char* col_name;
|
||||||
char* col_version_str;
|
char* col_version_str;
|
||||||
char* version_file;
|
// char* version_file;
|
||||||
obiversion_t col_version;
|
obiversion_t col_version;
|
||||||
OBIDMS_column_header_p col_header;
|
OBIDMS_column_header_p col_header;
|
||||||
int n;
|
// int n;
|
||||||
char* col_to_delete[1000];
|
char* col_to_delete[1000];
|
||||||
char* dir_to_delete[1000];
|
char* dir_to_delete[1000];
|
||||||
int ddir;
|
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
|
// Add column dir in list to delete if it's empty
|
||||||
n = count_dir(column_dir_path);
|
// TODO commented because causes bug when cloning AVL using column version for name. to discuss
|
||||||
if (n == 1) // Only file left is the version file
|
// 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);
|
// // Delete the version file
|
||||||
if (version_file == NULL)
|
// 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;
|
// obidebug(1, "\nError getting a version file path when deleting unfinished columns");
|
||||||
continue;
|
// ret_value = -1;
|
||||||
}
|
// continue;
|
||||||
if (remove(version_file) < 0)
|
// }
|
||||||
{
|
// 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);
|
// obi_set_errno(OBICOL_UNKNOWN_ERROR);
|
||||||
ret_value = -1;
|
// 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;
|
// free(version_file);
|
||||||
ddir++;
|
// dir_to_delete[ddir] = column_dir_path;
|
||||||
}
|
// ddir++;
|
||||||
|
// }
|
||||||
|
|
||||||
free(col_name);
|
free(col_name);
|
||||||
}
|
}
|
||||||
|
@ -2671,7 +2671,7 @@ int obi_rollback_view(Obiview_p view)
|
|||||||
ret_value = -1;
|
ret_value = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete column dir if it's empty
|
// Delete column dir if it's empty TODO doesn't happen because version file
|
||||||
n = count_dir(column_dir_path);
|
n = count_dir(column_dir_path);
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
{
|
{
|
||||||
@ -2687,7 +2687,6 @@ int obi_rollback_view(Obiview_p view)
|
|||||||
free(column_dir_path);
|
free(column_dir_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete line selection if there is one
|
// Delete line selection if there is one
|
||||||
if (view->line_selection != NULL)
|
if (view->line_selection != NULL)
|
||||||
{
|
{
|
||||||
@ -2726,7 +2725,7 @@ int obi_rollback_view(Obiview_p view)
|
|||||||
ret_value = -1;
|
ret_value = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete column dir if it's empty
|
// Delete column dir if it's empty TODO doesn't happen because version file
|
||||||
n = count_dir(column_dir_path);
|
n = count_dir(column_dir_path);
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
{
|
{
|
||||||
@ -2767,11 +2766,11 @@ int obi_rollback_view(Obiview_p view)
|
|||||||
strcat(view_relative_path, view_file_name);
|
strcat(view_relative_path, view_file_name);
|
||||||
view_full_path = obi_dms_get_full_path(view->dms, view_relative_path);
|
view_full_path = obi_dms_get_full_path(view->dms, view_relative_path);
|
||||||
remove(view_full_path);
|
remove(view_full_path);
|
||||||
|
free(view_relative_path);
|
||||||
|
free(view_full_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(view_file_name);
|
free(view_file_name);
|
||||||
free(view_relative_path);
|
|
||||||
free(view_full_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free the linked list of column pointers
|
// Free the linked list of column pointers
|
||||||
@ -2779,7 +2778,6 @@ int obi_rollback_view(Obiview_p view)
|
|||||||
|
|
||||||
// Free the column dictionary
|
// Free the column dictionary
|
||||||
ht_free(view->column_dict);
|
ht_free(view->column_dict);
|
||||||
|
|
||||||
free(view);
|
free(view);
|
||||||
|
|
||||||
return ret_value;
|
return ret_value;
|
||||||
|
Reference in New Issue
Block a user