controller.git
11 hours agoRename JournalSegmentDescriptor 61/116461/3
Robert Varga [Tue, 6 May 2025 08:53:05 +0000 (10:53 +0200)]
Rename JournalSegmentDescriptor

SegmentDescriptor is not directly related to Journal. Rename it to
SegmentDescriptor.

JIRA: CONTROLLER-2137
Change-Id: I91e6f1c6872a5955470c20a13a33758387c139e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 hours agoEliminate journal.index package 60/116460/2
Robert Varga [Tue, 6 May 2025 08:39:59 +0000 (10:39 +0200)]
Eliminate journal.index package

JournalIndex is a misnomer, it really should be SegmentIndex.

JIRA: CONTROLLER-2137
Change-Id: If8508fa24bf8ca154c0cc38aa12fa8e869450823
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
30 hours agoRename JournalSegment{Reader,Writer} 39/116439/1
Robert Varga [Mon, 5 May 2025 16:19:00 +0000 (18:19 +0200)]
Rename JournalSegment{Reader,Writer}

Drop the connection to Journal, as this is about being segmented, not
being part of storage.journal.Journal.

JIRA: CONTROLLER-2137
Change-Id: I3a1879506a3ee93bfa960bf10c7238964f5c19e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
30 hours agoRename JournalSegmentFile 38/116438/1
Robert Varga [Mon, 5 May 2025 16:11:09 +0000 (18:11 +0200)]
Rename JournalSegmentFile

Let's drop the 'Journal' prefix, as it implies it has something to do
with 'Journal', where it fact it is tied to Segment.

JIRA: CONTROLLER-2137
Change-Id: I8a1c0c122ae875d0997808ee6bc0e40bbee8ab16
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
30 hours agoRename JournalSegment 37/116437/1
Robert Varga [Mon, 5 May 2025 16:01:16 +0000 (18:01 +0200)]
Rename JournalSegment

There may be a confusion as to where this class belongs. It really is
part of SegmentedRaftJournal, so let's drop the 'Journal' prefix, so it
does not get confused with storage.Journal.

JIRA: CONTROLLER-2137
Change-Id: Iaf57876baea1ee1a5ae28f9fd9a69377e05c1ed2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
34 hours agoRename SegmentedByteBuf{Journal,Reader,Writer} 35/116435/1
Robert Varga [Mon, 5 May 2025 12:36:38 +0000 (14:36 +0200)]
Rename SegmentedByteBuf{Journal,Reader,Writer}

Use SegmentedRaftJournal, SegmentedEntryReader, SegmentedEntryWriter, as
those names are consistent with what we are implementing.

CONTROLLER-2137
Change-Id: I4f01c9aee9107ace059adb1e233009ac25dda7f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
39 hours agoAdd StateMachineCommand.toSerialForm() 47/116247/8
Robert Varga [Mon, 14 Apr 2025 08:39:27 +0000 (10:39 +0200)]
Add StateMachineCommand.toSerialForm()

raft.messages.Payload is providing a serialization bridge, which is
forcing a writeReplace() operation. Formalize this capability as
something inherent to a command, providing a handle on serial form
distinct from the originating object.

JIRA: CONTROLLER-2137
Change-Id: I364b64c636216e5e7df7c7692782c199b87509fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 days agoDrop correct message class 77/116377/1
Robert Varga [Tue, 29 Apr 2025 08:42:43 +0000 (10:42 +0200)]
Drop correct message class

We have switch from String to CommitMessage a long time ago, fix the
test to reflect that.

Change-Id: I71a8cb12dfd647c5be00d19c406932a712af67ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 days agoRename ClusterConfig to VotingConfig 27/116327/4
Robert Varga [Tue, 22 Apr 2025 11:02:25 +0000 (13:02 +0200)]
Rename ClusterConfig to VotingConfig

Voting configuration is optional and the command itself has different
lifecycle rules than other entries.

Rename the class to VotingConfig, adjusting all reference and naming,
as when we get to expand our server configuration, we will use a
separate command.

JIRA: CONTROLLER-2134
Change-Id: Ibf6b1a806e34b67e916565e424a9697d18aa0f2a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMove index/term query methods 29/116329/2
Robert Varga [Tue, 22 Apr 2025 20:51:59 +0000 (22:51 +0200)]
Move index/term query methods

getLogEntry{Index,Term} et al are inherently derived from ReplicatedLog.
Move them there as default methods, reducing the number of lookups by
reusing ReplicatedLog reference.

JIRA: CONTROLLER-2134
Change-Id: I2cfcb96227f55b6b2f1f9f6165fcb10a807fce80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSplit out RaftActorRecovery 80/116280/7
Robert Varga [Wed, 16 Apr 2025 17:34:35 +0000 (19:34 +0200)]
Split out RaftActorRecovery

RaftActorRecoverySupport is a one-shot object which we use to
encapsulate the behaviour during recovery.

Enrich the recovery process by consulting SnapshotStore.lastSnapshot()
and allowing it to override snapshots coming from Pekko.

JIRA: CONTROLLER-2134
Change-Id: I559ad59cfdb793f624873445fd9eb8fcdc81d657
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump upstreams 95/116295/4
Robert Varga [Sat, 19 Apr 2025 18:19:43 +0000 (20:19 +0200)]
Bump upstreams

Adopt:
- odlparent-14.0.9
- yangtools-14.0.13
- mdsal-14.0.12

Change-Id: I9f0794e8f6a2ed46bc287f168bfca130315ad490
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSplit out RaftCallback 78/116278/4
Robert Varga [Wed, 16 Apr 2025 16:48:21 +0000 (18:48 +0200)]
Split out RaftCallback

We will need a similar interface for EntryStore, so let's promote it to
RaftCallback.

JIRA: CONTROLLER-2137
Change-Id: I64edf2c3a9b95f8286a426c2b2bca63447ae0791
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSplit persistAsync() 77/116277/5
Robert Varga [Wed, 16 Apr 2025 16:31:36 +0000 (18:31 +0200)]
Split persistAsync()

We have final two cases: it is either a ReplicatedLogEntry or a
ClusterConfig. Split those two methods out, so we can properly
specialize.

JIRA: CONTROLLER-2137
Change-Id: Id3853d10a39592309b91e78af3f07c62166e56b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSplit out EntryStore.markLastApplied() 66/116266/12
Robert Varga [Tue, 15 Apr 2025 00:02:32 +0000 (02:02 +0200)]
Split out EntryStore.markLastApplied()

Rather than going to through an async message, mark the last applied
index through persistence.

This eliminate one of the possibilities for persistAsync() and also
reduces latency and improves accuracy.

Since we are no longer sending ApplyJournalEntries to self, we also need
to switch tests to synchronize on applyIndex instead.

JIRA: CONTROLLER-2137
Change-Id: Id5aa178aa721b5086163d7b721b9447b80724d7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoReduce ReplicatedLogEntry proliferation 33/116233/5
Robert Varga [Fri, 11 Apr 2025 13:05:39 +0000 (15:05 +0200)]
Reduce ReplicatedLogEntry proliferation

We just need to the basic view into commands, not much else. Use
LogEntry instead.

JIRA: CONTROLLER-2137
Change-Id: I8ad67f2d1ba925538cf70e0ada20fbe2aa5a1006
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMigrate tests to JUnit5 75/116275/1
Robert Varga [Wed, 16 Apr 2025 09:08:10 +0000 (11:08 +0200)]
Migrate tests to JUnit5

Migrate a few standalone tests.

Change-Id: Ic0afeddb17eee6eb8f1f772658884f978c8ffce4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRename MockReplicatedLogBuilder 73/116273/1
Robert Varga [Tue, 15 Apr 2025 16:23:35 +0000 (18:23 +0200)]
Rename MockReplicatedLogBuilder

We no longer have a globally-visible Builder, it is okay to use a short
name.

Change-Id: I80a957c322113f5c8311c0f6b974c5ff14b8fb3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoPersistence is an recovery-time invariant 72/116272/1
Robert Varga [Tue, 15 Apr 2025 16:20:23 +0000 (18:20 +0200)]
Persistence is an recovery-time invariant

RaftActorRecoverySupport really has two modes of operation and those do
not change, so let's make that a simple boolean.

JIRA: CONTROLLER-2134
Change-Id: I29682248eb340b49ff98f8bad427bf550bc84783
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSplit out storage access methods 71/116271/2
Robert Varga [Tue, 15 Apr 2025 15:36:23 +0000 (17:36 +0200)]
Split out storage access methods

Separate out the three concerns:
- recovery applicable
- EntryStore
- SnapshotStore
into separate accessor methods, so that it becomes clearer what piece of
code is talking to whom.

JIRA: CONTROLLER-2137
Change-Id: Ied980bab3b6c9538a445f5fab21c91f516207fa5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFixup EnabledRaftStorage 70/116270/1
Robert Varga [Tue, 15 Apr 2025 12:42:24 +0000 (14:42 +0200)]
Fixup EnabledRaftStorage

We missed a javadoc warning, fix that up.

JIRA: CONTROLLER-2137
Change-Id: I89a70d435d3de2261ef4a700418c2913e99d0e2d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRefactor PekkoPersistenceContract a bit 67/116267/2
Robert Varga [Tue, 15 Apr 2025 00:09:45 +0000 (02:09 +0200)]
Refactor PekkoPersistenceContract a bit

Do not imply Serializable, making the marker simpler and allowing its
use with serialization proxies.

JIRA: CONTROLLER-2137
Change-Id: I4f9ac3e3b807653c52da299fe71ce9514516bdbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSplit persist() into two methods 65/116265/1
Robert Varga [Mon, 14 Apr 2025 22:03:51 +0000 (00:03 +0200)]
Split persist() into two methods

Generic nature of persist() is a tad misused in PersitenceControl --
normally we only persist ReplicatedLogEntries.

Introduce persistEntry() for for user by callers, with persistConfig()
being split into EnabledRaftStorage only.

JIRA: CONTROLLER-2137
Change-Id: I2bf79977b4e4b1b2f4debab0eb11bdc7fb9932c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSplit out DeleteEntries handling 64/116264/1
Robert Varga [Mon, 14 Apr 2025 17:57:13 +0000 (19:57 +0200)]
Split out DeleteEntries handling

ReplicateLog is using persist(DeleteEntries) to talk directly to Pekko
peristence to undo effects of previous persist(ReplicatedLogEntry)
calls.

Document this use and introduce an explicit
ReplicatedLog.trimToReceive() method instead of the confusing
removeFrom() and removeFromAndPersist() methods.

removeFrom() is called from tests and recovery only. It is renamed to
removeRecoveredEntries() called only from recovery. The implementation
is moved into AbstractReplicatedLog as a package-private method, with
more performant implementation. Tests now use another version of
clear().

removeFromAndPersist() is renamed to trimToReceive() and documented to
be called from Follower only. It is also marked for future evolution,
as it should contain essentially all of Follower.processAppendEntries().

Since this is the second construct we will be removing with Pekko
persiistence, add a common marker interface: PekkoPersistenceContract
implemented by both DeleteEntries and UpdateElectionTerm.

JIRA: CONTROLLER-2137
Change-Id: Iebe42d7f8ae82714b390ecbd0b51d75a78cc54a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoAdd a FIXME to not narrow the index 63/116263/1
Robert Varga [Mon, 14 Apr 2025 17:54:44 +0000 (19:54 +0200)]
Add a FIXME to not narrow the index

All callers end up checking the result against size(), so we really
should be preserving 'long' and let users deal with the fallout.

Change-Id: I27a57bcd73ba29e40e5e318fa834cd9a4ba94ca6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSimplify entry serialization 46/116246/1
Robert Varga [Sun, 13 Apr 2025 15:01:24 +0000 (17:01 +0200)]
Simplify entry serialization

So not use SerializationUtils for DataOutputStream/IOException wrapping.
We can do both, and for the latter we can use java.io.UncheckedIOException,
which is nicer than SerializationException.

Change-Id: Ic04bbdb3dbb34bcc49f49036f0b04df9c37781f5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoIsolate Pekko Snapshotter methods in RaftActor 45/116245/1
Robert Varga [Sun, 13 Apr 2025 13:19:31 +0000 (15:19 +0200)]
Isolate Pekko Snapshotter methods in RaftActor

RaftActor is an abstract class, which leaks Snapshotter interface to
users. Override methods to mark them as deprecated and provide internal
methods to route to Pekko.

JIRA: CONTROLLER-2134
Change-Id: Iad9240562c44dceec9028b79f0b1c886bdca8f83
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSimplify appendReceived() signature 32/116232/1
Robert Varga [Fri, 11 Apr 2025 10:42:12 +0000 (12:42 +0200)]
Simplify appendReceived() signature

We only need the appended entry (for now), perhaps at some point not
even that. Simplify the metehod signature and add some documentation
about what is going on.

JIRA: CONTROLLER-2137
Change-Id: Ida272793dee645ffba571185b1ccb127a06d380d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoUpdate applyRecoverySnapshot() 28/116228/2
Robert Varga [Fri, 11 Apr 2025 01:05:56 +0000 (03:05 +0200)]
Update applyRecoverySnapshot()

We should be receiving an plain SnapshotState here, so that we are
disconnected from serialization details.

JIRA: CONTROLLER-2134
Change-Id: I70028cae9b133143e05753327cf5817fd628061a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSplit ReplicatedLog.appendAndPersist() 22/116222/2
Robert Varga [Thu, 10 Apr 2025 20:37:30 +0000 (22:37 +0200)]
Split ReplicatedLog.appendAndPersist()

We have two distinct callers, making the resulting methods simpler and
making the on-follower case a tad more useful.

JIRA: CONTROLLER-2137
Change-Id: Idc1dd3aaa397209db10258d60471789e2bd04ba4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoUpdate RaftActorRecoveryCohort 21/116221/2
Robert Varga [Thu, 10 Apr 2025 18:15:10 +0000 (20:15 +0200)]
Update RaftActorRecoveryCohort

The cohort should not a full Payload: it only needs to see
StateCommands -- which is the point behind a FIXME in
RaftActorRecoverySupport.

Adjust name to applyRecoveredCommand() and propagate the type
information outwards.

JIRA: CONTROLLER-2137
Change-Id: I07e1b2dcaa349a2d60d6654dc83656f013aad45e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoAdd ReplicatedLog.lookupStoredMeta() 20/116220/1
Robert Varga [Thu, 10 Apr 2025 16:58:42 +0000 (18:58 +0200)]
Add ReplicatedLog.lookupStoredMeta()

AbstractLeader does not need the full ReplicatedLogEntry, it just needs
its metadata with a durability flag.

Eliminate a caller for ReplicateLog.get() with a dedicated method
needing only EntryMeta.

Since we are in the area, turn a TODO in consensus reaching into a FIXME
we a better analysis.

JIRA: CONTROLLER-2137
Change-Id: Ifa593ddfefcf3015502e8b42e30c37afb85768de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove FollowerLogInformation.incrMatchIndex() 19/116219/1
Robert Varga [Thu, 10 Apr 2025 16:42:44 +0000 (18:42 +0200)]
Remove FollowerLogInformation.incrMatchIndex()

This method is completely unused, remove it to simplify reasoning about
its value.

Change-Id: Ibf43a0d6ac47676b20a4fd39c54b1a9bcf2a60e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoDocument ISE exception 18/116218/1
Robert Varga [Thu, 10 Apr 2025 14:08:56 +0000 (16:08 +0200)]
Document ISE exception

We are about to expand the exceptions being thrown here, document
current contract first.

Change-Id: If70bb8e494de3b1b93049d7594cf9549e4e587ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoReport IOException from EntryWriter.flush() 17/116217/1
Robert Varga [Thu, 10 Apr 2025 14:00:03 +0000 (16:00 +0200)]
Report IOException from EntryWriter.flush()

A flush operation may fail, let's make sure users are aware of that.

JIRA: CONTROLLER-2137
Change-Id: Ia01bcbd79e47897e94a1fa640d9af66ade590bf8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove flushOnCommit 10/116210/2
Robert Varga [Thu, 10 Apr 2025 11:38:29 +0000 (13:38 +0200)]
Remove flushOnCommit

We are not using the flush-on-commit capability. Since it introduces a
potential error path, let's drop it.

JIRA: CONTROLLER-2137
Change-Id: Icc81c41e82c04fd9e518731a90a3d17333f6661f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoPass last segment to SegmentedByteBufWriter 09/116209/2
Robert Varga [Thu, 10 Apr 2025 11:24:19 +0000 (13:24 +0200)]
Pass last segment to SegmentedByteBufWriter

lastSegment() is a potentially-failing operation, so let's skip it by
passing the segment, as we have just acquired it.

JIRA: CONTROLLER-2137
Change-Id: I1ea35cdaf27ef1a7a208ad19bacdb684f0c69bcb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoPropagate SegmentedByteBufJournal.close() 82/116182/2
Robert Varga [Tue, 8 Apr 2025 13:32:45 +0000 (15:32 +0200)]
Propagate SegmentedByteBufJournal.close()

