controller.git
7 weeks agoRemove DatastoreContext.GLOBAL_DATASTORE_NAMES 42/115842/1
Robert Varga [Tue, 11 Mar 2025 10:12:20 +0000 (11:12 +0100)]
Remove DatastoreContext.GLOBAL_DATASTORE_NAMES

This is a global field, which is really not used -- remove it.

Change-Id: If9bfe72661154978f57b9429bd6f405116256e23
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 weeks agoFix VO_VOLATILE_INCREMENT 41/115841/1
Robert Varga [Tue, 11 Mar 2025 08:40:56 +0000 (09:40 +0100)]
Fix VO_VOLATILE_INCREMENT

Make the variable non-volatile and guard it properly, eliminating a
SpotBugs violation.

Change-Id: I9284e5e623d90e6f6ff719030c15702a068f4e3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 weeks agoUse List.reversed() 40/115840/1
Robert Varga [Tue, 11 Mar 2025 08:25:15 +0000 (09:25 +0100)]
Use List.reversed()

We have more modern collections, ditch use of Lists.reversed().

Change-Id: I95a2f1bda581543ae88249ecaa8009b52b23fdd0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 weeks agoModernize ClusterAdminRpcServiceTest 38/115838/1
Robert Varga [Mon, 10 Mar 2025 16:34:25 +0000 (17:34 +0100)]
Modernize ClusterAdminRpcServiceTest

Address the issues pointed out by modernizer and enable enforcement
again.

Change-Id: I837ee8656304021ec41f7175d18a89b8f3dbbc06
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 weeks agoReduce use of Optional 27/115827/3
Robert Varga [Mon, 10 Mar 2025 13:16:58 +0000 (14:16 +0100)]
Reduce use of Optional

Use @Nullable returns instead.

Change-Id: Idd0d0e83cd979d71d8365115a3f53cd9a535bb8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 weeks agoClean up CaptureSnapshotReply 26/115826/2
Robert Varga [Mon, 10 Mar 2025 13:11:30 +0000 (14:11 +0100)]
Clean up CaptureSnapshotReply

Do not store an Optional, just use a @Nullable.

Change-Id: Ic540f775d9458e39526698d513e353f31093b684
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoBump upstreams 91/115791/2
Robert Varga [Sat, 8 Mar 2025 06:33:55 +0000 (07:33 +0100)]
Bump upstreams

Adopt:
- odlparent-14.0.8
- yangtools-14.0.11
- mdsal-14.0.11

Change-Id: I4204a7233b97a65e5eb361606d6f8e8b7682e3b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoBump Scala to 2.13.16 92/115792/1
Robert Varga [Sat, 8 Mar 2025 06:40:11 +0000 (07:40 +0100)]
Bump Scala to 2.13.16

https://github.com/scala/scala/releases/tag/v2.13.16

Change-Id: I6d979677b852d2228d10e37d14773def9702b2b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoSplit RaftActor.setPersistence(boolean) 54/115754/1
Robert Varga [Wed, 5 Mar 2025 12:52:39 +0000 (13:52 +0100)]
Split RaftActor.setPersistence(boolean)

We have two cases -- we are either becoming transient or persistent.
Split the two cases into separate methods.

Change-Id: I29d5a8df07bcd9bf0fe385b92e17583df6253311
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoEnforce persistence provider 53/115753/1
Robert Varga [Wed, 5 Mar 2025 12:46:22 +0000 (13:46 +0100)]
Enforce persistence provider

The persistence provider should never be null.

Change-Id: Ic95480b0fefe5c74cc55ed827f43ef34dab3b723
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoReduce RaftActor.persistence() visibility 51/115751/1
Robert Varga [Wed, 5 Mar 2025 12:29:07 +0000 (13:29 +0100)]
Reduce RaftActor.persistence() visibility

This method exposes some of the internals. Make sure it is hidden from
public view.

Change-Id: I3fdf6654f122615b650ccd629be9683d20f1e7b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoFix error printout 44/115744/1
Robert Varga [Wed, 5 Mar 2025 12:00:53 +0000 (13:00 +0100)]
Fix error printout

This is a day-zero bug: we should use persistenceId(), not
persistence().

Change-Id: Idda9f396acb6f7f886d0d1bcb8b88cd89f8bbd15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoBump upstreams 58/115658/1
Robert Varga [Thu, 27 Feb 2025 06:14:04 +0000 (07:14 +0100)]
Bump upstreams

Adopt:
- yangtools-14.0.10
- mdsal-14.0.10

Change-Id: I7e678275a7f5e011906601a3844efcf5ec0da211
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRemove SnapshotState 58/115458/1
Robert Varga [Tue, 18 Feb 2025 12:01:10 +0000 (13:01 +0100)]
Remove SnapshotState

The split between Snapshot{Manager,State} is miniscule-to-none. Squash
them into a single class.

Change-Id: I326fad889136b8db4aa390f5c59d420b134e991e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRe-enable IT tests 16/115216/1
Robert Varga [Mon, 10 Feb 2025 08:51:12 +0000 (09:51 +0100)]
Re-enable IT tests

