ArafatKhan2198 opened a new pull request, #12006: URL: https://github.com/apache/ozone/pull/12006
## What changes were proposed in this pull request? When Recon reads a delta from OM, `OMDBUpdatesHandler` turns each OM DB write into an event for the Recon tasks. For a DELETE it attaches the deleted row, so the tasks know what to subtract. It takes that row from the last event for the key in this delta if there is one, and otherwise from Recon's OM DB. After a DELETE event, that last event still holds the deleted row. So if the same key is deleted a second time in the same delta, Recon emits another DELETE with the same old row, and the tasks subtract the key twice. OM can write two DELETEs of a key with nothing in between. One double-buffer flush is written as one batch, and that batch keeps only the last write per key (HDDS-8128). So if a key is re-created and deleted within one flush, the WAL shows only the DELETE. **Example:** key `lock` (50 bytes) exists, and Recon shows 1 file. 1. OM flush 1: delete `lock`. Recon subtracts it and shows 0 files. 2. OM flush 2: create `lock`, then delete it. The WAL only shows "delete `lock`". 3. In the same Recon delta, Recon reuses the old row and subtracts `lock` again. It shows **-1 files and -50 bytes**. **Impact:** - Every Recon OM task subtracts the key a second time: NSSummary file counts and sizes (served by `/api/v1/namespace/summary` and `/du`), file size bins, table insight counts, and container key counts. - The wrong totals stay until a full rebuild. OM data is not affected. **How often:** no fault or admin action is needed. It takes a workload that quickly deletes and re-creates the same key name, such as a fixed-name temp, lock or state file. Both deletes have to fall into one Recon delta, and the re-create and second delete have to land in one OM flush. Each occurrence subtracts the key once more, so the totals drift over time. **Change:** in the DELETE branch of `OMDBUpdatesHandler.processEvent`, a DELETE whose last event in this delta is already a DELETE produces no event. The key is already gone, so there is nothing left to subtract. Recon's OM DB itself is updated exactly as before; only the duplicate event to the tasks is dropped. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17043 ## How was this patch tested? - Updated `TestOMDBUpdatesHandler.testOperateOnSameEntry`, which asserted the duplicate DELETE (7 events). It now expects 6, and it fails without the fix with `expected: <6> but was: <7>`. - `TestOMDBUpdatesHandler` and `TestOzoneManagerServiceProviderImpl` pass locally. - The reproduction test attached to the JIRA fails without the fix (`numOfFiles incremental vs rebuild ==> expected: <1> but was: <0>`) and passes with it. - CI on the fork: (link) -- 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]