SegmentedByteBufWriter holds a reference to the segment at which it
positioned, retaining the backing FileWriter.

Make sure clear that reference when SegmentedByteBufJournal is closed,
allowing the backing buffer to be released.

JIRA: CONTROLLER-2139
Change-Id: I935fff007c30c598ea47af1fe20cb69e32f9eeb8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRelease FileWriter for inactive JournalSegments 81/116181/2
Robert Varga [Tue, 8 Apr 2025 13:08:36 +0000 (15:08 +0200)]
Release FileWriter for inactive JournalSegments

In the DiskAccess case, the FileWriter holds on to its backing buffer,
which means we need to release() it when we switch to being inactive.

JIRA: CONTROLLER-2139
Change-Id: I02a40b32eee243f4ab31a213a669794459bf6399
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoInline checkState() calls 08/116208/1
Robert Varga [Thu, 10 Apr 2025 10:04:30 +0000 (12:04 +0200)]
Inline checkState() calls

We do not really need these, inline them to explicit throws.

Change-Id: I9a3a5e6881b5b9ad0b58b08030f3fac329809d46
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoImprove SegmentedByteBufJournal.loadSegments() 07/116207/1
Robert Varga [Thu, 10 Apr 2025 09:30:49 +0000 (11:30 +0200)]
Improve SegmentedByteBufJournal.loadSegments()

Combine initialization so that we do not re-index existing entries.
Also sprinkle a few @NonNull annotations.

JIRA: CONTROLLER-2137
Change-Id: I1ec44a3b645e5bf64cefdc3e6cbb918d21c51ad3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoDo not mask IOException JournalSegment constructor 06/116206/1
Robert Varga [Thu, 10 Apr 2025 09:23:01 +0000 (11:23 +0200)]
Do not mask IOException JournalSegment constructor

Make sure callers are aware of an error being possible here, leading
to improved error handlign in SegmentedByteBufJournal.

JIRA: CONTROLLER-2137
Change-Id: I03c6080d9628082a039e6885b8dbcebf5a206345
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoReport IOException from SegmentedByteBufJournal.size() 05/116205/1
Robert Varga [Thu, 10 Apr 2025 09:15:19 +0000 (11:15 +0200)]
Report IOException from SegmentedByteBufJournal.size()

Do not use UncheckedIOException to mask errors here.

JIRA: CONTROLLER-2137
Change-Id: I460de64f4a93f12777fcda96aa235f062db0cf38
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoReport IOException from segment operations 02/116202/3
Robert Varga [Thu, 10 Apr 2025 07:54:45 +0000 (09:54 +0200)]
Report IOException from segment operations

We are reporting an UncheckedIOException on IO failures, push this
masking one level up, improving SegmentedJournalActor error handling.

JIRA: CONTROLLER-2137
Change-Id: I135ecdbe44ed9daf684a635e87d6e7f65b7b6779
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoClose deleteJournal reader 04/116204/1
Robert Varga [Thu, 10 Apr 2025 09:05:31 +0000 (11:05 +0200)]
Close deleteJournal reader

We have a dangling reader here, make sure to close it when we are done.

Change-Id: I7b669bca3cd3cfaafb7811c6b83c941bdd04d897
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove StorageException 01/116201/2
Robert Varga [Thu, 10 Apr 2025 07:27:45 +0000 (09:27 +0200)]
Remove StorageException

Use UncheckedIOException, as all remaining users are just masking an
existing IOException.

JIRA: CONTROLLER-2137
Change-Id: I4886ee6e13a07759da0b4e4df698ab5ebabeb9bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFactor out StorageExhaustedException 00/116200/2
Robert Varga [Thu, 10 Apr 2025 07:25:25 +0000 (09:25 +0200)]
Factor out StorageExhaustedException

Use an IOException subclass to report storage exhausted.

JIRA: CONTROLLER-2137
Change-Id: I3a3b886a0d1359c5130fdfa4731948aa86f51dc4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoReport IOException from EntryWriter.append() 96/116196/4
Robert Varga [Wed, 9 Apr 2025 12:46:15 +0000 (14:46 +0200)]
Report IOException from EntryWriter.append()

Eliminate a silent exception in favor of being explicit.

JIRA: CONTROLLER-2137
Change-Id: I8640de39fc18c4755919788a945d64a50abc0531
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSimplify SharedFileBackedOutputStream callback 99/116199/1
Robert Varga [Wed, 9 Apr 2025 13:50:49 +0000 (15:50 +0200)]
Simplify SharedFileBackedOutputStream callback

We only need a Runnable, not two separate objects.

Change-Id: I8d6c59ef1114ffc2795222349bfcd5618ff262a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFixup applyIdentifierFor() 95/116195/1
Robert Varga [Wed, 9 Apr 2025 11:18:12 +0000 (13:18 +0200)]
Fixup applyIdentifierFor()

Simplify the declaration, so that SpotBugs does not get confused.

Change-Id: Ib79d9ea9fd4cb90d7b31a3743fecdee3e91f0b3e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRefactor base.messages.ApplyState 93/116193/2
Robert Varga [Wed, 9 Apr 2025 09:36:33 +0000 (11:36 +0200)]
Refactor base.messages.ApplyState

This is a pure DTO, reduce its proliferation, opting for methods with
explicit arguments instead.

JIRA: CONTROLLER-2137
Change-Id: I17f87dd6600767996e957ca6111e7691f652951b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRefactor getApplyStateFor() 90/116190/2
Robert Varga [Wed, 9 Apr 2025 08:34:05 +0000 (10:34 +0200)]
Refactor getApplyStateFor()

Reduce ApplyState proliferation, as we only need to pick up the
Identifier.

