In order to improve repack performance, we need to be able to fetch a single
delta from a data store. This diff adds the new api and implements it in all our
existing interfaces.
Details
- Reviewers
quark - Group Reviewers
Restricted Project - Commits
- rFBHGX38db46cc245c: datapack: add getdelta api
Diff Detail
- Repository
- rFBHGX Facebook Mercurial Extensions
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
cstore/py-cdatapack.h | ||
---|---|---|
476 | nit: &args[0] is the same as args. args is not a C array but a Python tuple. Use PyTuple_GET_ITEM(x, 0) instead of [0] here: PyErr_SetObject(PyExc_KeyError, PyTuple_GET_ITEM(args, 0)); That said, KeyError accepts a tuple so the old code won't crash. | |
503–506 | s/PyString_/PyBytes_/ to decouple from Python 2. I think it's worthwhile to use: delta = PyBuffer_FromMemory(link.delta, (Py_ssize_t) link.delta_sz) (and move`free() below to be inside if (!delta)`). | |
519–533 | PyXDECREF(NULL) is also a no-op. So the block is equivalent to: free((void *)link.delta); return tuple; | |
530 | nit: free(NULL) is a no-op. So if is unnecessary. |
cstore/py-cdatapack.h | ||
---|---|---|
503–506 | I take that back. PyBuffer_FromMemory won't take care of deallocation. So we have to do a copy here. |
cstore/py-cdatapack.h | ||
---|---|---|
476 | This is just a copy of the code in cdatapack_getmeta. I'll update it though. |
nit: &args[0] is the same as args.
args is not a C array but a Python tuple. Use PyTuple_GET_ITEM(x, 0) instead of [0] here:
That said, KeyError accepts a tuple so the old code won't crash.