I try to remove some data using the thin client data streamer (.NET apache ignite) but i end up with an exception:
DataStreamer can't remove data when AllowOverwrite is false.
My problem is when i try to change AllowOverwrite to true it is not respected.
using Apache.Ignite.Core;
using Apache.Ignite.Core.Client;
IgniteClientConfiguration _configuration = new()
{
Endpoints = new[] { "127.0.0.1:10800" }
};
using (var client = Ignition.StartClient(_configuration))
{
var cache = client.GetOrCreateCache<int, string>("myCache");
using (var dataStreamer = client.GetDataStreamer<int, string>("myCache"))
{
Console.WriteLine($"AllowOverwrite default value: {dataStreamer.Options.AllowOverwrite}");
// Set AllowOverwrite to true
dataStreamer.Options.AllowOverwrite = true;
Console.WriteLine($"AllowOverwrite: {dataStreamer.Options.AllowOverwrite}"); // Set not repected
dataStreamer.Remove(1);
}
}
/*
Results in:
AllowOverwrite default value: False
AllowOverwrite: False
Unhandled exception. Apache.Ignite.Core.Client.IgniteClientException: DataStreamer
can't remove data when AllowOverwrite is false.
at Apache.Ignite.Core.Impl.Client.Datastream.DataStreamerClient`2.Remove(TK key)
*/
Notes:
Any advice as to what I am missing here? Thank you
You are modifying a data streamer after it was created, which is not supported. After the instance is created, you can obtain only a copy of its configuration. Provide the complete configuration on initialization instead:
var options = new DataStreamerClientOptions {AllowOverwrite = false};
using (var streamer = Client.GetDataStreamer<int, object>(cache.Name, options))
{
...
}
I couldn't find any related config to enable this option when starting the server node/s
It's not server configuration, it's only about data steaming.