View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004062||SymmetricDS||Bug||public||2019-08-07 09:41||2019-08-09 09:53|
|Target Version||Fixed in Version|
|Summary||0004062: SimpleDateFormat is incompatible with PostgreSql microsecond template|
|Description||FormatUtils uses java.text.SimpleDateFormat, which has no microsecond support. In fact FormatUtils tries to add multiple "s" patterns for milliseconds which are silently discarded.|
This works fine for most DBs but fails for postgres since the DmlStatement templates use "US" which means microseconds. As a result, a postgres generated partial second ".123456" will be deserialized into 123 seconds, 456 milliseconds, extra seconds get carried over into minutes of the resulting date.
|Steps To Reproduce||1. Have a two node cluster where both servers are running postgres.|
2. Configure a test table to have a timestamptz column. Configure NEWER_WINS and use the column as the detect expression.
3. Disconnect the network between the two nodes
4. update the first database with a timestamp, make sure it has a large partial second.
5. quickly update the same row in the second database, make sure it has a small partial second.
6. Reconnect the network
Expected: a conflict is resolved, the second update is kept.
Actual: a conflict is resolved, but the first update is kept.
|Additional Information||Expected workaround was to use date_trunc to remove microsecond resolution from my data, but the PostgreSqlDmlStatement class and PostgreSqlTriggerTemplate use a "US" pattern which causes timestamps in batches to be right padded with zeros.|
|Tags||conflict manager, data type, dialect: postgresql|