JIRA: CONTROLLER-2137
Change-Id: I64c3c84c76dbbb77d51a11f2efc1e3b766d728c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRefactor MockPayload 87/116187/3
Robert Varga [Wed, 9 Apr 2025 07:34:39 +0000 (09:34 +0200)]
Refactor MockPayload

Split it out into its own file, with MockCommand as the new name.

Change-Id: Ibee1897a4385a7da756b81c0efd180a2726a2b8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoPull down Shard.persistPayload() 84/116184/2
Robert Varga [Tue, 8 Apr 2025 17:35:01 +0000 (19:35 +0200)]
Pull down Shard.persistPayload()

The decision whether or not to go through persistence/replication for a
particular submitCommand() is internal to RaftActor.

Pull down the logic from Shard down to RaftActor, allowing us to hide
RaftActor.hasFollowers().

JIRA: CONTROLLER-2137
Change-Id: Ic8fe37e19a172e561c41c370b7a7d4a17d267ea3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFix raft-journal module info 85/116185/3
Robert Varga [Tue, 8 Apr 2025 21:46:38 +0000 (23:46 +0200)]
Fix raft-journal module info

ByteBuf implements ReferenceCounted, but is not a JPMS module, so we
need to mirror this dependency ourselves.

Change-Id: Ieedf559a5de734f249f208d330dcf39df118b29a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoDrop ActorRef from ApplyState 83/116183/1
Robert Varga [Tue, 8 Apr 2025 16:57:47 +0000 (18:57 +0200)]
Drop ActorRef from ApplyState

ApplyState is carrying an ActorRef, which goes unused: the core driver
is Identifier here.

Drop ActorRef from ApplyState/Replicate and rename methods to clarify
lifecycle:
- persistData() becomes submitCommand()
- applyState() becomes applyCommand()

JIRA: CONTROLLER-2137
Change-Id: Ie6a23daadf17fcf5af2a947a8ab09aa199bdd8ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRemove a superfluous constructor 79/116179/2
Robert Varga [Tue, 8 Apr 2025 13:01:53 +0000 (15:01 +0200)]
Remove a superfluous constructor

JournalSegmentWriter is only ever instantiated from Inactive state,
but let's lower the tangle index by eliminating the Inactive-taking
constructor.

Change-Id: I5205167f9c21d8d639babfd338abdc5bbad9108a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRename CompressionSupport to CompressionType 78/116178/1
Robert Varga [Tue, 8 Apr 2025 12:03:24 +0000 (14:03 +0200)]
Rename CompressionSupport to CompressionType

This is a simple name adjustment.

JIRA: CONTROLLER-2134
Change-Id: I0918e6d3791c55190b65e28bfd8dc85f03793da9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoMove InputOutputStreamFactory 77/116177/1
Robert Varga [Tue, 8 Apr 2025 08:46:04 +0000 (10:46 +0200)]
Move InputOutputStreamFactory

This class is only used by LocalSnapshotStore, move it to the same
package.

Change-Id: I3caceae1b54672c0a09655c6d1d7b86c8c5b7151
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoSwitch to StateSnapshot.Reader to InputStream 75/116175/4
Robert Varga [Mon, 7 Apr 2025 20:27:14 +0000 (22:27 +0200)]
Switch to StateSnapshot.Reader to InputStream

This isolates the guesswork around InstallSnapshot content, making it
something internal to sal-akka-raft.

JIRA: CONTROLLER-2134
Change-Id: I48b8b2089f59d4ba21601f43187ad4159bec4ee1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRemove ReplicatedLogEntry.getData() 76/116176/2
Robert Varga [Tue, 8 Apr 2025 05:27:16 +0000 (07:27 +0200)]
Remove ReplicatedLogEntry.getData()

Replace all users with a call to command().

JIRA: CONTROLLER-2137
Change-Id: Ie21c2cd0de59058ce3bb7f3c42ae133dc9fbac2d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoAdd EntryStore and LogEntry 74/116174/1
Robert Varga [Mon, 7 Apr 2025 15:42:52 +0000 (17:42 +0200)]
Add EntryStore and LogEntry

Split out the methods supporting entries and define a baseline for how a
LogEntry looks like.

Naming is adjusted to match the RAFT paper, i.e. a LogEntry carries a
'command', not 'data'. This paves the way for a potential EntrySource
interface.

This clarifies RaftActorSnapshotCohort's relationship with
StateSnapshot, introducing a StateSnapshot.Support to hold the
indirection to reader/writer.

JIRA: CONTROLLER-2137
Change-Id: I1513ab5ba8533bc5816294b15a4c5fcc19b974a2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoExpand PekkoRaftStorage 34/116034/39
Robert Varga [Mon, 24 Mar 2025 10:56:26 +0000 (11:56 +0100)]
Expand PekkoRaftStorage

Teach RaftStorage about its root directory and consult it in
PekkoRaftStorage.

JIRA: CONTROLLER-2134
Change-Id: I8f6265d697f1f1a237109b0c875050824827995c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoDo not pass ActorContext to ShardSnapshotCohort 67/116167/1
Robert Varga [Mon, 7 Apr 2025 08:55:22 +0000 (10:55 +0200)]
Do not pass ActorContext to ShardSnapshotCohort

We are no longer creating an actor, hence we do not need ActorContext.

JIRA: CONTROLLER-2134
Change-Id: Ic46b3a6abc367eeb7cd314161c15a0a32d6bf19e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoFix a raw type 66/116166/1
Robert Varga [Mon, 7 Apr 2025 08:50:32 +0000 (10:50 +0200)]
Fix a raw type

Guarantee a ShardSnapshotCohort return, fixing a warning.

JIRA: CONTROLLER-2134
Change-Id: I4606cac4487e34a89f3cdbeb667f4094bb704e4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoSplit out SnapshotStore methods 64/116164/1
Robert Varga [Fri, 4 Apr 2025 19:41:41 +0000 (21:41 +0200)]
Split out SnapshotStore methods

