Skip to content

Remove TODOs from RootTabletMutatorImpl.java - #6494

Open
Amemeda wants to merge 4 commits into
apache:mainfrom
Amemeda:mutator-todos
Open

Remove TODOs from RootTabletMutatorImpl.java#6494
Amemeda wants to merge 4 commits into
apache:mainfrom
Amemeda:mutator-todos

Conversation

@Amemeda

@Amemeda Amemeda commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Removed the following TODOs:

  • RootTabletMutatorImpl.java: // TODO examine implementation of getZooReaderWriter().mutate(): This TODO may be outdated, current version of code does not use context.getZooReaderWriter(), uses context.getZooSession() instead
  • RootTabletMutatorImpl.java: // TODO for efficiency this should maybe call mutateExisting: Updated line 103 to use mutateExisting() instead of mutateOrCreate()
  • RootTabletMutatorImpl.java: // TODO this is racy... . Added Thread.sleep() after the first call to clear() as a makeshift wait to check that the ZROOT_TABLET is empty before calling clear() again a few lines later to avoid race condition.
  • RootConditionalWriter.java: // TODO this is racy... . Same as above

This pr resolves 4 TODOs from #2699


Need more information on what is going on here / what an alternative would be. Both occurrences of this TODO are preceded by the exact same clear() a few lines beforehand, could this be why it is racy?

image

@Amemeda Amemeda changed the title Remove TODO's from RootTabletMutatorImpl.java Remove TODOs from RootTabletMutatorImpl.java Jul 29, 2026
@Amemeda
Amemeda marked this pull request as ready for review August 4, 2026 17:14

@DomGarguilo DomGarguilo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right approach. I think expexting .get() to return a length of 0 wont happen because .clear() clears the value from the cache while .get() pulls the actual data from ZooKeeper which is not removed by .clear().

I think the correct approach here is actually just drop the 3 .clear calls (there are two in RootConditionalWriter.java) since ZooCache already invalidates things when ZooKeeper reports a data change. So .clear() is redundant and racy.

For the TODOs in RootTabletMutatorImpl.java, I think the proper fix is to just drop the .clear() call for the same reasons. And the other TODO can be fixed by simply using mustateExisting(). I think thats the correct approach because we are expecting things to already exist and using mutateExisting() will fail if it doesn't exist rather than create things in a bad state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants