jroachgolf84 commented on code in PR #67299:
URL: https://github.com/apache/airflow/pull/67299#discussion_r3313076271


##########
airflow-core/docs/administration-and-deployment/state-store.rst:
##########
@@ -0,0 +1,247 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership. The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License. You may obtain a copy of the License at
+
+ ..  http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied. See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _state-store:
+
+State Store Configuration
+==========================
+
+.. versionadded:: 3.3
+
+The state store is the persistence layer for :doc:`task state 
</core-concepts/task-state>` and :doc:`asset state 
</authoring-and-scheduling/asset-state>`. By default, both are stored in the 
Airflow metadata database. This page describes the available configuration 
options, garbage-collection semantics, and how to provide a custom backend.
+
+Configuration reference
+-----------------------
+
+All options live under the ``[state_store]`` section of ``airflow.cfg``.
+
+.. note::
+
+   The config section is ``[state_store]``, **not** ``[task_state]``.
+
+``backend``
+~~~~~~~~~~~
+
+Full dotted path to a class that implements 
:class:`~airflow.sdk.state.BaseStateBackend`. Defaults to the built-in 
metastore backend.
+
+.. code-block:: ini
+
+    [state_store]
+    backend = mypackage.state.CustomStateBackend
+
+``default_retention_days``
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Number of days to retain **task state** rows after their last update. Rows 
older than this are deleted during the next GC pass.
+
+* Set to ``0`` to disable time-based cleanup entirely.
+* Default: ``30``.
+* This setting does **not** apply to asset state rows.
+
+.. code-block:: ini
+
+    [state_store]
+    default_retention_days = 30
+
+``clear_on_success``
+~~~~~~~~~~~~~~~~~~~~
+
+When ``True``, all task state keys for a task instance are automatically 
deleted when that task instance moves to the ``success`` state. Defaults to 
``False``, which preserves task state after success for observability (e.g.the 
submitted job ID or the last row count is still readable from the UI orREST API 
after the run completes).
+
+.. important::
+
+   ``clear_on_success`` clears **task state only**. It has no effect on asset 
state. Asset state is scoped to the asset rather than the task instance and 
must be cleared explicitly.
+
+.. code-block:: ini
+
+    [state_store]
+    clear_on_success = False
+
+``state_cleanup_batch_size``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Number of rows deleted per batch during GC cleanup. Set to ``0`` (default) to 
delete all matching rows in a single statement. Tune this on deployments with 
large ``task_state`` tables to reduce lock contention.
+
+.. code-block:: ini
+
+    [state_store]
+    state_cleanup_batch_size = 10000
+
+Worker-side backend (``[workers] state_backend``)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+A separate, optional config key under ``[workers]`` lets you route task state 
and asset state values through a worker-side backend before they reach the API 
server.
+
+.. code-block:: ini
+
+    [workers]
+    state_backend = mypackage.state.S3StateBackend
+
+When this is set, ``TaskStateAccessor.set()`` calls 
``serialize_task_state_to_ref()`` on the worker-side backend before sending the 
value to the Execution API, and ``get()`` calls 
``deserialize_task_state_from_ref()`` after receiving the stored reference. See 
`Custom worker-side backends`_ below.

Review Comment:
   Committed locally.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to