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

[Structured Streaming] Compact files in sink checkpoint location get bigger and bigger #2261

Open
sunspeedzy opened this issue Sep 10, 2024 · 1 comment

Comments

@sunspeedzy
Copy link

There are some files with the suffix ".compact" in the sink folder of Spark checkpoint location.
The files compact all the history EsSinkStatus logs since the first index action.
Image

I found the reason is that org.elasticsearch.spark.sql.streaming.EsSinkMetadataLog#compactLogs() returns all the input logs rather than drops the expired ones.

override def compactLogs(logs: Seq[EsSinkStatus]): Seq[EsSinkStatus] = logs

I think it's better to add a code snippet which filter the logs and drop the expired ones.

@sunspeedzy
Copy link
Author

I think the following code snippet can resolve the issue.
override def compactLogs(logs: Seq[EsSinkStatus]): Seq[EsSinkStatus] = { val minMills = System.currentTimeMillis() - fileCleanupDelayMs; logs.filter(_.execTimeMillis >= minMills) }

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

No branches or pull requests

1 participant