Comments (5)
In my database, I use Character Set : utf8mb4 and Collation : utf8mb4_general_ci.
When I change Collation to utf8mb4_unicode_ci, the problem is gone.
Now I am able to sync locally or via web server.
from dotmim.sync.
Hello @anthtoonaing
You are using Mariadb as the server side (if I understand correctly)
What db engine are you using on the client side ?
from dotmim.sync.
I am using MariaDB on client and server side. schema are exactly the same.
from dotmim.sync.
Dotmim.Sync.SyncException: [InternalProvisionClientAsync].Provision:Table, TrackingTable, StoredProcedures, Triggers.Overwrite:False..[InternalProvisionAsync].Provision:Table, TrackingTable, StoredProcedures, Triggers.Overwrite:False..[InternalCreateTrackingTableAsync].Table:companies..BLOB/TEXT column 'id' used in key specification without a key length
---> MySqlConnector.MySqlException (0x80004005): BLOB/TEXT column 'id' used in key specification without a key length
at MySqlConnector.Core.ServerSession.ReceiveReplyAsyncAwaited(ValueTask`1 task) in /_/src/MySqlConnector/Core/ServerSession.cs:line 964
at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 175
at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 133
at MySqlConnector.MySqlDataReader.CreateAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 493
at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList`1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 77
at MySqlConnector.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 304
at Dotmim.Sync.BaseOrchestrator.InternalCreateTrackingTableAsync(ScopeInfo scopeInfo, SyncContext context, DbTableBuilder tableBuilder, DbConnection connection, DbTransaction transaction, CancellationToken cancellationToken, IProgress`1 progress)
at Dotmim.Sync.BaseOrchestrator.InternalCreateTrackingTableAsync(ScopeInfo scopeInfo, SyncContext context, DbTableBuilder tableBuilder, DbConnection connection, DbTransaction transaction, CancellationToken cancellationToken, IProgress`1 progress)
--- End of inner exception stack trace ---
at Dotmim.Sync.SyncAgent.SynchronizeAsync(String scopeName, SyncSetup setup, SyncType syncType, SyncParameters parameters, CancellationToken cancellationToken, IProgress`1 progress)
at Dotmim.Sync.SyncAgent.SynchronizeAsync(String scopeName, SyncSetup setup, SyncType syncType, SyncParameters parameters, CancellationToken cancellationToken, IProgress`1 progress)
at IV.DataSyncAgent.Worker.<>c__DisplayClass7_0.<<StartAsync>b__0>d.MoveNext() in D:\projs5\saysaing\apps\DataSync\IV.DataSyncAgent\Workers.cs:line 55
This is exception.
from dotmim.sync.
internal class Worker: BackgroundService {
private readonly ILogger<Worker> _logger;
private readonly AppSettings _settings;
private System.Timers.Timer? _syncTimer;
private SyncAgent? _syncAgent;
private int _syncing = 0;
public Worker(ILogger<Worker> logger, AppSettings settings) {
_logger = logger;
_settings = settings;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken) {
}
public override async Task StartAsync(CancellationToken cancellationToken) {
_logger.Log(LogLevel.Information, "Service Start");
if (string.IsNullOrWhiteSpace(_settings.Tables)) {
_logger.Log(LogLevel.Information, "No tables to sync");
return;
}
if (string.IsNullOrWhiteSpace(_settings.ServerConnectionString) && string.IsNullOrWhiteSpace(_settings.RemoteOrchestratorUrl)) {
_logger.Log(LogLevel.Information, "No server to sync");
return;
}
if (string.IsNullOrWhiteSpace(_settings.ClientConnectionString)) {
_logger.Log(LogLevel.Information, "No client to sync");
return;
}
var options = new SyncOptions();
var remoteOrchestrator = CreateRemoteOrchestrator(options);
var localOrchestrator = CreateLocalOrchestrator(remoteOrchestrator.Options);
var tables = _settings.Tables.Split(",");
if (tables.Length > 0 && tables.All(t => t.Length > 0)) {
_syncAgent = new SyncAgent(localOrchestrator, remoteOrchestrator);
_syncTimer = new System.Timers.Timer(_settings.SyncInterval * 1000);
_syncTimer.Elapsed += async (s, e) => {
if (0 == Interlocked.Exchange(ref _syncing, 1)) {
try {
_logger.Log(LogLevel.Information, "Sync starts");
var setup = new SyncSetup(tables);
var result = await _syncAgent.SynchronizeAsync(setup);
if (result != null) {
_logger.Log(LogLevel.Information, result.ToString());
}
_logger.Log(LogLevel.Information, "Sync ends");
}
catch(Exception ex) {
_logger.Log(LogLevel.Error, ex.ToString());
}
finally {
Interlocked.Exchange(ref _syncing, 0);
}
}
};
_syncTimer.AutoReset = true;
_syncTimer.Enabled = true;
}
else {
_logger.Log(LogLevel.Information, "Invalid table names");
}
}
public override async Task StopAsync(CancellationToken cancellationToken) {
await base.StopAsync(cancellationToken);
_logger.Log(LogLevel.Information, "Service Stop");
}
public override void Dispose() {
base.Dispose();
if (_syncTimer != null) {
_syncTimer.Stop();
_syncTimer.Dispose();
}
if(_syncAgent != null) {
_syncAgent.Dispose();
}
}
private RemoteOrchestrator CreateRemoteOrchestrator(SyncOptions options) {
if (!string.IsNullOrEmpty(_settings.ServerConnectionString)) {
var remoteProvider = new MariaDBSyncProvider(_settings.ServerConnectionString);
var remoteOrchestrator = new RemoteOrchestrator(remoteProvider, options);
return remoteOrchestrator;
}
else {
var remoteOrchestrator = new WebRemoteOrchestrator(_settings.RemoteOrchestratorUrl);
remoteOrchestrator.HttpClient.Timeout = TimeSpan.FromMinutes(15);
return remoteOrchestrator;
}
}
private LocalOrchestrator CreateLocalOrchestrator(SyncOptions options) {
var clientProvider = new MariaDBSyncProvider(_settings.ClientConnectionString);
var localOrchestrator = new LocalOrchestrator(clientProvider, options);
return localOrchestrator;
}
}
This is my code.
from dotmim.sync.
Related Issues (20)
- Restoring SQL Server backup and sync
- Force sync in particular direction regardless? HOT 2
- SynchronousProgress<T> in WinUI 3/AppSdk app: The send method is not supported, use Post instead. HOT 1
- SQLLocalDB Supported? HOT 5
- [InternalProvisionClientAsync].Provision:Table, TrackingTable, StoredProcedures, Triggers.Overwrite:False HOT 1
- Error: Procedure or function expects parameter which was not supplied.. HOT 14
- Invalid column name issues HOT 1
- Issue with Redundant Data Transfer in Dotmim.Sync HOT 5
- serverProvider (Remote) Read Only HOT 2
- Speed up tests HOT 1
- Use ConfigureAwait(false) everywhere
- Turn on reproducible builds
- Turn on nuget lockfiles and LockedMode HOT 1
- Add Package Validation
- Speed up pipelines
- Support SQLite server-side HOT 2
- Investigate using the CRDT data structure HOT 3
- Field not synced - help HOT 1
- Timeout Issue and Foreign Keys and Unique Constraint bypass HOT 8
- Database Sync Error with SQL Server HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotmim.sync.