Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DData: if lmdb.dir is null or empty, log a warning and set to default #7292

Merged
merged 4 commits into from
Jul 22, 2024

Conversation

Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Jul 22, 2024

Changes

DData: if lmdb.dir is null or empty, log a warning and set to default. Should address some NullReferenceException issues that occured when the following HOCON was set:

akka.cluster.distributed-data.durable.lmdb.dir = "shard-data"

Reported Exception:

[15:53:33 ERR] Stopping distributed-data Replicator due to load or startup failure in durable store, caused by: Exception during creation
[akka://cluster-system/system/sharding/replicator/durableStore#713307088]: Akka.Actor.ActorInitializationException: Exception during creation
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Akka.DistributedData.LightningDB.LmdbDurableStore.PreStart()
   at Akka.Actor.ActorBase.AroundPreStart()
   at Akka.Actor.ActorCell.<>cDisplayClass175_0.<Create>b0()
   at Akka.Actor.ActorCell.UseThreadContext(Action action)
   at Akka.Actor.ActorCell.Create(Exception failure)
   --- End of inner exception stack trace -

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

@Aaronontheweb Aaronontheweb added configuration akka-ddata-durable LMDB implementation for persisting durable data labels Jul 22, 2024
@Aaronontheweb Aaronontheweb added this to the 1.5.27 milestone Jul 22, 2024
Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detailed my changes

@@ -166,7 +171,7 @@ private void Active()
else
{
if (_pending.Count > 0)
Context.System.Scheduler.ScheduleTellOnce(_writeBehindInterval, Self, WriteBehind.Instance, ActorRefs.NoSender);
Timers.StartSingleTimer("write-behind", WriteBehind.Instance, _writeBehindInterval);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve AK1004 warning

@@ -84,6 +83,12 @@ public LmdbDurableStore(Config config)

_path = _config.GetString("dir");

if (string.IsNullOrEmpty(_path))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do quick null check and the log the warning so the user knows that there's something off with their configuration, but then make the system work using its normal defaults afterwards

Copy link
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Arkatufus Arkatufus enabled auto-merge (squash) July 22, 2024 19:16
@Arkatufus Arkatufus merged commit d3b3613 into akkadotnet:dev Jul 22, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
akka-ddata-durable LMDB implementation for persisting durable data configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants