alamb commented on code in PR #19759:
URL: https://github.com/apache/datafusion/pull/19759#discussion_r2722436645


##########
datafusion/execution/src/memory_pool/mod.rs:
##########
@@ -367,8 +367,8 @@ impl MemoryReservation {
 
     /// Frees all bytes from this reservation back to the underlying
     /// pool, returning the number of bytes freed.
-    pub fn free(&mut self) -> usize {
-        let size = self.size;
+    pub fn free(&self) -> usize {
+        let size = self.size.load(atomic::Ordering::Relaxed);

Review Comment:
   I would expect that the reservations should be consistent 
(Ordering::seqcst), otherwise I would worry that we run the risk of not seeing 
other changes.
   
   However, Relaxed seems to be used in the MemoryPools themselves, so this is 
consistent
   
   
https://github.com/apache/datafusion/blob/ead8209803770773980fafaf0fc622bb606be0ee/datafusion/execution/src/memory_pool/pool.rs#L83-L82



##########
datafusion/execution/src/memory_pool/mod.rs:
##########
@@ -367,8 +367,8 @@ impl MemoryReservation {
 
     /// Frees all bytes from this reservation back to the underlying
     /// pool, returning the number of bytes freed.
-    pub fn free(&mut self) -> usize {
-        let size = self.size;
+    pub fn free(&self) -> usize {

Review Comment:
   Is this technically this is a breaking API change? I thought about it and 
from what I can tell the answer is no as to all this API in DataFusion 52 the 
caller needs a `mut` and in 53 would not (but could still call it with mut even 
though that is not needed)



-- 
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