Override surefire configuration and re-enable the integration tests
which were hanging.

Change-Id: Ic3cf47714e563a528c9c2942af80480b4b3d5b24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoBump upstreams 06/115206/5
Robert Varga [Sat, 8 Feb 2025 19:12:03 +0000 (20:12 +0100)]
Bump upstreams

Adopt:
- odlparent-14.0.7
- yangtools-14.0.9
- mdsal-14.0.9

This also peppers pom.xmls with odlparent.modernizer.enforce, which will
be cleaned up in subsequent patches.

We also disable integration tests, as they are using mockito-5.11, which
is not compatible with recent SureFire configuration.

Change-Id: Ia2082118162a547fe3eca24b07685c6ebd22f408
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoCI: Enable Gerrit Verify workflows with GHA 55/114555/5
Anil Belur [Thu, 28 Nov 2024 06:41:15 +0000 (16:41 +1000)]
CI: Enable Gerrit Verify workflows with GHA

This is a pre-req to move Jenkins jobs to GHA.

Change-Id: I3f39dbe603eac800b441db60929f803067a4f105
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
2 months agoCI: Enable Github2Gerrit workflow 55/114655/4
Anil Belur [Thu, 5 Dec 2024 07:34:01 +0000 (17:34 +1000)]
CI: Enable Github2Gerrit workflow

This allows Github devs/users to contribute to the repo using the
Github workflow.

Change-Id: I833c194196e591b36a30dabd8466f7c1adf06aab
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
2 months agoTermInfoStore load/store methods can report IOException 64/114964/31
Robert Varga [Tue, 28 Jan 2025 09:26:03 +0000 (10:26 +0100)]
TermInfoStore load/store methods can report IOException

This is a persistence operation which the RaftActor cannot recover from.
Declare IOException as thrown, so that callers are forced to deal with
it.

JIRA: CONTROLLER-2133
Change-Id: Ia9d1a340d3472534087a0e89876061169fbdf75a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUse state/odl.cluster.server for Shard storage 31/115131/2
Robert Varga [Thu, 6 Feb 2025 14:03:16 +0000 (15:03 +0100)]
Use state/odl.cluster.server for Shard storage

This makes the storage layer symmetric with odl.cluster.client from
cds-access-client.

JIRA: CONTROLLER-2073
Change-Id: Ic1637c8092b4c3034736f7fd7d8d7ac83013f115
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoReimplement TermInfoStore 63/114963/46
Robert Varga [Tue, 28 Jan 2025 09:07:44 +0000 (10:07 +0100)]
Reimplement TermInfoStore

This patch introduces storage of TermInfo in a property file rather than
in Akka/Pekko persistence. We also refactor the
RaftActor/RaftActorRecoverySupport surface to give recovery direct
access to AbstractPersistentActor, without indirection through
DataPersistenceProvider.

This patch is quite invasive as we need to push down the location of
state directory.

JIRA: CONTROLLER-2133
Change-Id: I24d296fc232fb62de30a8f00bdd5f381dc862115
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoImprove bnd-parent 33/115133/1
Robert Varga [Thu, 6 Feb 2025 14:13:55 +0000 (15:13 +0100)]
Improve bnd-parent

Make sure we do not allow superfluous headers and fill out
Bundle-Symbolic-Name as well as Bundle-DocURL.

Change-Id: I6e96507199b999eb5695429facff0c97b27b1532
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoModernize sal-akka-segmented-journal 42/114842/10
Robert Varga [Tue, 7 Jan 2025 13:31:24 +0000 (14:31 +0100)]
Modernize sal-akka-segmented-journal

Use java.nio.file.Path instead of java.io.File for most operations.

Change-Id: I330eb7fbed9dfe0fd05ff0fb796fbe30b6437c8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUse Acquire/Release for MemberName.serialized 95/115095/3
Robert Varga [Mon, 3 Feb 2025 18:06:59 +0000 (19:06 +0100)]
Use Acquire/Release for MemberName.serialized

We are an immutable structure with built-in cache. Improve concurrency
by using getAcquire()/setRelease() consistency.

Change-Id: I24085b54ded6ea6e6f816fba02bb869840979b14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoModernize DTNListenerRegistrationActor 91/115091/4
Robert Varga [Mon, 3 Feb 2025 15:15:23 +0000 (16:15 +0100)]
Modernize DTNListenerRegistrationActor

Add logging of incoming message, use an enhanced switch for dispatch
and use java.time.Duration.

Change-Id: Ic3ce7c6da5d8b25e6da0a2e0ff202bc1d788b10b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoModernize file IO in sal-distributed-datastore 46/114846/5
Robert Varga [Tue, 7 Jan 2025 13:57:43 +0000 (14:57 +0100)]
Modernize file IO in sal-distributed-datastore

Use Files.new{Input,Output}Stream instead of a direct reference to
File{Input,Ouput}Stream.

Change-Id: I5f24ebc04791b8b9659f47174b494092e514a956
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUse Path.of() in AbstractActorTest 41/114841/9
Robert Varga [Tue, 7 Jan 2025 13:21:28 +0000 (14:21 +0100)]
Use Path.of() in AbstractActorTest

