Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to delete table and schema immediately #14736

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jadami10
Copy link
Contributor

@jadami10 jadami10 commented Jan 2, 2025

This is a small UI quality of life feature

  • remove the "delete schema" button. You can't delete the schema while the table exists. So there's no way a "delete schema" button works on the table page
  • remove the "truncate table" button. It's been >2 years since it's been pending, so I'm removing it to reclaim the UI space.
  • update the "delete table" modal with 2 options: delete immediately and delete schema
    • "delete immediately" bypasses retention which is really useful for large tables that cause this API to time out
    • "delete schema" is a replacement for the dedicated button that will only delete the schema after deleting the table

I tested this locally with a quickstart:

  • deleting a table with neither option
  • deleting a table immediately
  • deleting the offline table and schema of a hybrid table deletes the tables but fails to delete the schema still in use
  • deleting a table with both options

how the modal looks
image

deleting both the table and schema
image

@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.82%. Comparing base (59551e4) to head (742bed0).
Report is 1523 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #14736      +/-   ##
============================================
+ Coverage     61.75%   63.82%   +2.07%     
- Complexity      207     1607    +1400     
============================================
  Files          2436     2703     +267     
  Lines        133233   150729   +17496     
  Branches      20636    23289    +2653     
============================================
+ Hits          82274    96206   +13932     
- Misses        44911    47326    +2415     
- Partials       6048     7197    +1149     
Flag Coverage Δ
custom-integration1 100.00% <ø> (+99.99%) ⬆️
integration 100.00% <ø> (+99.99%) ⬆️
integration1 100.00% <ø> (+99.99%) ⬆️
integration2 0.00% <ø> (ø)
java-11 63.79% <ø> (+2.08%) ⬆️
java-21 63.70% <ø> (+2.08%) ⬆️
skip-bytebuffers-false 63.82% <ø> (+2.07%) ⬆️
skip-bytebuffers-true 63.68% <ø> (+35.95%) ⬆️
temurin 63.82% <ø> (+2.07%) ⬆️
unittests 63.82% <ø> (+2.07%) ⬆️
unittests1 56.27% <ø> (+9.38%) ⬆️
unittests2 34.15% <ø> (+6.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yashmayya yashmayya added feature ui UI related issue labels Jan 2, 2025
@Jackie-Jiang
Copy link
Contributor

Thanks! This is super useful! @jayeshchoudhary Can you help take a look?

Comment on lines +155 to +166
// This is quite hacky, but it's the only way to get this to work with the dialog.
// The useState variables are simply for the dialog box to know what to render in
// the checkbox fields. The actual state of the checkboxes is stored in the refs.
// The refs are then used to determine how we delete the table. If you try to use
// the state variables in this class, you will not be able to get their latest values.
const [dialogCheckboxes, setDialogCheckboxes] = useState({
deleteImmediately: false,
deleteSchema: false
});
const deleteImmediatelyRef = useRef(false);
const deleteSchemaRef = useRef(false);

Copy link
Contributor

Choose a reason for hiding this comment

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

if the state can be used to render checkbox value then it can be used at other places as well.
do you know the reason of this behaviour? Iet me know if you want me to debug. I think its some react rendering issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know react well enough, but I spent days on this with a coworker as well as multiple LLM tools, and this is the only thing that reliably worked. I think the issue is the very strange lifecycle of state variables and functions.

  • "show dialog" state variable is in TenantDetails
  • checkbox definition is in TenantDetails
  • checkbox state is in TenantDetails
  • the actual modal is in Confirm
  • the children are rendered in Confirm
  • the callbacks are defined in TenantDetails but activated in Confirm

Reusing the state variables from TenantDetails and rendering them in Confirm, I only got 2 bad things working

  • the checkbox updates, but the callback doesn't see the latest value until the second time it's called
  • the callback sees the latest value, but the checkbox doesn't actually visually update

This leads me to believe that the way we're creating + rendering the modal does not allow for a single state variable to work since there's no possible update order for every component to do the right thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

got it, thanks for the info. Let me try debugging.
Will update you here in a day or two. if not this solution looks good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ui UI related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants