Read-only AVLs are now hard-linked instead of copied when cloning an AVL

group to make it writable. Also fixed several bugs when handling AVL
groups.
This commit is contained in:
Celine Mercier
2016-06-03 19:02:46 +02:00
parent 799b942017
commit fc3641d7ff
6 changed files with 254 additions and 39 deletions

View File

@ -32,17 +32,24 @@ int obi_column_set_obiseq_with_elt_idx(OBIDMS_column_p column, index_t line_nb,
if (obi_column_prepare_to_set_value(column, line_nb) < 0)
return -1;
// TODO NA
// Add the value in the indexer
idx = obi_index_dna_seq(column->indexer, value);
if (idx == -1) // An error occurred
{
if (obi_errno == OBI_READ_ONLY_INDEXER_ERROR)
{
// TODO PUT IN A COLUMN FUNCTION
// If the error is that the indexer is read-only, clone it
new_indexer_name = obi_build_indexer_name((column->header)->name, (column->header)->version);
if (new_indexer_name == NULL)
return -1;
column->indexer = obi_clone_indexer(column->indexer, new_indexer_name); // TODO Need to lock this somehow?
strcpy((column->header)->indexer_name, new_indexer_name);
free(new_indexer_name);
obi_set_errno(0);
// Add the value in the new indexer
idx = obi_index_dna_seq(column->indexer, value);
if (idx == -1)