zodb / relstorage

A backend for ZODB that stores pickles in a relational database.
Other
53 stars 46 forks source link

Provide loadBeforeEx #485

Open navytux opened 2 years ago

navytux commented 2 years ago

loadBeforeEx is like loadBefore, but simpler, provides better information for object delete records and can be more efficiently implemented by many storages: https://github.com/zopefoundation/ZODB/pull/323

On RelStorage loadBefore is currently implemented via 3 SQL queries:

1) check whether object record exists at all 2) retrieve object state 3) retrieve serial of next object revision

Compared to that loadBeforeEx is implemented via only one SQL query "2" from the above - "retrieve object state". It is exactly the same query that loadBefore uses and after the patch loadBefore actually invokes loadBeforeEx for step 2.

This change was outlined in

https://github.com/zopefoundation/ZODB/issues/318#issuecomment-657683419 and https://github.com/zopefoundation/ZODB/issues/318#issuecomment-657685745

and as explained in the first link this patch is also semantically coupled with

https://github.com/zodb/relstorage/pull/484

This patch passes tests with both ZODB5 and with ZODB5+https://github.com/zopefoundation/ZODB/pull/323:

For tests to pass with ZODB5+https://github.com/zopefoundation/ZODB/pull/323 we also need https://github.com/zopefoundation/zc.zlibstorage/pull/11 because without that fix zc.zlibstorage does not decompress data on loadBeforeEx.

navytux commented 2 years ago

Regarding test failure: I tend to believe that the sole failue of PYTHON=C:\Python38-x64 is due to some flakiness and is unrelated to hereby patch becuase of the following reasons:

Kirill