amoghrajesh commented on code in PR #77435:
URL: https://github.com/apache/airflow/pull/77435#discussion_r4676105106


##########
providers/common/io/src/airflow/providers/common/io/state_store/backend.py:
##########
@@ -47,7 +47,14 @@
 
 @cache
 def _get_base_path() -> ObjectStoragePath:
-    return ObjectStoragePath(conf.get_mandatory_value(SECTION, 
"state_store_objectstorage_path"))
+    path = conf.get_mandatory_value(SECTION, "state_store_objectstorage_path")
+    # _is_storage_ref only recognises URLs, so a schemeless ref would be 
parsed as JSON on read.
+    if not urlsplit(path).scheme:

Review Comment:
   Moved `_get_base_path()` out of the try in `_is_storage_ref, so reads raise 
the same error. Added a test for both `deserialize_*_from_ref` methods with 
paths that have no scheme.



##########
providers/common/io/docs/changelog.rst:
##########
@@ -26,6 +26,10 @@ Changelog
 ---------
 
 .. note::
+    ``StateStoreObjectStorageBackend`` now raises ``ValueError`` when 
``[common.io] state_store_objectstorage_path``
+    has no URL scheme (for example ``/tmp/task-state``). Before, large values 
were written but reading them back
+    failed with ``JSONDecodeError``. Set the path to a URL such as 
``s3://conn_id@bucket/task-state``, or
+    ``file:///path/to/task-state`` for local storage.

Review Comment:
   Done



-- 
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