Skip to content

Commit

Permalink
FIX: Empty concurrency exception (#1692)
Browse files Browse the repository at this point in the history
* Improved logging of concurrency exception 
* Added null->empty string awareness, list changes even when an event workflow changes the data (before rollbacking the change), excluded data structure fields from fields causing marking a record as updated.
Co-authored-by: Vaclav Urbanek <vaclav.urbanek@advantages.cz>
  • Loading branch information
urbanekv authored Jul 3, 2023
1 parent 0b481ba commit 0696781
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
22 changes: 12 additions & 10 deletions backend/Origam.DA.Service/AbstractSqlDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,15 @@ var stringWriter
query.SortSetId,
query.DefaultSetId);
}
if(newTransaction)
{
var errorString = ComposeConcurrencyErrorMessage(userProfile,
dataset, transactionId, currentEntityName, lastTableName,
ex);
if (newTransaction)
{
ResourceMonitor.Rollback(transactionId);
transactionId = null;
}
var errorString = ComposeConcurrencyErrorMessage(userProfile,
dataset, transactionId, currentEntityName, lastTableName,
ex);

// log before throw (because there are some place(s)
// where the exception isn't caught
if(concurrencyLog.IsDebugEnabled)
Expand Down Expand Up @@ -799,8 +800,8 @@ IDataEntityColumn describingField
{
continue;
}
var storedValue = "";
var myValue = "";
string storedValue = null;
string myValue = null;
if(!storedRow.IsNull(column.ColumnName))
{
storedValue = storedRow[column.ColumnName]
Expand All @@ -811,7 +812,8 @@ IDataEntityColumn describingField
myValue = row[column, DataRowVersion.Original]
.ToString();
}
if(storedValue.Equals(myValue))
if(storedValue != null && storedValue.Equals(myValue)
|| (storedValue == null && myValue == null))
{
continue;
}
Expand Down Expand Up @@ -843,9 +845,9 @@ var lookupId
+ "- "
+ column.Caption
+ ": "
+ myValue
+ (myValue ?? "null")
+ " > "
+ storedValue;
+ (storedValue ?? "null");
}
}
while(row.Table.ParentRelations.Count > 0)
Expand Down
8 changes: 6 additions & 2 deletions backend/Origam.DA.Service/Generators/DatasetGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,14 @@ private DataSet CreateDataSet(DataStructure ds, bool includeCalculatedColumns,
tableColumn.ExtendedProperties.Add(Const.OrigamDataType, finalDataType);
tableColumn.ExtendedProperties.Add(Const.FieldId, finalColumn.Id);
switch(column.Field)
{
{
// mark column as a database field if the entity column
// is of type FieldMappingItem and the datastructure column
// doesn't have 'UseLookupValue' set (read-only datastructure lookups
// aren't saveable so they aren't actually database fields)
case FieldMappingItem _:
tableColumn.ExtendedProperties.Add(
Const.IsDatabaseField, true);
Const.IsDatabaseField, !column.UseLookupValue);
break;
case DetachedField detachedField
when detachedField.DataType == OrigamDataType.Array:
Expand Down

0 comments on commit 0696781

Please sign in to comment.