Move more methods from DataPersistenceProvider to SnapshotStore, in
order to isolate the scope of changes.

JIRA: CONTROLLER-2134
Change-Id: I39aff5675b0515ee5f35e15ff130ed883f81027d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoClean up streamToInstall() 56/116156/8
Robert Varga [Thu, 3 Apr 2025 14:25:45 +0000 (16:25 +0200)]
Clean up streamToInstall()

Rather than having a clunky BiConsumer, use a sealed class hierarchy to
communicate success/error.

Change-Id: I0f8305f109d95c8ed9efb21d495a34889613d99c
JIRA: CONTROLLER-2134
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRefactor FileBackedOutputStream 57/116157/5
Robert Varga [Thu, 3 Apr 2025 18:36:14 +0000 (20:36 +0200)]
Refactor FileBackedOutputStream

The lifecycle here is a bit hairy. Improve it by keeping track of what
state we are in.

While we are in the area, split out TransientFile(StreamSource), which
is backed by a temporary file.

Major improvement here is TransientFile, which acts as the GC anchor to
a file -- eliminating the need to hold on to FileBackedOutputStream.

JIRA: CONTROLLER-2134
Change-Id: I3fbdcca3e927551572a38dd4d0268b0d56b68aa9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRemove superfluous openBufferedStream() 55/116155/1
Robert Varga [Thu, 3 Apr 2025 11:43:01 +0000 (13:43 +0200)]
Remove superfluous openBufferedStream()

StreamSource is already delegating to openStream(), hence there is no
need to do the same in other implementations.

JIRA: CONTROLLER-2134
Change-Id: I8b733e342f7bbb5fac8de755c6ad973509eb27db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoFix RaftStorage actor confinement violation 54/116154/1
Robert Varga [Thu, 3 Apr 2025 11:33:46 +0000 (13:33 +0200)]
Fix RaftStorage actor confinement violation

We are invoking a callback from a background thread. This should be
routed via executeInSelf() to ensure we execute in proper context.

JIRA: CONTROLLER-2134
Change-Id: I92a40ebd7ed170ae7a77d7923eedefe285978692
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoDitch use of ByteSource 47/116147/4
Robert Varga [Thu, 3 Apr 2025 05:13:12 +0000 (07:13 +0200)]
Ditch use of ByteSource

Rename InputStreamProvider to StreamSource with two specializations, based
on whether or not we know the size.

Allow conversion from StreamSource to SizedStreamSource, for the cost of
consuming the input stream once.

Also disconnect SnapshotSource from StreamSource: the former indicates
the format of the underlying InputStreams, while StreamSource provides
the streams themselves.

JIRA: CONTROLLER-2134
Change-Id: I214b990c9b9d573661de824cbb5d371bcd66ccb7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoAdd cluster.raft.spi.EntryData et al. 46/116146/3
Robert Varga [Wed, 2 Apr 2025 23:16:50 +0000 (01:16 +0200)]
Add cluster.raft.spi.EntryData et al.

We need to reign in ReplicatedLogEntry serialization, so that we can
operate without Serializable being in the picture.

Baseline semantincs of a ReplicateLogEntry is that it represents a step
in RAFT maintentenance, affecting either the contents of StateSnapshot
or a RAFT server state transition.

Introduce cluster.raft.spi.EntryData as the unifying concept, with
RaftDelta representing RAFT server transitions and StateDelta
representing user state transitions.

This provides a natural place for Reader/Writer interfaces, which allow
us to co-locate serialization support within the delta contract.

JIRA: CONTROLLER-2137
Change-Id: Icbf3b32a9ca68c6b60709ea79b509b3078793ea9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoConvert sal-akka-raft into a JPMS module 45/116145/2
Robert Varga [Thu, 3 Apr 2025 00:52:44 +0000 (02:52 +0200)]
Convert sal-akka-raft into a JPMS module

We need to use sealed classes across packages, for which we need
sal-akka-raft to be a full module.

This is a bit painful, as we need to:
- move test utils into o.o.c.cluster.raft
- open that package to Pekko
- add a ton of package-info.java files to cover all the exports
- retain the explicit DynamicImport-Package=* declaration

JIRA: CONTROLLER-2137
Change-Id: Ia013cac658c054815ba3d06764f13d61b2b953d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoSplit out cluster.raft.spi.StateSnapshot 44/116144/3
Robert Varga [Wed, 2 Apr 2025 21:30:57 +0000 (23:30 +0200)]
Split out cluster.raft.spi.StateSnapshot

This extracts the trait of being a snapshot from being Serializable --
which is replaced via explicit StateSnapshot.{Reader,Writer} interfaces.

The newly-enabled SnapshotFile.readSnapshot() is a testament to our
ability to read/write state snapshots without involving Java
Serialization. Unfortunately only testing Payloads are taking advantage
of this right now, as ShardSnapshotCohort still requires
Object{Input,Output}Stream.

JIRA: CONTROLLER-2134
Change-Id: Ia3cfd570f6176d629749f779bb86caf01d656929
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoAdd cluster.raft.spi.SnapshotFileFormat 40/116140/3
Robert Varga [Wed, 2 Apr 2025 11:43:08 +0000 (13:43 +0200)]
Add cluster.raft.spi.SnapshotFileFormat

This is a first cut at having a sensible file format for storing
snapshots. Unlike Pekko-based persistence, which stored the complete
contents of a Snapshot, we just pick store data that cannot be inferred
from the way things are laid out.

The following o.o.raft.spi constructs are introduced:
- InstallableSnapshot, a handle on byte state that can be tranferred via
  InstallSnapshot RPCs
