akhaku commented on PR #1635:
URL: 
https://github.com/apache/cassandra-java-driver/pull/1635#issuecomment-2351958349

   That will work in some cases, but a few things that make me feel like the 
current approach is better:
   1. I'm hesitant to do a schema refresh in the request path of the driver, it 
will cause that request to look latent from the caller's perspective. The 
closes thing I can think of is preparing a statement on an UNPREPARED response 
but that particular case seems warranted.
   2. A refresh in that code path isn't enough, the codec is likely be cached 
in the CachingCodecRegistry and there's (currently) no way to invalidate that. 
For example when using the object mapper it validates the schema against your 
POJOs by default and ends up caching the codec at init time. You can't even 
re-register your UdtCodec on an error since it hits the [collides 
check](https://github.com/apache/cassandra-java-driver/blob/4.x/core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/registry/CachingCodecRegistry.java#L123)
 and doesn't get re-registered - changing that will be a fair bit more invasive.
   > whose set of fields is different from what we expect.
   3. The only changes you can make to a UDT are to add fields, and this code 
path deals specifically with having more fields than we expect. Additionally, 
given Cassandra is byte buffers all over the place, there's nothing stopping a 
user from trying to read bytes with the wrong codec except for schema 
verification, and that's what protects us from the general "wrong UDT 
definition" case. I think that means we can assume users only make "sane" 
changes to a UDT while a client app is running (i.e. UDT field additions) and 
so the "right" thing to do is ignore fields that were added that we don't 
recognize, to make it easier to roll out a UDT change across the writer apps 
and reader apps.
   
   Let me know if you want to chat about this over a call, it took me a couple 
hours to page in enough context about this to be able to respond to you, would 
be nice to resolve this before it gets paged out again :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to