(Minor) I would be inclined to turn this chained if...else if...else into a switch(rc).  It made sense to use if when the switch would just have had one case and a default, but now that it's got two cases, it's a better representation of the decision being taken here.  What we do here depends on the value of rc; if it's success we commit, if notfound we log, else we log a different message.