Simplify deletion by eliminating unneeded check and using Path-derived
File.

Change-Id: I1f34d36de0865ad870dd9f7858750cedd47c5e38
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoModernize DTCListenerSupportTest 92/115092/4
Robert Varga [Mon, 3 Feb 2025 15:19:16 +0000 (16:19 +0100)]
Modernize DTCListenerSupportTest

Use Map.entry() and local variable type inference.

Change-Id: I691d8df6cd19c22e1dcd4f7b638014c2f5d91d28
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUse instanceof pattern in SDTNPublisherActor 93/115093/3
Robert Varga [Mon, 3 Feb 2025 15:53:31 +0000 (16:53 +0100)]
Use instanceof pattern in SDTNPublisherActor

This is a simple lift up.

Change-Id: Ie6fd2e059642cd6f131e2df514fbf4722f9e0298
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRename persistInfo() to setAndStoreInfo() 90/115090/2
Robert Varga [Mon, 3 Feb 2025 13:21:31 +0000 (14:21 +0100)]
Rename persistInfo() to setAndStoreInfo()

This is a more descriptive name and will pair nicely with future
evolution.

JIRA: CONTROLLER-2133
Change-Id: If10eb078f9644644548cf697b64c880ee650e9dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoCheck listener state before forwarding notification 94/115094/2
Robert Varga [Mon, 3 Feb 2025 16:00:13 +0000 (17:00 +0100)]
Check listener state before forwarding notification

We have an intermittently-failing test because we are not checking
whether the registration is closed -- relying instead on the much slower
process of removing the listener.

Add the missing check, improving the turnaround on stopping event
delivery.

Change-Id: Ia51e5798dce8c322ca9d9a477ffae041ecffd5ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoReduce use of File in AbstractModuleShardConfigProvider 47/114847/4
Robert Varga [Tue, 7 Jan 2025 14:01:31 +0000 (15:01 +0100)]
Reduce use of File in AbstractModuleShardConfigProvider

Use NIO and only convert to File when talking to ConfigFactory.

Change-Id: I067e87f324b6b719782b92d6731a0a26e5d81027
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoUse Duration for graceful stop 86/115086/2
Robert Varga [Sun, 2 Feb 2025 15:34:59 +0000 (16:34 +0100)]
Use Duration for graceful stop

This code harks back to when pre-Java 8 Akka, modernize it to use
java.time.Duration.

Change-Id: I178cf32fedc25fc566645a6449daaccf36187865
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoImprove ShardManager dispatch 85/115085/2
Robert Varga [Sun, 2 Feb 2025 15:07:23 +0000 (16:07 +0100)]
Improve ShardManager dispatch

Use an enhanced switch for message type dispatch and instanceof patterns
where applicable.

Change-Id: I4c696469064618b66269a7f218695d20d157e7a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd ShardManager.logName() 84/115084/1
Robert Varga [Sun, 2 Feb 2025 14:54:26 +0000 (15:54 +0100)]
Add ShardManager.logName()

Do not use persistenceId() as that is going away with persistence.

Change-Id: I4cb24d2773fa02be0f99a0f647ff0053d71a1e23
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoModernize ShardManager a bit 83/115083/1
Robert Varga [Sun, 2 Feb 2025 14:46:18 +0000 (15:46 +0100)]
Modernize ShardManager a bit

Use local variable type inference and simplify a few response methods.

Change-Id: I65312cdf75e4d486f0ad2fcd3a54e9a2901131a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoClean up AbstractUntypedPersistentActor 82/115082/3
Robert Varga [Sun, 2 Feb 2025 13:47:18 +0000 (14:47 +0100)]
Clean up AbstractUntypedPersistentActor

Fix the two suppressions we have by using a private Logger. We also
rehost persistenceId() from RaftAftor and use it consistently in
messages.

Change-Id: Ie8c2f2e414a396060eee5aa7e16975ff5514e972
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDo not pass Logger to ShardSnapshotCohort 80/115080/2
Robert Varga [Sun, 2 Feb 2025 13:33:21 +0000 (14:33 +0100)]
Do not pass Logger to ShardSnapshotCohort

We are already identifying the shard through memberName, let's use our
own logger.

Change-Id: Idcb06205f34d5ba01cd62715e72c1d04d65286bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoFix ActionRegistry persistenceId 81/115081/1
Robert Varga [Sun, 2 Feb 2025 13:59:30 +0000 (14:59 +0100)]
Fix ActionRegistry persistenceId

We are passing down the RPC registry id, hence we have a clash. Fix that
up.

Change-Id: I9f177df639258c47b2ee2d446bcfe0ce185391db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoFix missing return in applySnapshot() 79/115079/1
Robert Varga [Sun, 2 Feb 2025 13:30:38 +0000 (14:30 +0100)]
Fix missing return in applySnapshot()

The log indicates we are about the ignore a payload -- but then we
continue, leading to a CCE. Fix it by adding a return statement.

Change-Id: Ieffa2bdd98611cba0905659c59a4c287353465f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDo not pass logger to ShardRecoveryCoordinator 78/115078/1
Robert Varga [Sun, 2 Feb 2025 13:09:03 +0000 (14:09 +0100)]
Do not pass logger to ShardRecoveryCoordinator

We are already logging our member name, so use a normal, per-class
logger instead of getting it passed from Shard.

Change-Id: I1075c6dd8bfb4fce41d8baa04750a2aaf4ae6c91
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDo not pass around logger and other clean ups 65/115065/3
Robert Varga [Sat, 1 Feb 2025 03:28:23 +0000 (04:28 +0100)]
Do not pass around logger and other clean ups

This patch performs a sweeep on sal-akka-raft logging, using per-class
loggers rather than passing one logger around.

AbstractLeader.printFollowerStates() is improved slightly to use fluent
StringBuilder append() calls.

Candidate.handleRequestVoteReply() is improved to be more linear in an
effort to make it clearer.

SnapshotTrackerTest is converted to JUnit5 to for accurate tracking of
which method call throws the expected exception.

Change-Id: I5e7142f2b1776da8edd21d302da55b1b0ab29d18
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoEliminate shard-operation-result 63/115063/5
Robert Varga [Fri, 31 Jan 2025 21:29:47 +0000 (22:29 +0100)]
Eliminate shard-operation-result

Inline it into its sole user, where it can be properly specialized.
We also remodel it to correctly express extensible success/failure
cases, where error message is optional.

Change-Id: Icd6de68211bbe9a087d2c87e700fd199ba905f42
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoUse manual Karaf-Commands property 68/115068/2
Robert Varga [Sat, 1 Feb 2025 13:32:38 +0000 (14:32 +0100)]
Use manual Karaf-Commands property

We do not need the full tooling plugin, just define the appropriate
property.

Change-Id: Ibed33d47dd26d5d687d932b86f52fe2e28cc53df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoUse 'member-name' from odl-controller-cds-types 62/115062/4
Robert Varga [Fri, 31 Jan 2025 20:30:11 +0000 (21:30 +0100)]
Use 'member-name' from odl-controller-cds-types

We already have this construct, it just needs strengthening a bit.

Change-Id: Icd858c9991f39f7399c96cefc13a61559ddaf2a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd ClusterConfig 64/115064/3
Robert Varga [Fri, 31 Jan 2025 23:37:39 +0000 (00:37 +0100)]
Add ClusterConfig

RAFT paper mentions cluster configuration, which is what we have in
ServerConfigurationPayload.

Note that while we currently only transport ServerInfo, the structure is
flexible at the end of the day.

For now we call the ServerInfos we have serverInfo(), but really that
should be fused with the logic that uses it -- because this feels like
the List should be a Map and encapsulated in something called
ElectionPolicy or something.

We also remove PersistentPayload, as we are the only user -- and any
further access to being this special means you are part of
ClusterConfig, so explicit updates are in order.

JIRA: CONTROLLER-2137
Change-Id: Ie3eee97bbf71401889f835f2b8be9757c3f76c22
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoMake 'local' a presence container 61/115061/2
Robert Varga [Fri, 31 Jan 2025 20:15:57 +0000 (21:15 +0100)]
Make 'local' a presence container

It does not change on-wire representation and it is more expressive.
Also spell out case statements to have them bear different names.

Change-Id: Ibade66fb29080f0601ca701ef3e93dbbdff45d30
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoFix member-voting-state 60/115060/3
Robert Varga [Fri, 31 Jan 2025 20:03:55 +0000 (21:03 +0100)]
Fix member-voting-state

The list here is meant to carry each member name once and for each
positively identify whether or not it is voting. The list has to be
non-empty, as already enforced by the implementation.

Change-Id: Idc5e9dd37812e9b4af4a71bee9e8178c9ad7bbc2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoSeparate out shard-name as a separate typedef 59/115059/3
Robert Varga [Fri, 31 Jan 2025 19:45:23 +0000 (20:45 +0100)]
Separate out shard-name as a separate typedef

This allows us to rely it as a source of type safety, foregoing a few
checks.

Change-Id: Id27b7ffe0d6c09dd94547006f5f334f7c8a7599b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoModernize LocalSnapshotStore 38/114838/4
Robert Varga [Tue, 7 Jan 2025 12:19:37 +0000 (13:19 +0100)]
Modernize LocalSnapshotStore

Use java.nio.file.Path and related NIO utilities to provide the same
functionality with more modern tools.

Change-Id: I4a2999e267f38189f7aa55bb40ac534142425d16
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoModernize InputOutputStreamFactory 37/114837/3
Robert Varga [Tue, 7 Jan 2025 12:18:46 +0000 (13:18 +0100)]
Modernize InputOutputStreamFactory

Use java.nio.file.Path internally, while keeping the external interface
unchanged.

Change-Id: Ib10c6094a8d3f746e64502c8023b4a5c1d05cf30
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoModernize FileAkkaConfigurationReader 36/114836/4
Robert Varga [Tue, 7 Jan 2025 12:17:52 +0000 (13:17 +0100)]
Modernize FileAkkaConfigurationReader

