ephraimbuddy commented on code in PR #56476:
URL: https://github.com/apache/airflow/pull/56476#discussion_r2415263916


##########
airflow-core/src/airflow/models/serialized_dag.py:
##########
@@ -410,7 +429,12 @@ def write_dag(
                 return False
 
         log.debug("Checking if DAG (%s) changed", dag.dag_id)
+
+        serialized_json = cls.serialize_dag(dag)
         new_serialized_dag = cls(dag)
+        new_serialized_dag._data = serialized_json
+        new_serialized_dag.dag_hash = 
hashlib.sha1(serialized_json.encode()).hexdigest()

Review Comment:
   The data persisted in the table is not sorted but the hash is sorted. 
Storing a sorted data in the DB would result in a unwanted behavior in other 
places. We shouldn’t sort the data we save, we should sort the data and get the 
hash but not sort what we save. 
   
   I can’t remember the issue i got from storing the sorted data into the db 
but there were issues. 
   
   My suggestion is to refine the sorting we have but not store sorted data 
into db. It’s of no use



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