Ejemplo n.º 1
0
def recovery(testparams, request, session, nodes, indexes, dropped_groups):
    """Returns a structure of recovery data."""
    recovery = request.param(testparams, session, nodes, dropped_groups, indexes)
    logger.info("{}\n".format(recovery["cmd"]))

    logger.info("Wait for indexes to synchronize.\n")
    time.sleep(testparams["cache_sync_timeout"])

    recovery["exitcode"] = subprocess.call(recovery["cmd"])

    return recovery
Ejemplo n.º 2
0
def _write_files(session, files_number, file_size):
    """Writes files with preset session and specified files parameters: numbers and size."""
    logger.info("Started writing {} files\n".format(files_number))

    keys = set()
    for i in xrange(files_number):
        key, data = get_key_and_data(file_size, randomize_len=False)

        session.write_data(key, data).wait()
        keys.add(key)
        logger.info("\r{}/{}".format(i + 1, files_number))

    logger.info("\nFinished writing files\n")

    return keys
Ejemplo n.º 3
0
def _set_indexes(session, keys, indexes):
    """Prepares secondary indexes.

    Sets randomly chosen indexes for a given list of keys and
    returns a dictionary with information about these indexes.

    """
    logger.info("Started setting indexes for {} keys...\n".format(len(keys)))

    keys_indexes = {}
    for i, key in enumerate(keys):
        indexes_count = random.randint(0, len(indexes))
        key_indexes = random.sample(indexes, indexes_count)
        index_data = [index_data_format(key, index) for index in key_indexes]

        session.set_indexes(key, key_indexes, index_data).wait()
        keys_indexes[key] = set(key_indexes)

        logger.info("\r{}/{}".format(i + 1, len(keys)))

    logger.info("\nFinished setting indexes\n")

    return keys_indexes