Changed file name limits to adapt to system limits + minor changes
This commit is contained in:
@ -20,10 +20,8 @@ QUALITY_COLUMN = "QUALITY"
|
|||||||
SPECIAL_COLUMNS = [NUC_SEQUENCE_COLUMN, ID_COLUMN, DEFINITION_COLUMN, QUALITY_COLUMN]
|
SPECIAL_COLUMNS = [NUC_SEQUENCE_COLUMN, ID_COLUMN, DEFINITION_COLUMN, QUALITY_COLUMN]
|
||||||
|
|
||||||
|
|
||||||
NAME_MAX_LEN = 50
|
NAME_MAX_LEN = 200
|
||||||
COL_COMMENTS_MAX_LEN = 2048
|
COL_COMMENTS_MAX_LEN = 2048
|
||||||
MAX_NB_ELEMENTS_PER_LINE = 20
|
|
||||||
ELEMENT_NAME_MAX_LEN = int(2048 / MAX_NB_ELEMENTS_PER_LINE)
|
|
||||||
MAX_INT = 2147483647 # used to generate random float values
|
MAX_INT = 2147483647 # used to generate random float values
|
||||||
|
|
||||||
|
|
||||||
@ -78,6 +76,14 @@ def random_unique_name(infos):
|
|||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
|
def random_unique_element_name(config, infos):
|
||||||
|
name = ""
|
||||||
|
while name == "" or name in infos['unique_names'] :
|
||||||
|
name = random_str_with_max_len(config['test']['elt_name_max_len'])
|
||||||
|
infos['unique_names'].append(name)
|
||||||
|
return name
|
||||||
|
|
||||||
|
|
||||||
def print_test(config, sentence):
|
def print_test(config, sentence):
|
||||||
if config['test']['verbose'] :
|
if config['test']['verbose'] :
|
||||||
print(sentence)
|
print(sentence)
|
||||||
@ -180,10 +186,10 @@ def fill_column(config, infos, col) :
|
|||||||
|
|
||||||
def create_random_column(config, infos) :
|
def create_random_column(config, infos) :
|
||||||
alias = random.choice(['', random_unique_name(infos)])
|
alias = random.choice(['', random_unique_name(infos)])
|
||||||
nb_elements_per_line=random.randint(1, MAX_NB_ELEMENTS_PER_LINE)
|
nb_elements_per_line=random.randint(1, config['test']['maxelts'])
|
||||||
elements_names = []
|
elements_names = []
|
||||||
for i in range(nb_elements_per_line) :
|
for i in range(nb_elements_per_line) :
|
||||||
elements_names.append(random_unique_name(infos))
|
elements_names.append(random_unique_element_name(config, infos))
|
||||||
name = random_unique_name(infos)
|
name = random_unique_name(infos)
|
||||||
infos['view'].add_column(name,
|
infos['view'].add_column(name,
|
||||||
alias=alias,
|
alias=alias,
|
||||||
@ -317,6 +323,14 @@ def addOptions(parser):
|
|||||||
help="Maximum number of lines in a column."
|
help="Maximum number of lines in a column."
|
||||||
"Default: 10000")
|
"Default: 10000")
|
||||||
|
|
||||||
|
group.add_argument('--max_elts_per_line','-e',
|
||||||
|
action="store", dest="test:maxelts",
|
||||||
|
metavar='<MAX_ELTS_PER_LINE>',
|
||||||
|
default=20,
|
||||||
|
type=int,
|
||||||
|
help="Maximum number of elements per line in a column."
|
||||||
|
"Default: 20")
|
||||||
|
|
||||||
group.add_argument('--verbose','-v',
|
group.add_argument('--verbose','-v',
|
||||||
action="store_true", dest="test:verbose",
|
action="store_true", dest="test:verbose",
|
||||||
default=False,
|
default=False,
|
||||||
@ -333,8 +347,10 @@ def run(config):
|
|||||||
'tests': [test_set_and_get, test_add_col, test_delete_col, test_col_alias, test_new_view]
|
'tests': [test_set_and_get, test_add_col, test_delete_col, test_col_alias, test_new_view]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config['test']['elt_name_max_len'] = int((COL_COMMENTS_MAX_LEN - config['test']['maxelts']) / config['test']['maxelts'])
|
||||||
|
|
||||||
print("Initializing the DMS and the first view...")
|
print("Initializing the DMS and the first view...")
|
||||||
|
|
||||||
ini_dms_and_first_view(config, infos)
|
ini_dms_and_first_view(config, infos)
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "encode.h"
|
#include "encode.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_NB_OF_AVLS_IN_GROUP (100) /**< The maximum number of AVL trees in a group. // TODO discuss
|
#define MAX_NB_OF_AVLS_IN_GROUP (1000) /**< The maximum number of AVL trees in a group. // TODO discuss
|
||||||
*/
|
*/
|
||||||
#define MAX_NODE_COUNT_PER_AVL (10000000) /**< The maximum number of nodes in an AVL tree.
|
#define MAX_NODE_COUNT_PER_AVL (10000000) /**< The maximum number of nodes in an AVL tree.
|
||||||
* Only used to decide when to create a new AVL in a group, and to initialize the bloom filter // TODO discuss.
|
* Only used to decide when to create a new AVL in a group, and to initialize the bloom filter // TODO discuss.
|
||||||
@ -42,7 +42,7 @@
|
|||||||
*/
|
*/
|
||||||
#define AVL_MAX_DEPTH (1024) /**< The maximum depth of an AVL tree. Used to save paths through the tree.
|
#define AVL_MAX_DEPTH (1024) /**< The maximum depth of an AVL tree. Used to save paths through the tree.
|
||||||
*/
|
*/
|
||||||
#define AVL_MAX_NAME (1024) /**< The maximum length of an AVL tree name.
|
#define AVL_MAX_NAME (250) /**< The maximum length of an AVL tree name.
|
||||||
*/
|
*/
|
||||||
#define AVL_GROWTH_FACTOR (2) /**< The growth factor when an AVL tree is enlarged.
|
#define AVL_GROWTH_FACTOR (2) /**< The growth factor when an AVL tree is enlarged.
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "obitypes.h"
|
#include "obitypes.h"
|
||||||
|
|
||||||
|
|
||||||
#define OBIDMS_MAX_NAME (2048) /**< The maximum length of an OBIDMS name.
|
#define OBIDMS_MAX_NAME (247) /**< The maximum length of an OBIDMS name.
|
||||||
*/
|
*/
|
||||||
#define INDEXER_DIR_NAME "OBIBLOB_INDEXERS" /**< The name of the Obiblob indexer directory.
|
#define INDEXER_DIR_NAME "OBIBLOB_INDEXERS" /**< The name of the Obiblob indexer directory.
|
||||||
*/
|
*/
|
||||||
@ -34,11 +34,11 @@
|
|||||||
*/
|
*/
|
||||||
#define TAXONOMY_DIR_NAME "TAXONOMY" /**< The name of the taxonomy directory.
|
#define TAXONOMY_DIR_NAME "TAXONOMY" /**< The name of the taxonomy directory.
|
||||||
*/
|
*/
|
||||||
#define MAX_NB_OPENED_COLUMNS (100) /**< The maximum number of columns open at the same time.
|
#define MAX_NB_OPENED_COLUMNS (1000) /**< The maximum number of columns open at the same time.
|
||||||
*/
|
*/
|
||||||
#define MAX_NB_OPENED_INDEXERS (100) /**< The maximum number of indexers open at the same time.
|
#define MAX_NB_OPENED_INDEXERS (1000) /**< The maximum number of indexers open at the same time.
|
||||||
*/
|
*/
|
||||||
#define MAX_PATH_LEN 4096 /**< Maximum length for the character string defining a
|
#define MAX_PATH_LEN (1024) /**< Maximum length for the character string defining a
|
||||||
* file or directory path.
|
* file or directory path.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "obiblob_indexer.h"
|
#include "obiblob_indexer.h"
|
||||||
|
|
||||||
|
|
||||||
#define ELEMENTS_NAMES_MAX (2048) /**< The maximum length of the list of elements names.
|
#define ELEMENTS_NAMES_MAX (2048) /**< The maximum length of the list of elements names. // TODO Discuss
|
||||||
*/
|
*/
|
||||||
#define COLUMN_GROWTH_FACTOR (2) /**< The growth factor when a column is enlarged.
|
#define COLUMN_GROWTH_FACTOR (2) /**< The growth factor when a column is enlarged.
|
||||||
*/
|
*/
|
||||||
|
@ -1645,7 +1645,6 @@ int obi_view_add_column(Obiview_p view,
|
|||||||
int i;
|
int i;
|
||||||
OBIDMS_column_p column;
|
OBIDMS_column_p column;
|
||||||
OBIDMS_column_p column_buffer;
|
OBIDMS_column_p column_buffer;
|
||||||
OBIDMS_column_p current_line_selection;
|
|
||||||
|
|
||||||
// Check that the view is not read-only
|
// Check that the view is not read-only
|
||||||
if (view->read_only)
|
if (view->read_only)
|
||||||
@ -1702,19 +1701,24 @@ int obi_view_add_column(Obiview_p view,
|
|||||||
if (create)
|
if (create)
|
||||||
{ // Create column
|
{ // Create column
|
||||||
column = obi_create_column(view->dms, column_name, data_type, nb_lines, nb_elements_per_line, elements_names, indexer_name, associated_column_name, associated_column_version, comments);
|
column = obi_create_column(view->dms, column_name, data_type, nb_lines, nb_elements_per_line, elements_names, indexer_name, associated_column_name, associated_column_version, comments);
|
||||||
|
if (column == NULL)
|
||||||
|
{
|
||||||
|
obidebug(1, "\nError creating a column to add to a view");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
(column->header)->lines_used = nb_lines;
|
(column->header)->lines_used = nb_lines;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Open column
|
{ // Open column
|
||||||
// TODO do we require that the column's line count is equal to the view's line count?
|
|
||||||
// or do we enlarge the column or the view as needed?
|
|
||||||
column = obi_open_column(view->dms, column_name, version_number);
|
column = obi_open_column(view->dms, column_name, version_number);
|
||||||
}
|
if (column == NULL)
|
||||||
|
{
|
||||||
if (column == NULL)
|
obidebug(1, "\nError opening a column to add to a view");
|
||||||
{
|
return -1;
|
||||||
obidebug(1, "\nError creating or opening a column to add to a view");
|
}
|
||||||
return -1;
|
// Check that the column's line count is equal to the view's line count if there is no line selection.
|
||||||
|
// TODO But what if there is a line selection ??? imo should just check that col_line_count > line_selection_count
|
||||||
|
//if ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store column pointer in the view structure
|
// Store column pointer in the view structure
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "hashtable.h"
|
#include "hashtable.h"
|
||||||
|
|
||||||
|
|
||||||
#define OBIVIEW_NAME_MAX_LENGTH (255) /**< The maximum length of an OBIDMS view name.
|
#define OBIVIEW_NAME_MAX_LENGTH (249) /**< The maximum length of an OBIDMS view name, without the extension.
|
||||||
*/
|
*/
|
||||||
#define VIEW_TYPE_MAX_LENGTH (1024) /**< The maximum length of the type name of a view.
|
#define VIEW_TYPE_MAX_LENGTH (1024) /**< The maximum length of the type name of a view.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user