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

Consider/experiment with avoiding scan server refs by delaying GC #4538

Open
ctubbsii opened this issue May 8, 2024 · 1 comment
Open

Consider/experiment with avoiding scan server refs by delaying GC #4538

ctubbsii opened this issue May 8, 2024 · 1 comment
Labels
enhancement This issue describes a new feature, improvement, or optimization.

Comments

@ctubbsii
Copy link
Member

ctubbsii commented May 8, 2024

Related to #4529, which proposed moving scan server file refs to their own table.

An alternative to consider would be to try to avoid the need to create scan server refs in the first place. This could be done by ensuring GC candidates are not deleted immediately, but deletion is delayed enough to give time for existing scan servers to finish using them (in other words, delay at least as long as it takes for the scan server file ref cache to expire).

One advantage of this would be to reduce the use of the metadata table and the remove the need to constantly update the file refs based on the current scan servers.

Even delaying GC, some refs may still be needed for long-running scans that are not yet complete.

So, some challenges include:

  • tracking how long files need to wait before they are deleted (if the GC keeps track in its memory, it could use a lot of memory; if it's persisted, then we have to have a way of representing the time that is recorded, and global time tracking in a cluster can be tricky)
  • determining when a scan server needs to store a ref for a long-running scan

I'm not certain this is a better idea than #4528, but there may be advantages that are worth pursuing instead of that (or maybe in addition to that).

@ctubbsii ctubbsii added the enhancement This issue describes a new feature, improvement, or optimization. label May 8, 2024
@keith-turner
Copy link
Contributor

Chatted w/ @cshannon about this. One challenge we identified is large compaction operations. For example if a large number of external compaction processes are temporarily stood up and then a large compaction operation is initiated, it may start to generate large numbers of files in a short time that should be deleted. In the worst case if the GC delays deleting files it could result in the compaction operation filling up DFS. This implies that the delay may need to adjust depending on DFS free space and the amount of files that could be deleted, but are delayed. Dynamically adjusting the delay makes it harder for the scan servers to reason about it.

Another thing discsussed was race conditions. This change would conceptually create another set of files the GC is tracking.

  • File references (existing set)
  • GC candidates (existing set)
  • Delayed delete files (new set)
  • Deleting files (existing set)

When the GC moves a file from the new delayed_delete set to the deleting_files set, it must be done in a such a way that considers what the scan servers are using and not have race conditions. We talked through a few ways to do this, but those possible solutions had race conditions. So still need to figure out something for that.

This offers a potential speed up to scan servers for writing out scan server refs to the metadata table. The scan server will still have to read tablet files from the metadata table, which is an extra cost over tablet servers. That leads to another potential solution to lower scan time as some way to pre load tablets on select scan servers, that may be something to explore in tandem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue describes a new feature, improvement, or optimization.
Projects
Status: No status
Development

No branches or pull requests

2 participants