pmemkv icon indicating copy to clipboard operation
pmemkv copied to clipboard

create_if_missing may cover up the real problem

Open lukaszstolarczuk opened this issue 4 years ago • 1 comments

Consider example:

  • I create a testfile for engine cmap
  • I now try to create a testfile (within the same path) e.g. for engine radix, with create_if_missing flag set up
  • I got error Failed creating pool: file .../testfile already exists
    • while I expect to get something like Failed opening pool: wrong layout ("..."), pool created with layout "..."

So, to sum up - using create_if_missing flag may conceal from the user the real problem with their pool. Perhaps we should print both errors (one from the open method and the other one, from the create method) if applicable.

lukaszstolarczuk avatar Aug 09 '21 09:08 lukaszstolarczuk

Hm, yes, I think this might be a good idea. We would just need to make sure that in the documentation we have stated exactly what happens for create_if_missing (first create, then open) and also to clear the error if the second call succeeds.

igchor avatar Sep 24 '21 12:09 igchor