# Partition Finalization in Pinterest's Next-Generation DB Ingestion Framework

DevFeed: [Partition Finalization in Pinterest's Next-Generation DB Ingestion Framework](<https://devfeed.tech/articles/partition-finalization-in-pinterest-s-next-generation-db-ingestion-framework-60046.md>)

Original publisher: [Read original article](<https://medium.com/pinterest-engineering/partition-finalization-in-pinterests-next-generation-db-ingestion-framework-4c7da6e4cc8f?source=rss----4c5a5f6279b6---4>)

Author: Pinterest Engineering

Published: 2026-09-25T15:01:03Z

Content type: article

Language: en

Sources: [Pinterest](<https://devfeed.tech/sources/pinterest-engineering-blog-medium.md>)

Topics: [data-engineering](<https://devfeed.tech/topics/data-engineering.md>), [Data pipelines](<https://devfeed.tech/topics/data-pipelines.md>), [stream-processing](<https://devfeed.tech/topics/stream-processing.md>), [Apache Flink](<https://devfeed.tech/topics/apache-flink.md>), [Apache Iceberg](<https://devfeed.tech/topics/apache-iceberg.md>), [table-partitioning](<https://devfeed.tech/topics/table-partitioning.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [automated](<https://devfeed.tech/tags/automated.md>), [batch](<https://devfeed.tech/tags/batch.md>), [challenge](<https://devfeed.tech/tags/challenge.md>), [complete](<https://devfeed.tech/tags/complete.md>), [completeness](<https://devfeed.tech/tags/completeness.md>), [consumer](<https://devfeed.tech/tags/consumer.md>), [customers](<https://devfeed.tech/tags/customers.md>), [data](<https://devfeed.tech/tags/data.md>), [data-completeness](<https://devfeed.tech/tags/data-completeness.md>), [database](<https://devfeed.tech/tags/database.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [flink](<https://devfeed.tech/tags/flink.md>), [format](<https://devfeed.tech/tags/format.md>), [framework](<https://devfeed.tech/tags/framework.md>), [generate](<https://devfeed.tech/tags/generate.md>), [generation](<https://devfeed.tech/tags/generation.md>), [hive](<https://devfeed.tech/tags/hive.md>), [icebergs](<https://devfeed.tech/tags/icebergs.md>), [next](<https://devfeed.tech/tags/next.md>), [partition](<https://devfeed.tech/tags/partition.md>), [pinterest](<https://devfeed.tech/tags/pinterest.md>), [spark](<https://devfeed.tech/tags/spark.md>)

## AI overview

Pinterest's streaming ingestion framework restores a reliable "safe to read" signal by deriving partition finalization from event time. The Flink-to-Iceberg sink records per-checkpoint event-time statistics in snapshot metadata, including compact percentile sketches, then computes a watermark from recent commits. Its default uses the minimum event time across a configurable lookback and rounds down to the hour; the watermark never regresses, and late data can trigger an alert. The CDC table stores the watermark as an Iceberg property, which Spark copies to the base table during upserts so downstream jobs can gate processing through metadata sensors. A conservative default favors completeness; tables can use a percentile policy for fresher data while accepting a rare late record. Generic accumulator and commit-processor extensions enable the mechanism in other Flink-to-Iceberg pipelines without extra operators or an external service.

## Source excerpt

Qianrui Zhang | Sr Software Engineer, Logging Platform Kanchi Masalia | Software Engineer II, Stream Processing Platform Liang Mou | Sr Staff Software Engineer, Logging Platform Yi Pan | Principal Engineer, Agent Platform Introduction This is the third post in our series on Pinterest's next-generation database ingestion framework. Part 1 introduced the DB ingestion framework built on Kafka, Flink, Spark, and Iceberg, and Part 2 covered automated schema evolution. This post tackles another challenge in migrating downstream customers to the new ingestion framework: knowing when data is complete enough to read. We'll walk through that data completeness challenge and how we solve it: what "partition finalization" means, why it matters to downstream customers, how we built a unified mechanism to generate partition finalization markers, and how those markers are consumed. We'll also look at how this mechanism generalizes beyond DB ingestion. Background & Motivation Before explaining partition finalization, it helps to define what a partition is and why a downstream consumer cares when one partition is "done." What is a Partition A time partition is a subset of a table whose rows are grouped by a time column, e.g. all rows whose timestamp falls within a given hour. Grouping data this way lets a consumer read just the slice it needs, such as the 1 AM hour, instead of scanning the whole table. How that grouping is physically represented depends on the table format: Hive uses explicit, directory-based partitioning: each partition maps to a physical directory in S3. Iceberg uses hidden partitioning: the partitioning is defined in the metadata layer rather than by directory layout, so consumers don't need to know the physical file layout to query a partition. What Finalization Means Now consider a typical consumer of these tables: a downstream batch job that processes a single hour's partition and runs only once for that hour. The consumer faces the question: when should my job