hpc-io / pdc

Proactive Data Containers (PDC) software provides an object-centric API and a runtime system with a set of data object management services. These services allow placing data in the memory and storage hierarchy, performing data movement asynchronously, and providing scalable metadata operations to find data objects.
https://pdc.readthedocs.io
Other
13 stars 12 forks source link

Attempting to create a container with a duplicate name will return the existing container's id instead of returning 0 #64

Open gerzytet opened 2 years ago

gerzytet commented 2 years ago

code to reproduce:


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pdc.h"

int
main(int argc, char **argv)
{
    pdcid_t pdc_id, cont_id, cont_prop, cont_id2;
    int     rank = 0, size = 1;
    int     ret_value = 0;

    // create a pdc
#ifdef ENABLE_MPI
    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
#endif

    pdc_id = PDCinit("pdc");
    cont_prop = PDCprop_create(PDC_CONT_CREATE, pdc_id);
    if (cont_prop <= 0)
        printf("Fail to create container property @ line  %d!\n", __LINE__);

    // create a container
    cont_id = PDCcont_create("VPIC_cont", cont_prop);
    if (cont_id <= 0)
        printf("Fail to create container @ line  %d!\n", __LINE__);

    cont_id2 = PDCcont_create("VPIC_cont", cont_prop);
    if (cont_id2 <= 0)
        printf("Fail to create container @ line  %d!\n", __LINE__);

    PDCclose(pdc_id);

#ifdef ENABLE_MPI
    MPI_Finalize();
#endif
    return ret_value;
}
houjun commented 1 year ago

This is sort of an (unintended) feature, for all the PDC parallel tests, all ranks call PDCcont_create() at the beginning, assuming one rank sends the create request to the server, which creates a container, the rest of the ranks would just "open" the container without getting a failure. To make PDCcont_create() fail when there exists a container with the same name we will need to change the test codes to use a collective version of the PDCcont_create().

jeanbez commented 7 months ago

decision: make it fail