smengcl commented on code in PR #11310:
URL: https://github.com/apache/ozone/pull/11310#discussion_r4099808899
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/service/TestSnapshotDeletingServiceIntegrationTest.java:
##########
@@ -624,35 +626,39 @@ private synchronized void
createSnapshotDataForBucket(OzoneBucket bucket) throws
bucket.getName()));
}
- private MockedConstruction<ReclaimableKeyFilter>
getMockedReclaimableKeyFilter(String volume, String bucket,
+ private MockedConstruction<ReclaimableKeyFilter>
getMockedReclaimableKeyFilter(OzoneBucket bucket,
AtomicBoolean kdsWaitStarted, AtomicBoolean sdsLockWaitStarted,
- AtomicBoolean sdsLockAcquired, AtomicBoolean kdsFinished,
ReclaimableKeyFilter keyFilter) throws IOException {
+ AtomicBoolean sdsLockAcquired, AtomicBoolean kdsFinished,
MultiSnapshotLocks kdsMultiLocks,
+ List<UUID> expectedIds) {
return mockConstruction(ReclaimableKeyFilter.class,
(mocked, context) -> {
when(mocked.apply(any())).thenAnswer(i -> {
Table.KeyValue<String, OmKeyInfo> keyInfo = i.getArgument(0);
- if (!keyInfo.getValue().getVolumeName().equals(volume) ||
- !keyInfo.getValue().getBucketName().equals(bucket)) {
- return keyFilter.apply(i.getArgument(0));
+ if
(!keyInfo.getValue().getVolumeName().equals(bucket.getVolumeName()) ||
+ !keyInfo.getValue().getBucketName().equals(bucket.getName())) {
+ return false;
}
- keyFilter.apply(i.getArgument(0));
+ if (kdsWaitStarted.get()) {
+ return true;
+ }
+
assertTrue(kdsMultiLocks.acquireLock(expectedIds).isLockAcquired());
Review Comment:
The mocked apply() now acquires a separate test lock and returns true, so
KDS never runs ReclaimableFilter.apply() or acquires its production snapshot GC
read lock. The test can pass if that production locking breaks. true can also
mark a key retained by a snapshot for deletion.
Please delegate to a real ReclaimableKeyFilter and make the SDS test lock
use the OM metadata manager’s lock. The new flush and cache waits can stay.
--
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]