Use java.nio.file.Path instead of java.io.File and simplify code a bit.

Change-Id: I107cf5044975c2ee3b6dd473b68ecd17c6510994
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoModernize atomix-storage path management 35/114835/4
Robert Varga [Tue, 7 Jan 2025 11:54:54 +0000 (12:54 +0100)]
Modernize atomix-storage path management

Use java.nio.file.Path in most places, so we have a more modern
interface.

Change-Id: I6c42a9f88102063961af7615a12372f6372cfa89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoModernize DataStoreAppConfigMetadata path management 33/114833/3
Robert Varga [Tue, 7 Jan 2025 11:39:40 +0000 (12:39 +0100)]
Modernize DataStoreAppConfigMetadata path management

Use java.nio.file.Path for better instantiation, eliminating the need to
split path into its components.

Change-Id: Ia3aaf1276ac310862790be89ab741675cac84be4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoClean up payloadVersion lifecycle 29/115029/4
Robert Varga [Thu, 30 Jan 2025 11:36:03 +0000 (12:36 +0100)]
Clean up payloadVersion lifecycle

This is something that cannot ever change, make sure we have that
covered.

Change-Id: I1ce6a888ce39af7722f0c33640387ca158a19f41
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoSplit out WaitCallback 22/115022/4
Robert Varga [Thu, 30 Jan 2025 03:50:18 +0000 (04:50 +0100)]
Split out WaitCallback

There is a lot going on for an anonymous class. Refactor into a
method-private class, which makes things a tad easier on the eyes.

Change-Id: I06f433fa830f53a7fa4002ae9ff6c9fcb8c661c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoClean up minor nits in tests 27/115027/6
Robert Varga [Thu, 30 Jan 2025 08:39:40 +0000 (09:39 +0100)]
Clean up minor nits in tests

Mostly assertTrue()/assertFalse() to use explicit binding to boolean
instead of going through objects.

Change-Id: Ib6a4c21ac75ec4ccadc83678f6330faea6ebd2bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoSimplify sendMessageToManagerForConfiguredShards() 21/115021/2
Robert Varga [Thu, 30 Jan 2025 03:41:06 +0000 (04:41 +0100)]
Simplify sendMessageToManagerForConfiguredShards()

We are always sending messages to all datastores, so this refactors
the basic primitive and its users to be much more friendly.

Change-Id: Ia8bd477808d40f74c2faa791b84ada650cf27d27
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoImprove toChangeShardMembersVotingStatus() 20/115020/2
Robert Varga [Thu, 30 Jan 2025 02:08:02 +0000 (03:08 +0100)]
Improve toChangeShardMembersVotingStatus()

Use a stream with a collector to create the HashMap we need.

Change-Id: I6bc2bc88e5b92e1363c04b1478b72d662180a583
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoImprove processReplies() 19/115019/2
Robert Varga [Thu, 30 Jan 2025 01:59:55 +0000 (02:59 +0100)]
Improve processReplies()

Use BindingMap.toMap() to simply index resuts via a streaming pipeline.
Makes things a lot easier on the eyes.

Change-Id: I8f108a097aa4f6a55e874776125eec89a5b67fa3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoInline getAllShardLeadersClients() 18/115018/2
Robert Varga [Thu, 30 Jan 2025 01:48:47 +0000 (02:48 +0100)]
Inline getAllShardLeadersClients()

This method has a single caller, which can realize it much more neatly
when inlined.

Change-Id: Ifc5f1daaa5679a4acf5c643970ad36cd97af6809
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoInline sendMessageToShardManagers() 17/115017/2
Robert Varga [Thu, 30 Jan 2025 01:41:39 +0000 (02:41 +0100)]
Inline sendMessageToShardManagers()

This method has a single caller, which is much better served with
using sendMessageToShardManager().

Change-Id: I82524ade1d0e93707e5fb9211f67264ffab7944d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoModernize callback dispatch 16/115016/2
Robert Varga [Thu, 30 Jan 2025 01:34:16 +0000 (02:34 +0100)]
Modernize callback dispatch

Use proper generics and local variable type inference to streamline
bridging to ListenableFuture.

Change-Id: If4158288463611cb0ee15120436ce2ed524de6f6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRemove TransactionRateLimiter 26/115026/3
Robert Varga [Thu, 30 Jan 2025 08:08:33 +0000 (09:08 +0100)]
Remove TransactionRateLimiter

This component is completely unused. Remove it along with all its
surrounding wiring -- including marking its configuration as obsolete.

Change-Id: Ica980f21109ca80d19660a6327e00e10073c9610
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoSpecialize UnsignedLongSet.EntryImpl 25/115025/2
Robert Varga [Thu, 30 Jan 2025 07:02:58 +0000 (08:02 +0100)]
Specialize UnsignedLongSet.EntryImpl

Separate out the interface and implementations, so that we now have two
record covering the case of a singleton range or a range encompassing
multiple values.

Change-Id: I08e86f2f4e58c50734ec34433b946ceaa3f55b17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoPromote UnsignedLong{Bitmap,Set} 24/115024/1
Robert Varga [Thu, 30 Jan 2025 06:17:01 +0000 (07:17 +0100)]
Promote UnsignedLong{Bitmap,Set}

