Resize stateful streaming partitions without losing checkpoints in Databricks
You can now change the number of shuffle partitions in Structured Streaming queries and Lakeflow pipelines without discarding checkpoint state.
O que mudou
On-demand state repartitioning allows you to adjust the number of partitions in stateful streaming queries without losing the checkpoint history. Previously, changing this value required restarting the query from scratch with a new checkpoint directory.
Use cases
Imagine you have a streaming query aggregating IoT data that needs to scale up or down as data volume fluctuates.
- Tune streaming query performance without rebuilding the checkpoint.
- Scale resources to match workload changes.
How to use
Use the spark.sql.streaming.stateStore.partitions configuration to set the new partition count before restarting the query.
# Stop the running query
query.stop()
# Set the new partition count
spark.conf.set("spark.sql.streaming.stateStore.partitions", "100")
# Restart the query with the same options
query = (
df.withWatermark("event_time", "10 minutes")
.groupBy(window("event_time", "5 minutes"), "id")
.count()
.writeStream.format("delta")
.option("checkpointLocation", "/checkpoint/path")
.outputMode("append")
.start()
)
What happens in this code:
- The active query is stopped using the
.stop()method. - The Spark configuration sets the new state partition count.
- The query restarts using the same checkpoint path, automatically applying the repartitioning operation.
Limitations and requirements
- Requires Databricks Runtime 18 LTS or above.
- The query must use the RocksDB state store provider.
- Feature is generally available (GA).
- structured streaming
- lakeflow
- rocksdb
- spark
- streaming
On-demand state repartitioning is now generally available
Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.
Relacionadas
- DatabricksGA
Repositórios de pacotes em nível de workspace para Databricks Apps
Administradores de workspace podem configurar repositórios padrão de pacotes Python e npm para Databricks Apps.
databricks apps · workspace settings - DatabricksAtualização
Google Gemini 4 Argon disponível no Unity Gateway do Databricks
O modelo multimodal Google Gemini 4 Argon já pode ser acessado via Foundation Model APIs e Unity Gateway.
unity catalog · foundation model apis - DatabricksBeta
Databricks AI Runtime SDK substitui o pacote serverless_gpu
O Databricks AI Runtime SDK substitui o pacote obsoleto serverless_gpu nas versões de ambiente GPU 6 e superiores, trazendo novas APIs para treino distribuído.
ai runtime · distributed training