Hi Sophia, Yanquan, all, Thanks for the summary. Option C plus the tracked-paths gauge sounds good to me. Before the FLIP is written, I have one data point on the other half of the cost, the listing itself.
Our input is log files on an object store, laid out by time as `<root>/<yyyyMMdd>/<HH>/*.gz`, with a few thousand new files per hour and a 9-day retention: 216 hour directories and several hundred thousand objects under the root. Option C bounds the state by what exists, which here is the whole retention window. Every discovery interval would still list all 216 directories, although only the latest one or two can receive new files. Listing one complete hour directory took 95 to 400 ms in our tests, so we estimate 20 to 90 seconds per round for the whole tree, against a 60-second discovery interval. We ended up with a custom source that lists only the most recent N time directories and drops the paths of a directory once it leaves the window. For time-partitioned layouts this bounds both the listing cost and the state by N, independent of retention. It assumes that no file arrives in a directory older than N, which holds for us but not in general. So I wonder whether the FLIP could leave room for a pluggable "which directories to list in this round" step, so that time-partitioned inputs can restrict discovery to recent partitions while option C stays the rule for the state. This is different from glob selection (FLINK-6417, PR #29219): a glob fixes the pattern when the job starts, while here the set of directories moves with time. Our use case only needs the time-window variant, so I don't want to widen the scope of the FLIP. If this fits better in a separate ticket, I'm happy to open one, and I can help with the tracked-paths gauge as well. Best regards, COLDMANYU