Tracking unsigned long things is useful in RAFT context, not just where
sal-distributed-datastore is concerned.

Promote these utilities to cluster.raft.spi for wider exposure.

Change-Id: Iab9f9a326ee60101230b7a3130cc48134182c48f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoUse BindingMap.toMap() 15/115015/1
Robert Varga [Thu, 30 Jan 2025 01:19:45 +0000 (02:19 +0100)]
Use BindingMap.toMap()

We are collecting EntryObjects, we have a specialized utility to make
that easy.

Change-Id: I4920e20d42e4636ec151abd72fb36d7db37679dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoUnify ActorUtils lookup 14/115014/1
Robert Varga [Thu, 30 Jan 2025 01:16:55 +0000 (02:16 +0100)]
Unify ActorUtils lookup

Use a simple utility method with a switch expression to return the
correct ActorUtils and use it where needed.

Change-Id: I7fefe74fb2d7706d5fb82bd091e214beba7ce3e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDo not use commons-lang3 for serialization 13/115013/2
Robert Varga [Wed, 29 Jan 2025 23:52:08 +0000 (00:52 +0100)]
Do not use commons-lang3 for serialization

The method we are using here is a plain wrapper around
ObjectOutputStream masking IOException. Just the two lines ourselves,
replacing use of FileOutputStream with java.nio.file.Files instead.

Change-Id: I07ed7b6303c1d1d7ffabc730eb89598c255e935f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoImprove duration formatting 12/115012/1
Robert Varga [Wed, 29 Jan 2025 22:58:31 +0000 (23:58 +0100)]
Improve duration formatting

DurationFormatUtils.formatDurationHMS() is not doing quite what we want
if we go for peers inactive for longer than 24 hours.

Replace this commons-lang3 dependency with a Duration+String.format()
solution, which caps the result at a millisecond-before-24-hours on
overflow. Also issue a warning if that happens.

Change-Id: Ic79062890dcb777a6d0cfd7f4bc49be98ff48f29
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDitch use of ObjectUtils.identityToString() 11/115011/1
Robert Varga [Wed, 29 Jan 2025 22:29:24 +0000 (23:29 +0100)]
Ditch use of ObjectUtils.identityToString()

Use Objects.toIdentityString() instead, reducing reliance on
commons-lang3.

Change-Id: Ib6c6698ca1b33bf9aaef85c74c2df45a6a584897
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoClean up RaftActorBehaviour.canGrantVote() 10/115010/1
Robert Varga [Wed, 29 Jan 2025 21:10:55 +0000 (22:10 +0100)]
Clean up RaftActorBehaviour.canGrantVote()

We are using state variable and if/else blocks to change its initial
value. Rather than doing that, let's just return the appopriate result
as soon as we know it.

While we are here, store values we access multiple times in local
variables for brevity and simplicity.

Change-Id: I2c8eb29d617bf41d0451ae42d31b30e8f959774e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoImprove RaftActorBehavior.shouldUpdateTerm() 09/115009/1
Robert Varga [Wed, 29 Jan 2025 20:57:05 +0000 (21:57 +0100)]
Improve RaftActorBehavior.shouldUpdateTerm()

Use local variable type inference and Optional.isEmpty() to simplify
things.

Change-Id: I1ec28dd24f4eb9c36ddd0c20bf1140ef2509b15f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd RaftActor.memberId() 08/115008/2
Robert Varga [Wed, 29 Jan 2025 18:06:33 +0000 (19:06 +0100)]
Add RaftActor.memberId()

Rename the protected getId() method to memberId() and make it public.
Deprecated persistenceId() for removal, as it will be gone when we ditch
persistence.

JIRA: CONTROLLER-2073
Change-Id: Id02ae441855556160ad4746eeb0a8774fa87c4aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDeprecate RaftActor.persistenceId() 07/115007/1
Robert Varga [Wed, 29 Jan 2025 18:01:58 +0000 (19:01 +0100)]
Deprecate RaftActor.persistenceId()

persistenceId() is something we inherit from AbstractPersistentActor,
which we are getting rid of.

Make RaftActor.getId() public as memberId() and use it instead of
persistenceId().

JIRA: CONTROLLER-2073
Change-Id: If8a76654e9d8102a41548883a90d680db833f9f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoClean up RaftActor name handling 06/115006/1
Robert Varga [Wed, 29 Jan 2025 17:28:10 +0000 (18:28 +0100)]
Clean up RaftActor name handling

We have three concepts here:
- persistenceId, which is left to be defined by subclasses
- id, which gets passed to the constructor
- Shard.name, which is effectively the same thing

Eliminate the need to call overridable methods in constructor by
codifying the constructor id as persistenceId(), which is now a final
method in RaftActor.

Also prevent RaftActor.getId() from being overridden: this is the id
passed to constructor, even when we ditch persistence. We also eliminate
Shard.name, as it was always the same thing as getId().

