Skip to content

4.0.9

Latest

Choose a tag to compare

@github-actions github-actions released this 15 Nov 16:14
· 5 commits to master since this release

SyncChanges 4.0

Breaking changes

  • .NET 10. The console app and the service now target net10.0, instead of net6.0 and net461. The library targets netstandard2.0 and net10.0.
  • The service runs on .NET 10. The InstallUtil installer is gone. Install the service with the new SyncChanges.Service install / uninstall commands, or with sc.exe.
  • The console app and the service are now dotnet tools.
    • dotnet tool install -g SyncChanges.Console installs the console app, which runs as SyncChanges.
    • dotnet tool install -g SyncChanges.Service installs the service, which runs as SyncChanges.Service.
    • Both roll forward to later .NET versions. The release zips are still published.
  • Where the service keeps its files.
    • Installed as a tool, the service reads its configuration from %ProgramData%\SyncChanges. Installed from the zip, it reads it from the executable's folder. --config points to another file.
    • The log is written next to the configuration.
  • Where the console app logs. Installed as a tool, the console app logs to %LocalAppData%\SyncChanges. An NLog.config in the current folder replaces the default one.

Performance

  • Batched statements. Statements go to destination databases in batches of up to BatchSize (default 100) instead of one round trip per change. Set it with -b/--batchsize or in the configuration.
  • Query plans are reused. Statements now run through sp_executesql with stable text and parameter types, so SQL Server compiles each plan once.
  • RPC batching on .NET 10. Statements are sent as SqlBatch RPC calls. In a benchmark of 53,273 changes, replication went from 553 s to 18 s.
  • Faster foreign-key pre-pass. It now uses an index lookup, so its cost no longer grows with the square of the number of changes.

New features

  • More settings in the configuration file. Timeout, interval, batch size and dry run can now be set in the configuration file, for all replication sets.
    • For the service, config.json takes precedence over SyncChanges.Service.dll.config, so existing installations keep working.
    • Command-line options of the console app override the configuration file.
  • Progress logging. Every 10 seconds the log shows the changes replicated so far, the percent done and an estimated completion time.
  • Prompt cancellation. Stopping cancels the running SQL command and rolls back the destination. There is a new Sync(CancellationToken) overload, and the loop no longer waits out the rest of the interval.
  • SyncEventArgs.Success. Synced is also raised when a replication set fails, and this property tells the two cases apart.

Fixes

  • Inserts that reference later inserts. Such an insert now waits until just after the row it references is inserted, instead of the foreign key being disabled. A disabled foreign key held a schema-modification lock for the whole transaction.
    • Where the key still has to be disabled (updates, and inserts that reference each other in a cycle), it is re-enabled with check once per pass.
  • Rows inserted, referenced and then updated no longer fail on the foreign key.
  • Deletes are ordered for foreign keys. A delete of a referenced row moves after the changes to the rows that reference it.
  • Identity columns are no longer set in updates, unless they are part of the key.
  • Matching like SQL Server collations.
    • Foreign-key values are matched without regard to case and trailing spaces, and binary values by their bytes.
    • Configured table names are matched without regard to case, with or without schema and brackets.
  • Tables with only key columns no longer produce invalid UPDATE SQL.
  • rowversion and GENERATED ALWAYS columns (for example temporal period columns) are no longer replicated.
  • Object names containing ] are now quoted correctly (via quotename()).
  • Index included columns are no longer treated as part of unique constraints.
  • Typed values.
    • datetime2 values keep their full precision.
    • Binary nulls are always sent typed.
  • Replication sets.
    • A set that fails to initialize in a loop no longer shifts the tables of later sets.
    • Errors of earlier sets are no longer reset by later ones.
  • Console app. It now loops all configuration files concurrently, with a single Ctrl+C handler.
  • Service.
    • Configuration errors now fail the start instead of crashing the process.
    • The service stops if its loop fails.
    • It requests extra time from the service control manager while stopping.
  • Synchronizer.DryRun docs described the opposite of what the setting does; they are corrected.

Dependencies and build

  • Microsoft.Data.SqlClient 7.1.2 on net10.0 (5.2 on netstandard2.0). The Azure libraries are no longer shipped with the service.
  • NPoco 6.5.0, NLog 6.2.2, Humanizer.Core 3.0.10. System.Configuration.ConfigurationManager and System.ServiceProcess.ServiceController 11.0.0.
  • CI moved from AppVeyor to GitHub Actions, and NuGet packages are published with trusted publishing.
  • Package metadata now uses PackageLicenseExpression and an https repository URL.