- SizedStreamSource, the moral equivalent of Guava's ByteSource
- FileStreamSource, a SizedStreamSource served from a section of a file

JIRA: CONTROLLER-2134
Change-Id: I9743ec8b701badd12857e483acefb95709d9b68a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoFix CompressionSupport.NONE 43/116143/1
Robert Varga [Wed, 2 Apr 2025 19:41:33 +0000 (21:41 +0200)]
Fix CompressionSupport.NONE

We should be handing out a PlainSnapshotSource, not a LZ4-compressed
one.

JIRA: CONTROLLER-2134
Change-Id: I41fc06d7a28a5d35e084645612c0deb6f3145c13
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRename SnapshotFileFormat to CompressionSupport 37/116137/3
Robert Varga [Wed, 2 Apr 2025 02:58:25 +0000 (04:58 +0200)]
Rename SnapshotFileFormat to CompressionSupport

The idea of having a single compressed stream will not work quite well.
Take a first step by separating what we have into CompressionSupport.

JIRA: CONTROLLER-2134
Change-Id: I2140b1fa84ebdd9f473b07f14bb673049614a941
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoPropagate stateDir to LocalAccess 29/116029/15
Robert Varga [Sun, 23 Mar 2025 15:03:18 +0000 (16:03 +0100)]
Propagate stateDir to LocalAccess

We will need the top-level directory for persistent RaftStorage outside
of Pekko persistence. Make sure we make it available from LocalAccess.

JIRA: CONTROLLER-2134
Change-Id: I7c8130cc89a024f8d276a988787d32e9b0c93b53
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoMove base.messages.CaptureSnapshot 35/116135/1
Robert Varga [Tue, 1 Apr 2025 15:53:09 +0000 (17:53 +0200)]
Move base.messages.CaptureSnapshot

This class is no longer being sent to actor, but rather is a plain
holder used mostly by SnapshotManager.

Move the class into SnapshotManager, hiding its constructor and dropping
the ControlMessage part.

Change-Id: I8bd223bf4b6c16f2a9afc5c52bdf30c096ecbeb8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoClean up Leader 34/116134/1
Robert Varga [Tue, 1 Apr 2025 15:40:28 +0000 (17:40 +0200)]
Clean up Leader

Use local variables to squash nullness warnigns and make
LeadershipTransferContext properly constant.

Change-Id: I50e48092d4f3d36b7ce8fee6df79cfa6c67317e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoImprove sal-akka-raft assertions 33/116133/1
Robert Varga [Tue, 1 Apr 2025 15:28:44 +0000 (17:28 +0200)]
Improve sal-akka-raft assertions

Use assertInstanceOf()/assertSame() instead of referencing the
behavior's role.

Change-Id: I58d65fea5676b95f76ca00b40d5a9e44a33d8dfe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoRewire SnapshotManager.captureToInstall() 69/116069/25
Robert Varga [Tue, 25 Mar 2025 12:55:11 +0000 (13:55 +0100)]
Rewire SnapshotManager.captureToInstall()

Do not may a roundtrip through actor messages, but rather use the
facilities provided RaftStorage to perform off-loaded serialization.

This eliminates the offload actor from sal-distributed-datastore, as
well as the need CaptureSnapshotReply, as we now message completion via
executeInSelf() and callbacks.

JIRA: CONTROLLER-2134
Change-Id: I0518e7eb80559382ede5b4b4e7db41c66fd6a564
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoAdd DataPersistenceProvider.streamToInstall() 55/116055/22
Robert Varga [Tue, 25 Mar 2025 07:31:16 +0000 (08:31 +0100)]
Add DataPersistenceProvider.streamToInstall()

This is the first step in having asynchronous access to a snapshot
bytestream: RaftStorage now exposes streamToInstall() method, which
writes out a snapshot in the background and invokes a callback once
that is completed.

JIRA: CONTROLLER-2134
Change-Id: Ic650dbf4b31c62135dbc7b28fa9682f1ef5bf824
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoFix RaftStorage startup 21/116121/2
Robert Varga [Tue, 1 Apr 2025 06:44:49 +0000 (08:44 +0200)]
Fix RaftStorage startup

PersistenceControl fails to start enabledStorage, leading to all sorts
of mayhem. Fix that up.

JIRA: CONTROLLER-2134
Change-Id: I54023b01f83c7657846253da8e1f505fc52584f6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoSilence PropertiesTermInfoStore 23/116123/2
Robert Varga [Tue, 1 Apr 2025 06:11:03 +0000 (08:11 +0200)]
Silence PropertiesTermInfoStore

Log NoSuchFileException at trace(), reducing clutter in tests.

JIRA: CONTROLLER-2133
Change-Id: I40c1855c957ad82e84f3a02fcedb1167845dc28d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoAllow TestDataProvider's execution to be adjusted 20/116120/1
Robert Varga [Mon, 31 Mar 2025 19:45:29 +0000 (21:45 +0200)]
Allow TestDataProvider's execution to be adjusted

We have a use case where we would like to delay execution of
DataProvider callback. Ditch the shared instance and allow the executor
to be set.

JIRA: CONTROLLER-2134
Change-Id: I0e99bb51eb549f6db3e27f5fdc600f6c3c97f097
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoCentralize MockRaftActorSnapshotCohort methods 19/116119/1
Robert Varga [Mon, 31 Mar 2025 17:28:05 +0000 (19:28 +0200)]
Centralize MockRaftActorSnapshotCohort methods

We have 4 implementations doing the same thing. Use default methods to
reduce duplication.

JIRA: CONTROLLER-2134
Change-Id: I3969590e94b2d138ac665221d7d31b0f0ac3a064
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoUse ByteStateSnapshotCohort in SnapshotManagerTest 18/116118/2
Robert Varga [Mon, 31 Mar 2025 16:40:32 +0000 (18:40 +0200)]
Use ByteStateSnapshotCohort in SnapshotManagerTest