Change-Id: I007964f8c17c5693bd96a030c4b75821d491254b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoReduce RaftActor method visibility 03/115003/1
Robert Varga [Wed, 29 Jan 2025 16:42:25 +0000 (17:42 +0100)]
Reduce RaftActor method visibility

We have a few protected methods which really should be
package-protected. Hide them from outside world.

JIRA: CONTROLLER-2073
Change-Id: I53cc6de8271d2425e15a9631170555214d67c828
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoStore ReplicatedLog reference 97/114997/2
Robert Varga [Wed, 29 Jan 2025 14:32:10 +0000 (15:32 +0100)]
Store ReplicatedLog reference

We are logging a number of things from the the replicated log, make sure
to keep the instance local.

Change-Id: I66961cb66046927c4805ff9f6cd931b11d7cc509
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoCentralize lz4-java version 96/114996/1
Robert Varga [Wed, 29 Jan 2025 14:19:37 +0000 (15:19 +0100)]
Centralize lz4-java version

Do not hide the version in sal-clustering-commons, keep it in
bnd-parent.

Change-Id: I0f1f1240cb616bd547c2fdc852d277798ea6fff3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd Automatic-Module-Name to sal-clustering-commons 81/114981/3
Robert Varga [Tue, 28 Jan 2025 20:43:28 +0000 (21:43 +0100)]
Add Automatic-Module-Name to sal-clustering-commons

Make it easier on downstreams to consume this artifact by explicitly
downgrading m-j-d version.

While we are here, also reformat and re-parent to bundle-plugin instead
of mdsal-plugin, as we do not have any codegen here.

Change-Id: Id40df7c6e1259b8d0c6142667464982763c85b9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoClean up AbstractReplicatedLog 72/114972/3
Robert Varga [Tue, 28 Jan 2025 15:22:21 +0000 (16:22 +0100)]
Clean up AbstractReplicatedLog

The string we get is tied to RaftActorContext.getId(), let's call it
logId, just as we do in LocalAccess.

Force subclasses to provide initial data, so that it is clear the
magic values we are using are for test/mock classes -- which now specify
them explicitly.

Use List.of() instead of Collections.emptyList() as a final touch.

JIRA: CONTROLLER-2073
Change-Id: I784d02ecc55b668e2d991db6d6ff4e109e033d52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoUse bnd-parent in raft-journal 80/114980/2
Robert Varga [Tue, 28 Jan 2025 20:08:23 +0000 (21:08 +0100)]
Use bnd-parent in raft-journal

raft-journal is a simple JPMS API component at this point. Use
bnd-parent to package it. Also fix javadocs while we are at it.

Change-Id: Ib821ea720f80edcd87dbdb528366b4599dbd9d3e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd bnd-parent and use it in blueprint 79/114979/2
Robert Varga [Tue, 28 Jan 2025 19:53:10 +0000 (20:53 +0100)]
Add bnd-parent and use it in blueprint

bnd-parent is essentially the same thing as bundle-parent, except driven
by bnd-maven-plugin.

This allows us to use annotations to control the manifest layout,
significantly improving maintainability.

Change-Id: I47dad895b7c3db907b6272827f57f84e933cb836
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRename AbstractReplicatedLogImpl 71/114971/2
Robert Varga [Tue, 28 Jan 2025 15:00:58 +0000 (16:00 +0100)]
Rename AbstractReplicatedLogImpl

AbstractReplicatedLog better captures the intent, let's use that without
implying anything about ReplicatedLogImpl itself.

JIRA: CONTROLLER-2073
Change-Id: I14abc64495a92476258eb07c3f6915a77afbbf00
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoUse bundle-parent in blueprint 78/114978/1
Robert Varga [Tue, 28 Jan 2025 19:18:28 +0000 (20:18 +0100)]
Use bundle-parent in blueprint

Just inherit the things from bundle-parent, reducing maintenance
overhead.

Change-Id: I4ee826f6aa50363f36db2352fa88b9c93b3bec18
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump upstreams 77/114977/1
Robert Varga [Tue, 28 Jan 2025 19:12:12 +0000 (20:12 +0100)]
Bump upstreams

Adopt:
- yangtools-14.0.7
- mdsal-14.0.8

Change-Id: Ie64ae6015793088bede41d3d8c7e931befb2c964
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAcquire persistence provider once 68/114968/2
Robert Varga [Tue, 28 Jan 2025 14:03:14 +0000 (15:03 +0100)]
Acquire persistence provider once

We have a few places where we call getPersistenceProvider() twice. Make
things clearer by acquiring it only once.

JIRA: CONTROLLER-2073
Change-Id: Ic4bc681140076396b5d3384b1a7386aa00ee3e8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoInline isPersistentPayload() 67/114967/2
Robert Varga [Tue, 28 Jan 2025 13:59:19 +0000 (14:59 +0100)]
Inline isPersistentPayload()

The only caller already accesses entry data, so let's inline this method
and also clean up onRecoveredJournalLogEntry() a bit.

JIRA: CONTROLLER-2073
Change-Id: I5be0d85631692612bdaa284dcd132232c2ca744a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoClean up RaftActorDelegatingPersistentDataProviderTest 66/114966/2
Robert Varga [Tue, 28 Jan 2025 13:42:35 +0000 (14:42 +0100)]
Clean up RaftActorDelegatingPersistentDataProviderTest

