cxm940188 opened a new pull request, #24210:
URL: https://github.com/apache/kafka/pull/24210

   ## Summary
   
   Broker shutdown now releases the share resources owned by 
`SharePartitionManager`: cached share partitions, their per-partition metrics, 
and the owned `ShareSessionCache`.
   
   ## Problem
   
   `SharePartitionManager.close()` did not drain cached `SharePartition` 
instances, and `ShareSessionCache` had no close lifecycle. Share partition 
metrics, session-cache metrics, and cache-owned state therefore remained 
registered or referenced after shutdown.
   
   ## Changes
   
   - Make `SharePartitionManager.close()` idempotent and drain all cached share 
partitions.
   - Guarantee `SharePartition.close()` on cache removal, even if fencing, 
listener removal, or delayed notification fails.
   - Add an idempotent `ShareSessionCache.close()` that clears cache state and 
deregisters its three metrics.
   - Close the session cache after partition cleanup and before the timer; 
cache-close failures do not block timer shutdown.
   - Add `.workbuddy/` to `.gitignore` in a separate MINOR commit.
   
   ## Testing
   
   Added/updated unit tests for:
   
   - partition drain, listener removal, delayed-fetch notification, and metric 
deregistration;
   - session-cache state cleanup and all three metric removals;
   - idempotent manager/cache shutdown;
   - partition cleanup -> session-cache close -> timer close ordering;
   - failure isolation for partition and session-cache cleanup;
   - post-close session guards and old-gauge reuse.
   
   Validation:
   
   ```bash
   ./gradlew --offline :server:test \
     --tests 'org.apache.kafka.server.share.session.ShareSessionCacheTest'
   # 17 tests passed
   
   ./gradlew --offline :core:test \
     --tests 'kafka.server.share.*'
   # 489 tests passed
   
   ./gradlew --offline :server:checkstyleMain :server:checkstyleTest \
     :core:checkstyleMain :core:checkstyleTest spotlessCheck
   # passed
   


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

Reply via email to