SnapshotManagerTest is dealing with ByteState mostly and
ByteStateSnapshotCohort can widely implement the deserializeSnapshot()
method.

Use ByteStateSnapshotCohort there, which will make further changes
easier.

JIRA: CONTROLLER-2134
Change-Id: I672f934ddaf31c8a5e2cfd5d17664fc8985c4858
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoPropagate start/stop to RaftStorage 15/116115/2
Robert Varga [Fri, 28 Mar 2025 20:37:20 +0000 (21:37 +0100)]
Propagate start/stop to RaftStorage

RaftStorage needs to be an active component to deal with async
persistence, synchronizing persistent content, etc. This patch adds to
lifecycle hooks in RaftActor to control lifecycle.

JIRA: CONTROLLER-2134
Change-Id: I4e225d68628c696b4bcc80b9fbb04fd7d157ee2f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoAdd FileBackedOutputStream.Configuration 14/116114/1
Robert Varga [Fri, 28 Mar 2025 19:47:59 +0000 (20:47 +0100)]
Add FileBackedOutputStream.Configuration

Encapsulate the two options and propagate them to RaftStorage for later
use.

JIRA: CONTROLLER-2134
Change-Id: I341b8ef3891f355c59167ba9235a960b7672bca6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoUse Path instead of String for temp directory 11/116111/2
Robert Varga [Fri, 28 Mar 2025 16:36:52 +0000 (17:36 +0100)]
Use Path instead of String for temp directory

Let's be type-safe, so that things do not get mixed up.

JIRA: CONTROLLER-2134
Change-Id: I8f5400213fc3cf424d61d83379d90fabb192d58e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoClean up sal-clustering-commons pom.xml 10/116110/1
Robert Varga [Fri, 28 Mar 2025 16:59:54 +0000 (17:59 +0100)]
Clean up sal-clustering-commons pom.xml

sal-clustering-commons on longer needs checker-qual, remove that
dependency. We can also enforce modernizer issues.

Change-Id: I587ae6df660f122c63c983d663cce0b6c1b3bab9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoIntroduce raft.spi.ByteArray 05/116105/8
Robert Varga [Fri, 28 Mar 2025 10:10:14 +0000 (11:10 +0100)]
Introduce raft.spi.ByteArray

This patch replaces uses of ByteSource with InputStreamProvider, of
which ByteArray is a convenient implementation of. This eliminates the
need to use yangtools.concepts.Either, as we are expressing the two
options via class hierarchy.

JIRA: CONTROLLER-2134
Change-Id: I249f572fe8be0e64de796fdf7d48cbf2ba9b95c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoRehost controller.cluster.io 04/116104/7
Robert Varga [Thu, 27 Mar 2025 23:34:46 +0000 (00:34 +0100)]
Rehost controller.cluster.io

FileBackedOutputStream is used to receive AppendEntries, which
eventually land in the RAFT journal. No ODL downstream is using this
facility, so it is fair to say that this is part of RAFT SPI.

This allows us to change cds-access-api's dependency from
sal-clustering-commons to raft-api. This is quite natural for the
datastore: at some point we want to expose a CommitInfo which contains
an EntryInfo reference to when the transaction was committed.

JIRA: CONTROLLER-2134
Change-Id: I7458e17055affd56b736f85476b004cb29a2b1d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoRefactor SnapshotSource 71/116071/2
Robert Varga [Wed, 26 Mar 2025 11:35:34 +0000 (12:35 +0100)]
Refactor SnapshotSource

Reduce the number of classes by introducing InputStreamProvider.

JIRA: CONTROLLER-2134
Change-Id: I261c714da7871aa8ed9e66524ee6783faaadec1f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoPropagate SnapshotFileFormat to RaftStore 68/116068/2
Robert Varga [Tue, 25 Mar 2025 11:28:52 +0000 (12:28 +0100)]
Propagate SnapshotFileFormat to RaftStore

Each RaftStore needs to have a preferred file format. Hook it to
use-lz4-compression, hardcoding to 256KiB block size, just as we do when
we transfer to followers.

JIRA: CONTROLLER-1423
Change-Id: I7a59f386abc250fe7f813175650ad9374f4711f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoRemove InputOutputStreamFactory.lz4(String) 65/116065/2
Robert Varga [Tue, 25 Mar 2025 10:25:46 +0000 (11:25 +0100)]
Remove InputOutputStreamFactory.lz4(String)

We do not have to use a String, just use the corresponding constant
directly. There is only one caller who can take ownership of the
corresponding code block.

Change-Id: Ie8bc8162f1cb47744e013fed1fee03f0af10fc03
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoAdd RaftStorage.start()/stop() 54/116054/2
Robert Varga [Tue, 25 Mar 2025 07:13:51 +0000 (08:13 +0100)]
Add RaftStorage.start()/stop()

Add internal thread pool and two methods to control it.

JIRA: CONTROLLER-2134
Change-Id: I87060447b86d7358f2f3cc5f9598168bd963058c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoImprove ShardManagerInfo 51/116051/2
Robert Varga [Tue, 25 Mar 2025 05:46:20 +0000 (06:46 +0100)]
Improve ShardManagerInfo

Define TargetBehavior to offload type mapping to JMX.

Change-Id: If7d39639ae90aaca18807dfb116c795d5b047d18
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoDocument default backup-datastore timeout 50/116050/2
Robert Varga [Tue, 25 Mar 2025 05:33:50 +0000 (06:33 +0100)]
Document default backup-datastore timeout

We have an implementation-specific default of 60 seconds, let's make
sure it is captured in the YANG model.

Change-Id: I66020e33c73c770cbed8bf9a6a0c592bd272c5b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>