We use unchecked casts and raw types. Modernize the setup a bit,
eliminating the need for suppressions.

JIRA: CONTROLLER-2073
Change-Id: Idb0c31e66de3721b9bf9ecf46b8c9484748a287f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd cluster.raft.LocalAccess 61/114961/1
Robert Varga [Mon, 27 Jan 2025 19:11:07 +0000 (20:11 +0100)]
Add cluster.raft.LocalAccess

Current layout of state management needs some better encapsulation, i.e.
something RaftActor sees from local storage perspective. One aspect
is TermInfoStore, as tied logId.

Introduce LocalAccess to maintain a combination of a TermInfoStore and a
logId.

Tests are migrated so that the test suites not involved with persistence
use the newly-improved TestTermInfoStore, or FailingTermInfoStore if
they want to assert that persistence was not called.

Common path with RaftActor is exposed via the
DataPersistenceProvider-based constructor, allowing those involving
persistence call out into that path to improve consistency.

JIRA: CONTROLLER-2133
Change-Id: I5960036b599f76b284d53d60bbdf8a58c706f290
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoSplit ImmutableUnsignedLongSet.readFrom() 60/114860/3
Robert Varga [Tue, 7 Jan 2025 18:32:57 +0000 (19:32 +0100)]
Split ImmutableUnsignedLongSet.readFrom()

We have two methods of reading entries. Split them into separate
methods, making things a tad easier to follow.

Ditch use of ArrayList, as using Entry[] results in a better path
to ImmutableSortedSet.construct().

Change-Id: I0c91fc0b07d5b9e10f4ba03454ebff5237b20da3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDo not use Collections2 58/114858/3
Robert Varga [Tue, 7 Jan 2025 17:19:15 +0000 (18:19 +0100)]
Do not use Collections2

Building an ImmutableRangeSet through copyOf() offers to advantages over
using an explicit Builder -- it literally is the same thing.

Ditch Collections2.transform() in favor of a simple loop of
Builder.add() calls, resulting in more performant code.

Change-Id: I700b4d6d3082fed6413d8762085d6971285bdb66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRefactor UnsignedLongSet.Entry 57/114857/3
Robert Varga [Tue, 7 Jan 2025 17:06:11 +0000 (18:06 +0100)]
Refactor UnsignedLongSet.Entry

Hide this class and make it a record, as that is what it is.

Change-Id: I7ccaa219590b2bf2c7ea880c8e2e185165272a5f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoUse switch expressions in UnsignedLongBitmap 50/114850/3
Robert Varga [Tue, 7 Jan 2025 15:59:38 +0000 (16:59 +0100)]
Use switch expressions in UnsignedLongBitmap

Both copyOf() and readFrom() dispatch based on size, always returning an
instance. Use a switch expression to express that, improving code layout
a bit.

Change-Id: I25247537e7a55bf0e3710fe8d70e2a1dd8a4d6f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoClean up UnsignedLongSet.Entry.equals() 53/114853/3
Robert Varga [Tue, 7 Jan 2025 16:12:18 +0000 (17:12 +0100)]
Clean up UnsignedLongSet.Entry.equals()

Use an instanceof pattern to squash the implementation into a single
expression.

Change-Id: I2b1562a4e7e30559f3e439150b21ad267c4f188a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoImprove UnsignedLongSet.toString() 56/114856/3
Robert Varga [Tue, 7 Jan 2025 16:27:38 +0000 (17:27 +0100)]
Improve UnsignedLongSet.toString()

Use arrow form, documenting the explicit no-op on empty.

Change-Id: I486c55a1764666fd7738c3fac67d276f0f47e3ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoImprove UnsignedLongSet.equals() 54/114854/3
Robert Varga [Tue, 7 Jan 2025 16:12:58 +0000 (17:12 +0100)]
Improve UnsignedLongSet.equals()

Use instanceof pattern to eliminate an explicit cast.

Change-Id: I5f928238056fc85511e96a5a8010531e598d2bef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDefer empty UnsignedLongBitmap instantiation 52/114852/3
Robert Varga [Tue, 7 Jan 2025 16:05:51 +0000 (17:05 +0100)]
Defer empty UnsignedLongBitmap instantiation

Move the EMPTY singleton in Regular, so that we instantiate it only when
needed.

Change-Id: Ib70d3c3c5dd5aea4f82efc485998248a8ff54ec1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoSeal UnsignedLongSet 55/114855/2
Robert Varga [Tue, 7 Jan 2025 16:14:49 +0000 (17:14 +0100)]
Seal UnsignedLongSet

We have only two internal implementations, make sure this is enforced in
class hierarchy.

Change-Id: I01338e132929784ac2671af0cc7439364136e685
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoSeal UnsignedLongBitmap 51/114851/2
Robert Varga [Tue, 7 Jan 2025 16:03:08 +0000 (17:03 +0100)]
Seal UnsignedLongBitmap

We only allow our two internal implementations, make that explicit by
sealing the class hierarchy.

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