-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FMWK-468 Allow send key classes to use PK instead of Bin #160
FMWK-468 Allow send key classes to use PK instead of Bin #160
Conversation
Added a new annotation field "storeInPkOnly" to use the PK field as storing the key, rather than explicitly setting a bin in the database. - Added unit tests for the same, both reactive and normal - Tested with annotations, YAML config, code config.
@tim-aero Should we even keep the previous "key as bin" approach? is it done only for backward compatibility? if so we can maybe mark "key as bin" as deprecated with warning of use PK instead and remove this flag in later versions (In Spring Data Aerospike we had the same problem and we removed the "key as bin" without deprecation but it's not ideal from backward perspective) Do we use this "key as bin" when reading a record? (to map to the POJO?) - we can try map it from the PK if exists and if not from the "key as bin" that way we can support reads for both approaches (in case we will change it to PK without supporting "key as bin" and still being able to read the old records). WDYT? |
Thanks Roi.
Prior to this change, the object mapper would always store the key in a column, irrespective of whether sendKey was true or not. There are multiple situations where the key is used like:
- loading deferred objects
- using getters and setters for the primary key (for example making a compound key from multiple fields)
- loading subordinate referenced objects, both lazily and normal.
I think we should tread carefully where the key is used, but I like the idea that if sendKey is true then only the PK should be used as the key by default. The new flags should stay in case there are situations where behavior doesn’t work correctly unless the key is explicitly stored in a column. For example, if some data is populated into the set by another application without sendKey = true and SI scans are required.
I don’t think there’s anything to deprecate though. We still need @AerospikeKey and this flag didn’t exist before. Maybe we document it as currently defaulting to false, but with the intention that it will change to default to true in the future, but only if “sendKey” is true.
Thoughts?
On Jun 16, 2024, at 02:10, Roi Menashe ***@***.***> wrote:
@tim-aero<https://github.com/tim-aero>
Did the Java Object Mapper support key as a bin previously to this change?
PK (stored in the record's metadata) is definitely the way to go which btw aligns with our Spring Data Aerospike implementation.
Should we even keep the previous "key as bin" approach? is it done only for backward compatibility? if so we can maybe mark "key as bin" as deprecated with warning of use PK instead and remove this flag in later versions (In Spring Data Aerospike we had the same problem and we removed the "key as bin" without deprecation but it's not ideal from backward perspective)
Do we use this "key as bin" when reading a record? (to map to the POJO?) - we can try map it from the PK if exists and if not from the "key as bin" that way we can support reads for both approaches (in case we will change it to PK without supporting "key as bin" and still being able to read the old records).
WDYT?
—
Reply to this email directly, view it on GitHub<#160 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABB63E4IYW3QZPNLXGO6OFTZHVB7RAVCNFSM6AAAAABJLCVCE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZRGE4DENBYGY>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@tim-aero
|
Hi Roi, Yes, I like the
So I'm wondering if we should create an Enum like There is currently a check to see if |
@tfaulkes I don't like the enum idea because
|
Changed the config field name from `storeInPkOnly` to `storeAsBin`, added unit test to ensure config validation works.
Co-authored-by: Eugene R. <[email protected]>
Added functionality to allow the record key to be stored in the database key field rather than requiring an explicit bin.