controller.git
7 days agoDo not use Optional in InstallSnapshot 57/114357/1
Robert Varga [Wed, 6 Nov 2024 17:22:17 +0000 (18:22 +0100)]
Do not use Optional in InstallSnapshot

Passing an Optional in method arguments is an early-adopter antipattern,
as is storing it in the fields. Use a plain @Nullable, which makes it a
tad easier to use.

Change-Id: I1acb67d38bb2be561cbc77041a9a1e07ed004b88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 days agoRefactor handleInstallSnapshotReply() 39/114339/7
Robert Varga [Mon, 4 Nov 2024 11:29:53 +0000 (12:29 +0100)]
Refactor handleInstallSnapshotReply()

We are about to make a few changes to the logic here. Refactor it to
reduce nesting.

JIRA: CONTROLLER-2074
Change-Id: Icb373735fc5960e54b33483994500bfe034ecdf7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 days agoRefactor handleInstallSnapshot() 40/114340/3
Robert Varga [Mon, 4 Nov 2024 12:50:39 +0000 (13:50 +0100)]
Refactor handleInstallSnapshot()

We are about to make some changes to the logic here, but before we
embark on that, this patch makes the method more linear, differentiating
the two failure paths.

JIRA: CONTROLLER-2074
Change-Id: Iffc7d494e2f83968c5193dd2d3758d68443a6f6e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 days agoRemove unneeded SuppressFBWarnings 38/114338/1
Robert Varga [Mon, 4 Nov 2024 11:31:40 +0000 (12:31 +0100)]
Remove unneeded SuppressFBWarnings

handleInstallSnapshotReply() is no longer triggering the violation,
remove the annotation.

Change-Id: I7516ca3f635531c6055bde76134b8312f1f0369b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 days agoRefactor ShardManagerIdentifier 36/114336/1
Robert Varga [Mon, 4 Nov 2024 08:53:01 +0000 (09:53 +0100)]
Refactor ShardManagerIdentifier

- make this class a plain record, as it only holds a single field
- separate out toString() and toActorName() -- while the two are
  aliases, we want to have an explicit method
- move to cluster.datastore.shardmanager

Change-Id: Iceea5ea40e46ccf2f0d0a5c830a5d11c28cd57d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoModernize DataTreeCohortRegistrationProxy 35/114335/1
Robert Varga [Sun, 3 Nov 2024 22:23:48 +0000 (23:23 +0100)]
Modernize DataTreeCohortRegistrationProxy

Use Pekko Java API where possible and reduce ceremony around
asynchronous execution.

Change-Id: Ia875b6dd454b675974b2e070c4b07f465084ba1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoExpose ExecutionContextExecutor from Dispatches 34/114334/1
Robert Varga [Sun, 3 Nov 2024 22:16:46 +0000 (23:16 +0100)]
Expose ExecutionContextExecutor from Dispatches

Akka/Pekko has seamless integration with Java 8 via CompletionStages,
Duration etc. In order to make it useful, we also need a proper
Executor, not ExecutionContext.

As it turns out, this is as simple as exposing ExecutionContextExecutor
from our underlying MessageDispatcher.

Change-Id: Iadad1ccc12b40ba0716cd438d89c9b47643b0f14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse exhaustive switch in CompositeDataTreeCohort 33/114333/2
Robert Varga [Sun, 3 Nov 2024 21:45:34 +0000 (22:45 +0100)]
Use exhaustive switch in CompositeDataTreeCohort

Eliminate an impossible branch, improving our defensiveness. Also fix a
typo in enum member name.

Change-Id: Ie9b6a51f76f3b1e2efb494edd1c6c4847457c6f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRework FrontendReadWriteTransaction state tracking 32/114332/3
Robert Varga [Sun, 3 Nov 2024 19:12:13 +0000 (20:12 +0100)]
Rework FrontendReadWriteTransaction state tracking

Use switch expressions in most places and throw concrete ISEs, so
that it is apparent from the message as to what is going on.

JIRA: CONTROLLER-2131
Change-Id: Ib23ffe5baa3a97232f6f6cf6cbc6f38f109b443f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove abortFromTransactionActor() 31/114331/1
Robert Varga [Sun, 3 Nov 2024 17:13:46 +0000 (18:13 +0100)]
Remove abortFromTransactionActor()

We do not have ShardTransaction, hence this code path is completely
unused. Remove it.

JIRA: CONTROLLER-2129
Change-Id: I6709bcde470153dc63072f7ae95519e82fe3355d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFix an Akka reference 23/114323/1
Robert Varga [Sun, 3 Nov 2024 10:15:09 +0000 (11:15 +0100)]
Fix an Akka reference

We really mean Pekko here.

Change-Id: I3f4f891b84c77a1da720407c2add012dec14139a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump Scala to 2.13.15 19/114319/1
Robert Varga [Sun, 3 Nov 2024 09:10:43 +0000 (10:10 +0100)]
Bump Scala to 2.13.15

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

Change-Id: I076d60bbb7a2295adf58cc76b4c50a05080d8e83
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump scalatestplus.junit-4-13_2.13 to 3.2.19.0 18/114318/1
Robert Varga [Sun, 3 Nov 2024 09:00:11 +0000 (10:00 +0100)]
Bump scalatestplus.junit-4-13_2.13 to 3.2.19.0

https://www.scalatest.org/release_notes/3.2.14
https://www.scalatest.org/release_notes/3.2.15
https://www.scalatest.org/release_notes/3.2.16
https://www.scalatest.org/release_notes/3.2.17
https://www.scalatest.org/release_notes/3.2.18
https://www.scalatest.org/release_notes/3.2.19

Change-Id: I291322f0f29e4e1bf926f9adfc9a473dbf42596e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 days agoDitch scala-java8-compat 11/114311/3
Robert Varga [Sat, 2 Nov 2024 23:09:41 +0000 (00:09 +0100)]
Ditch scala-java8-compat

We have migrated away from using scala-java8-compat, remove the
dependency.

Change-Id: Ia11c9aa68ec8a47b54ea3fae2d63d323c8a2b2ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 days agoMigrate away from scala.compat.java8.FutureConverters 10/114310/3
Robert Varga [Sat, 2 Nov 2024 23:03:53 +0000 (00:03 +0100)]
Migrate away from scala.compat.java8.FutureConverters

Use an OnComplete to dispatch the future without the use of
FutureConverters.

While we are here, also clean up interactions with
scala.concurrent.Future, so that we do not reference various
Promise-based things.

Change-Id: Iae5ff9e44ef4017409db66d34df4b00df919b68f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 days agoAdd ShardDataTree.retire() 03/114303/11
Robert Varga [Sat, 2 Nov 2024 16:13:43 +0000 (17:13 +0100)]
Add ShardDataTree.retire()

The only reason for cohortIterator() is retiring a client. Encapsulate
the logic in ShardDataTree.

JIRA: CONTROLLER-2131
Change-Id: I45a3c48a5e462469f1f2919dfb180ca8d33c72ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 days agoReduce use of Scala in ShardDataTreeListenerInfoMXBeanImpl 14/114314/3
Robert Varga [Sun, 3 Nov 2024 01:44:36 +0000 (02:44 +0100)]
Reduce use of Scala in ShardDataTreeListenerInfoMXBeanImpl

Use CompletionStages, even when they are a pain for this particular use
case.

Change-Id: I49ff00fd86df025174533e024092f5a3048250df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 days agoModernize CompositeDataTreeCohort 07/114307/6
Robert Varga [Sat, 2 Nov 2024 17:42:52 +0000 (18:42 +0100)]
Modernize CompositeDataTreeCohort

Use the various Java features to simplify code. Also use @Nullable
instead of optional, as it leads to simpler callers.

Also use scala.jdk.javaapi.FutureConverters instead of legacy
scala.compat.java8.FutureConverters, with routing through
callbackExecutor.

JIRA: CONTROLLER-2131
Change-Id: I2a47d01ab95862efeef40debd52e8f6ca40b601d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 days agoRename (Simple)ShardDataTreeCohort 99/114299/8
Robert Varga [Sat, 2 Nov 2024 11:31:36 +0000 (12:31 +0100)]
Rename (Simple)ShardDataTreeCohort

Let us use (Simple,Chained}CommitCohort naming throughout, so that do
not need to deal with a mouthful.

JIRA: CONTROLLER-2131
Change-Id: I04a37e000af74f087786c6f4fc8cee8ebdfe7c50
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 days agoRefactor ShardDataTreeCohort 98/114298/8
Robert Varga [Sat, 2 Nov 2024 10:15:16 +0000 (11:15 +0100)]
Refactor ShardDataTreeCohort

Move all logic from SimpleShardDataTreeCohort into ShardDataTreeCohort,
so we can use ChainedCommitCohort in ShardDataTree queues.

This leads to a consistent view of cohorts, i.e.
ShardDataTreeTransactionChain.createReadyCohort() returns the same
cohort as is present it the queue.

JIRA: CONTROLLER-2131
Change-Id: Idb391ce8db69ddfcf530e7679761de414df0165e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 days agoEliminate ShardDataTree.CommitEntry 94/114294/6
Robert Varga [Fri, 1 Nov 2024 14:34:34 +0000 (15:34 +0100)]
Eliminate ShardDataTree.CommitEntry

We are only ever carrying SimpleShardDataTreeCohorts and keep additional
last access time.

Integrate the last access time into SimpleShardDataTreeCohort,
eliminating one level of indirection.

JIRA: CONTROLLER-2131
Change-Id: I3a1e7be49cc0ddcdb92e90e37ce17489ebeaa139
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 days agoRefactor ShardDataTree.processNextPending() 93/114293/6
Robert Varga [Fri, 1 Nov 2024 11:04:14 +0000 (12:04 +0100)]
Refactor ShardDataTree.processNextPending()

This is a match with possible removal of stale entries. Reduce confusion
by renaming it to findFirstEntry() and returning a nullable CohortEntry.

Callers then perform a simple null check instead of passing down a
lambda.

JIRA: CONTROLLER-2131
Change-Id: I39e35b6374ef1aa6d6c0c8bc2e32dd4d91263de6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 days agoCentralize StandaloneFrontendHistory identifier 97/114297/1
Robert Varga [Sat, 2 Nov 2024 09:42:57 +0000 (10:42 +0100)]
Centralize StandaloneFrontendHistory identifier

We have three callsites using historyId == 0. Centralize this assumption
in a dedicated method.

JIRA: CONTROLLER-2131
Change-Id: I36a02be078c6e9ad96fef44eee13283d00322562
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoFrontendClientMetadata is a plain record 92/114292/4
Robert Varga [Fri, 1 Nov 2024 10:12:02 +0000 (11:12 +0100)]
FrontendClientMetadata is a plain record

This is an immutable DTO: annotate it and make it a record.

Change-Id: I19ad27fad4821a86c6742b48cc1b41638ad60503
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoRemove FrontendClientMetadataBuilder.Disabled 91/114291/3
Robert Varga [Fri, 1 Nov 2024 09:59:22 +0000 (10:59 +0100)]
Remove FrontendClientMetadataBuilder.Disabled

Since metadata tracking cannot be disabled, it does not make sense to
have two implementations. Remove .Disabled and inline .Enabled into
FrontendClientMetadataBuilder, making it a final class.

Also improve annotations a bit.

Change-Id: Ie39ff1aa1a082fbf2714daa9dfcda49374f48b2d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoEliminate Ask-based messages 23/114223/33
Robert Varga [Mon, 28 Oct 2024 00:28:37 +0000 (01:28 +0100)]
Eliminate Ask-based messages

Since we are not servicing the messages, we can remove them.

JIRA: CONTROLLER-2129
Change-Id: Ia46ae004ef42391ee772891bdd7c63d666ae8456
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoEliminate ask-based support from Shard 20/114220/33
Robert Varga [Mon, 28 Oct 2024 00:19:38 +0000 (01:19 +0100)]
Eliminate ask-based support from Shard

This eliminates all the moving pieces in production code, leaving only
messages.

We also remove the remaining tests, notably ShardCommitCoordinationTest,
ShardTransactionFailureTest and ShardTransactionTest.

Replacement for ShardCommitCoordinationTest will come via a separate
issue, as we need to revisit how ShardDataTree.pendingTransactions work,
now that we only have properly-coordinated can-commit/pre-commit stages.

Replacement for ShardTransaction(Failure)Test will be submitted in a
separate patch.

JIRA: CONTROLLER-2129
Change-Id: I0161f0291fc5b27779c8304456cac800ac7c9e90
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoRemove unnecessary checkReady() 90/114290/1
Robert Varga [Fri, 1 Nov 2024 08:46:40 +0000 (09:46 +0100)]
Remove unnecessary checkReady()

We have already asserted state and have tthe ready handle -- use it
directly without touching state again.

Change-Id: Ic227300e83bb2171a8ed287aa5e007f8edd12aed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoRemove ActorUtils.broadcast() 83/114283/2
Robert Varga [Thu, 31 Oct 2024 10:44:59 +0000 (11:44 +0100)]
Remove ActorUtils.broadcast()

This method is not used anywhere: remove it.

Change-Id: Icf3bb19517516685e1ce6149123a7f5c4a57d1d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoIsolate Actor.getSender() references 73/114273/2
Robert Varga [Wed, 30 Oct 2024 16:32:18 +0000 (17:32 +0100)]
Isolate Actor.getSender() references

We *really* want to use replyTo-in-request pattern, so that we can
disconnect actors from their behaviours (a la Akka Typed).

In order to do that, we must get a handle on which places are relying on
Actor.sender() and hence this patch.

We mass-migrate callers of Actor.sender() to Actor.getSender() and
override AbstractActor.getSender() to be deprecated for removal -- which
flags all callsites with a deprecation warning.

Change-Id: Ib62d3ce90e8a345ea54c88f226ba0507676ef89c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoUse replyTo in GetBehaviorState 70/114270/4
Robert Varga [Wed, 30 Oct 2024 13:53:44 +0000 (14:53 +0100)]
Use replyTo in GetBehaviorState

This a test message, refactor it to use replyTo, ditching a getSender()
caller.

While we are here, modernize things -- notably using records and record
patterns.

Change-Id: Id0294e4359d0660f6c850e421cc59b8b3b0da168
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoRemove AbstractTest.waitOnAsyncTask() 82/114282/1
Robert Varga [Thu, 31 Oct 2024 10:36:07 +0000 (11:36 +0100)]
Remove AbstractTest.waitOnAsyncTask()

This method is unused and relies on FutureConverters: remove it.

Change-Id: I5a942019afc2796b451295d889c349c7a3130647
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoRemove common.actor.ExplicitAsk 81/114281/1
Robert Varga [Thu, 31 Oct 2024 10:33:11 +0000 (11:33 +0100)]
Remove common.actor.ExplicitAsk

This class is completely unused, remove it.

Change-Id: Ie67d7757c3500a3c9351e4acc7bec39307222b58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoRemove users of common.actor.ExplicitAsk 80/114280/2
Robert Varga [Thu, 31 Oct 2024 10:12:23 +0000 (11:12 +0100)]
Remove users of common.actor.ExplicitAsk

Akka's Java-based APIs work as they should, so ditch users of
ExplicitAsk and deprecate it for removal.

Change-Id: Icc2a21df26368f06b42c9c3978f289abce40cfde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize TestShard a bit 47/114247/2
Robert Varga [Tue, 29 Oct 2024 17:11:16 +0000 (18:11 +0100)]
Modernize TestShard a bit

Use switch to dispatch messages and various other small cleanups.

Change-Id: I107d949eb79ddf6d172476edb4a5d3d20cfca78f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize DataTreeChangeListenerActor a bit 62/114262/1
Robert Varga [Wed, 30 Oct 2024 10:49:32 +0000 (11:49 +0100)]
Modernize DataTreeChangeListenerActor a bit

Use a switch expression and add a FIXME around the use of getSender().

Change-Id: Ic9f25cb25499a9ee0e805e0b39a6da5d24e6a231
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoElectionTerm is always present 61/114261/1
Robert Varga [Wed, 30 Oct 2024 10:46:44 +0000 (11:46 +0100)]
ElectionTerm is always present

Add a @NonNull to indicate term information is always present.

Change-Id: Id57ec8366ec4be8863c7bb91a5bfe6238acf59a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoClean up AbstractShardBackendResolver 48/114248/2
Robert Varga [Tue, 29 Oct 2024 17:41:49 +0000 (18:41 +0100)]
Clean up AbstractShardBackendResolver

Multiple things:
- rename ShardState to ResolvingBackendInfo
- seal and make methods final
- use AbstractRegistration to allow multi-registration
- use enhanced switch where obvious

Change-Id: I68e5ad47b8c7f87201b329eaab73e66063305874
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse scheduleWithFixedDelay() for commit timeout 45/114245/1
Robert Varga [Tue, 29 Oct 2024 15:56:26 +0000 (16:56 +0100)]
Use scheduleWithFixedDelay() for commit timeout

Remove use of deprecated methods by using Java's Duration and pick the
superior strategy to prevent bursts.

Change-Id: Ib999135c503bc864081e5ad8f9f8326f1bc5987d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMigrate ShardTest et al. to use cds-access-api 07/114207/57
Robert Varga [Fri, 25 Oct 2024 20:40:43 +0000 (22:40 +0200)]
Migrate ShardTest et al. to use cds-access-api

This patch adds ShardTestKit.connect() which returns
a ShardTestConnection, which we use to drive Shard through
cds-access-api.

Also mass-migrate tests to use this facility, minimizing ask-based
protocol use in tests.

JIRA: CONTROLLER-2129
Change-Id: I9e1ddb31602c24f10ab5425f18b00f4ea9d28ca0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix ShardDataTree transaction counters 10/114210/44
Robert Varga [Fri, 25 Oct 2024 21:29:03 +0000 (23:29 +0200)]
Fix ShardDataTree transaction counters

ShardDataTree is not consistently updating its counters, fix that.

Change-Id: I08db7ea2d3735eaedd8de6efbae29315f7b84d04
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse a switch expression to dispatch server configuration 38/114238/3
Robert Varga [Mon, 28 Oct 2024 20:24:53 +0000 (21:24 +0100)]
Use a switch expression to dispatch server configuration

RaftActorServerConfigurationSupport uses an if/else cascade, which we
can easily replace with switch expression.

Change-Id: Ib570d8a3dd2ddac1d8dbe7ba3907b19875fb99c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse a swtich to dispatch recovery messages 37/114237/3
Robert Varga [Mon, 28 Oct 2024 20:23:52 +0000 (21:23 +0100)]
Use a swtich to dispatch recovery messages

RaftActorRecoverySupport has an if/else cascade, replace it with switch.

Change-Id: I278b04fd0889f10d2789daab376e3d83bcc2edfd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRefactor ShardStats 15/114215/23
Robert Varga [Sat, 26 Oct 2024 10:21:22 +0000 (12:21 +0200)]
Refactor ShardStats

We have two views here:
- ShardStatsMXBean, which is mostly read-only
- ShardStats, which is updatable

Separate the two, with ShardStats being really holder of counters etc.
This allows us to successfully wire Shard(DataTree) even then mocking.

Change-Id: Ie902a7cf8a9458285d4a9efeed3c6fe4659fb08a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove superfluous ShardTest tests 16/114216/28
Robert Varga [Sat, 26 Oct 2024 13:01:46 +0000 (15:01 +0200)]
Remove superfluous ShardTest tests

testCreateTransaction(OnChain)'s functionality has no
equivalent in Tell-based protocol. Remove these both.

testBatchedModificationsReadyWithIncorrectTotalMessageCount() tests just
an ask-based ordering specific -- we account for that through Envelope
sequencing instead.

testOnBatchedModificationsWhenNotLeader() is not applicable -- this test
scenario indicates NotLeaderException during connect -- and we already
check for that.

JIRA: CONTROLLER-2129
Change-Id: I7e19cc63a99873e8190c69aacb9bd3997df679cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMigrate ModuleShardBackendResolverTest to JUnit5 33/114233/2
Robert Varga [Mon, 28 Oct 2024 16:24:31 +0000 (17:24 +0100)]
Migrate ModuleShardBackendResolverTest to JUnit5

Clean up the test, its mocking and its use of futures -- eliminating
warnings and hopefully stabilizing testGetBackendInfoFail().

Change-Id: I5989ec98f89ab58ca9a1dbab258e51043cde9907
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd RegisterForShardAvailabilityChanges.toString() 30/114230/2
Robert Varga [Mon, 28 Oct 2024 12:57:13 +0000 (13:57 +0100)]
Add RegisterForShardAvailabilityChanges.toString()

Make it easier to identify registration by printing where the callback
points to.

Change-Id: Id969e1dbd8b27e6c50c712028c890d9e1b9f7471
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize TransactionTester 29/114229/4
Robert Varga [Mon, 28 Oct 2024 09:40:40 +0000 (10:40 +0100)]
Modernize TransactionTester

Use assertInstanceOf() and make the code smaller.

Change-Id: I2be41f7d9484c3a006ce8d80b0bc09114a6dad85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoChange RaftActor.getRoleChangeNotifier() 22/114222/11
Robert Varga [Mon, 28 Oct 2024 02:16:32 +0000 (03:16 +0100)]
Change RaftActor.getRoleChangeNotifier()

Rename this method to roleChangeNotifier() and return a @Nullable, which
makes it easier to interact with.

Change-Id: I707b40b95a94a6fc35ba871ece088d3a9f2ecb15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoClean up ClientTransaction 25/114225/5
Robert Varga [Mon, 28 Oct 2024 02:55:44 +0000 (03:55 +0100)]
Clean up ClientTransaction

Use a switch expression and local variable type inference. While we are
here, also convert the sole checkState() user into an explicit exception
throw.

Change-Id: I6001fab0546c1ad952b40cdd62076ce8a18a68b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize AbstractProxyTransaction 28/114228/3
Robert Varga [Mon, 28 Oct 2024 04:41:01 +0000 (05:41 +0100)]
Modernize AbstractProxyTransaction

Use local variable type inference, instanceof patterns and enhanced
switches.

Change-Id: I00a697ea652fb1f2428d20c339ddeb4cbd6f4869
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoInline LocalProxyTransaction.handleReadRequest() 32/114232/1
Robert Varga [Mon, 28 Oct 2024 13:24:24 +0000 (14:24 +0100)]
Inline LocalProxyTransaction.handleReadRequest()

The two callers are calling this method from a switch expression: split
the two handled messages into separate methods and inline dispatch.

Change-Id: I2c3551db1404960930f369278aed29e038d83d61
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize LocalReadWriteProxyTransaction 27/114227/1
Robert Varga [Mon, 28 Oct 2024 04:21:19 +0000 (05:21 +0100)]
Modernize LocalReadWriteProxyTransaction

Use local variable type inference as well as enhanced switch statement.

Change-Id: I0de3e839e72ac189708a2337cbc3e9a6c09e9bf8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize LocalProxyTransaction 26/114226/2
Robert Varga [Mon, 28 Oct 2024 04:02:18 +0000 (05:02 +0100)]
Modernize LocalProxyTransaction

Use enhanced switches and instanceof patterns. Also improve
{enqueue.send}Abort() methods.

Change-Id: I372bc39b02a4ad804f068d4cc3511fb7fe277619
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSeal FrontendTransaction 19/114219/3
Robert Varga [Sun, 27 Oct 2024 16:59:05 +0000 (17:59 +0100)]
Seal FrontendTransaction

We only have ReadOnly and ReadWrite subclasses, make sure that is
enforced.

Change-Id: I05a3685d749986db866dc79118a28e887b4c983e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse a switch expression FrontendReadOnlyTransaction 18/114218/4
Robert Varga [Sun, 27 Oct 2024 16:50:01 +0000 (17:50 +0100)]
Use a switch expression FrontendReadOnlyTransaction

We have an if/else instanceof dispatch: use a switch expression instead.

Change-Id: I9ea5dca347ce807034b02d0e2c9f40e47ef82405
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSeal cluster.access.concepts.Envelope 14/114214/1
Robert Varga [Sat, 26 Oct 2024 09:42:50 +0000 (11:42 +0200)]
Seal cluster.access.concepts.Envelope

This interface can be one of three things:
- RequestEnvelope, or
- ResponseEnvelope, being one of
  - FailureEnvelope
  - SuccessEnvelope

Change-Id: I45c2e35867f1deb9a057700c7a4a93d2f2258c15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoClean up testBatchedModificationsReadyWithIncorrectTotalMessageCount() 11/114211/2
Robert Varga [Fri, 25 Oct 2024 23:25:17 +0000 (01:25 +0200)]
Clean up testBatchedModificationsReadyWithIncorrectTotalMessageCount()

Use assertInstanceOf() instead of @Test(expected).

Change-Id: If9c0fb3b9117a9100536ccda50ae82b12ee60aa6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoClean up sal-distributed-datastore dependencies 99/114199/4
Robert Varga [Fri, 25 Oct 2024 16:10:38 +0000 (18:10 +0200)]
Clean up sal-distributed-datastore dependencies

This is a minor clean up of declared dependencies, reducing the number
of warnings we get.

Change-Id: I19de3665022c43adbc0277452f29ef91af8a1337
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup AbstractFrontendHistory 09/114209/4
Robert Varga [Fri, 25 Oct 2024 22:09:43 +0000 (00:09 +0200)]
Cleanup AbstractFrontendHistory

Two things:
- use a switch expression to dispatch createTransaction()
- use persistenceId directly

Change-Id: I7e64997b87b06cc749d54cb5d0b73ef00191e4e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup ShardTest 06/114206/3
Robert Varga [Fri, 25 Oct 2024 19:44:39 +0000 (21:44 +0200)]
Cleanup ShardTest

We have a warning suppression and an unnecessarily-long reference to
ActorRef.noSender(). Clean that up.

Change-Id: I626635b60ef66473138d9a6d56502f07d1dd4c40
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoClarify ShardTest.testAbortWithCommitPending() 08/114208/5
Robert Varga [Fri, 25 Oct 2024 20:59:01 +0000 (22:59 +0200)]
Clarify ShardTest.testAbortWithCommitPending()

Use an explicit equals() assertion, to make it clear what content we
expect.

Change-Id: I2b848c4ddec1f29e648abf8109e004848605fad9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse a switch expression in Shard.handleRequest() 13/114213/2
Robert Varga [Sat, 26 Oct 2024 07:10:59 +0000 (09:10 +0200)]
Use a switch expression in Shard.handleRequest()

We have an instanceof cascade, turn it into a switch expression.

Change-Id: I21964a15ea985b9fbbeb9152e04df1791bb099c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoDeprecate legacy AbstractShardTest methods 05/114205/2
Robert Varga [Fri, 25 Oct 2024 19:26:39 +0000 (21:26 +0200)]
Deprecate legacy AbstractShardTest methods

We have four utilities producing BatchedModifications. Deprecate them to
guide test removal.

Change-Id: I9b9be88d859b07e97bcc77e2c8b9791a1db0c355
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize TestModel 04/114204/3
Robert Varga [Fri, 25 Oct 2024 19:08:26 +0000 (21:08 +0200)]
Modernize TestModel

Expose better interface for building common NormalizedNodes, which has a
neat impact on test verbosity. Reduction in deprecation warnings is a
nice by-product.

Change-Id: I370dd9a2e5f1a61a7a6e72f991f9bf1922801231
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRename getStatRetrievaelTime() 00/114200/2
Robert Varga [Fri, 25 Oct 2024 16:28:20 +0000 (18:28 +0200)]
Rename getStatRetrievaelTime()

This contains a typo, rename it to stateRetrievalTime().

Change-Id: Ia2d49a3cf445ceeb1234c740844c1608ad3ee51d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse switch patterns in RemoteProxyTransaction 97/114197/1
Robert Varga [Fri, 25 Oct 2024 15:20:03 +0000 (17:20 +0200)]
Use switch patterns in RemoteProxyTransaction

We have two if/else instanceof cascades, replace them with a switch to
make things clearer.

Change-Id: I7f49215ab9037d6d145a2e83d97893e8457f76dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoImprove Status.Failure references 96/114196/1
Robert Varga [Fri, 25 Oct 2024 15:05:06 +0000 (17:05 +0200)]
Improve Status.Failure references

Just import the class rather than referencing it via FQCN.

Change-Id: I056de82d6d2146cacfe688b4ffbcc9b4bdc29ecf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMake ModifyTransactionRequestBuilder fluent 95/114195/1
Robert Varga [Fri, 25 Oct 2024 14:45:05 +0000 (16:45 +0200)]
Make ModifyTransactionRequestBuilder fluent

We really want to have builders fluent, so they are easy to use anywhere
we need their product.

This patch makes ModifyTransactionRequestBuilder fluent, adding a
ModifyTransactionRequest.builder() static factory method as well.

Change-Id: Ib3c76afe04d10da55ff4301490e6d9c1a22374ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd TestModel.EMPTY_TEST 93/114193/1
Robert Varga [Fri, 25 Oct 2024 14:12:50 +0000 (16:12 +0200)]
Add TestModel.EMPTY_TEST

This is a useful empty container, which is used all over tests. Add a
constant and refer to it wherever appropriate.

Change-Id: I3f7feff3d854ddbacde9bc9358a580b5577ac6de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSimplify test data preparation 92/114192/1
Robert Varga [Fri, 25 Oct 2024 13:01:33 +0000 (15:01 +0200)]
Simplify test data preparation

Do not instantiate Modification just to invoke things on
DataTreeModification -- do that directly instead.

Change-Id: Ibb93402c7c7fc9a5990878adad8fce97a04abef4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRefactor Status.Failure references 91/114191/1
Robert Varga [Fri, 25 Oct 2024 12:53:28 +0000 (14:53 +0200)]
Refactor Status.Failure references

Import Status.Failure and use an instanceof pattern to eliminate
explicit casts.

Change-Id: Ic25fe369761fe738932591812ed3c1cbd907fb65
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoEliminate another prepareBatchedModifications() method 90/114190/1
Robert Varga [Fri, 25 Oct 2024 12:46:43 +0000 (14:46 +0200)]
Eliminate another prepareBatchedModifications() method

We are using this method only indirectly, merge it into its sole caller.

Change-Id: Ic414449778eead545cfbf7b713a307b8f0e429f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse newBindingDataCodec() 89/114189/1
Robert Varga [Fri, 25 Oct 2024 12:43:08 +0000 (14:43 +0200)]
Use newBindingDataCodec()

Use the more modern version of codec instantiation.

Change-Id: Ia4e9621365d1c22b849c99c1e9c5fc8dfef7f57c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize sal-distributed-datastore 88/114188/2
Robert Varga [Fri, 25 Oct 2024 11:10:18 +0000 (13:10 +0200)]
Modernize sal-distributed-datastore

Reduce the use of deprecated constructs, so that we have a tad fewer
warnings.

Change-Id: Ifba929b72052de85097e1b8d993cdb1bf3dda32b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMove {merge,store}ToStore() 86/114186/2
Robert Varga [Fri, 25 Oct 2024 10:47:58 +0000 (12:47 +0200)]
Move {merge,store}ToStore()

These methods are used in only one test, move them there.

Change-Id: I1b40346227990f65aaa6baf06f534f853a7acaa1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove unused prepareBatchedModifications() 85/114185/2
Robert Varga [Fri, 25 Oct 2024 10:37:06 +0000 (12:37 +0200)]
Remove unused prepareBatchedModifications()

We are not using this method, remove it.

Change-Id: If2eca3cd6c740ed155ff889edb4dd1f4f6d581a2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump Pekko to 1.0.3 78/112878/15
Ivan Hrasko [Mon, 29 Jul 2024 10:40:02 +0000 (12:40 +0200)]
Bump Pekko to 1.0.3

https://github.com/apache/pekko/releases/tag/v1.0.3
https://github.com/apache/pekko/blob/main/docs/src/main/paradox/release-notes/releases-1.0.md

The most important change is the ability to run Akka and Pekko
clusters together:
https://cwiki.apache.org/confluence/display/PEKKO/Pekko+Akka+Compatibility

There is no need to update asn, agrona, aeron, ssl-config and config
versions because they are the same like in 1.0.2:
https://github.com/apache/pekko/blob/main/project/Dependencies.scala

JIRA: CONTROLLER-2120
Change-Id: Id99162dd2795685ffbeeaa1f014d8bf58549d9ff
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
2 weeks agoRemove deprecated ReplicatedLogEntry methods 63/113563/2
Robert Varga [Wed, 18 Sep 2024 16:01:56 +0000 (18:01 +0200)]
Remove deprecated ReplicatedLogEntry methods

getIndex()/getTerm() have no callers, remove them.

Change-Id: I6a498eda09bb1f26541ff1278e74c99a65328d30
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMigrate to Apache Pekko 58/111858/33
Ivan Hrasko [Mon, 27 May 2024 07:44:26 +0000 (09:44 +0200)]
Migrate to Apache Pekko

Migrate to Apache Pekko 1.0.2 according to:
https://pekko.apache.org/docs/pekko/current/project/migration-guides.html

To make the transition smooth we have replaced Akka with Pekko
in repackaged-akka package and renamed it to repackaged-pekko.

Pekko is changing configuration files as well, mostly
akka is changed to pekko. Thus we have introduced updated files
under new names - pekko.conf, factory-pekko.conf, etc.
See also: https://github.com/apache/pekko

We have copy-pasted *_reference.conf files from Pekko, they are
changing akka to pekko naming mostly except of:
- some Pekko ports are different that akka's
- 2552 has changed to 7355
- 25520 has changed to 17355
We do not expect this would have impact on end-users.

The only change we have made in reference files is that we have
allow-java-serialization = on enabled by default.

Apache akka licence has been changed to Apache pekko licence.

JIRA: CONTROLLER-2120
Change-Id: I2c71d939dbf7fb277e03a85de4ca04b9333ff211
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 11.0.0-SNAPSHOT 05/113805/2
Robert Varga [Thu, 24 Oct 2024 12:02:10 +0000 (14:02 +0200)]
Bump versions to 11.0.0-SNAPSHOT

This starts the next development iteration.

Change-Id: I2854b1930d251f4aeb66bbc0202ff8cdbc6a0acf
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoBump versions to 10.0.5-SNAPSHOT 18/114118/1
Robert Varga [Tue, 22 Oct 2024 04:51:43 +0000 (06:51 +0200)]
Bump versions to 10.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: I13850fc2989f95acaed71387879fd53fdcc33243
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRelease controller v10.0.4
jenkins-releng [Mon, 21 Oct 2024 17:03:02 +0000 (17:03 +0000)]
Release controller

3 weeks agoBump mdsal to 14.0.4 12/114112/1
Robert Varga [Mon, 21 Oct 2024 09:41:57 +0000 (11:41 +0200)]
Bump mdsal to 14.0.4

Pick up latest fixes from upstream.

Change-Id: I4accbd9d19bf6b3d861a6a90a2f9bfb8c4917249
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoUse FluentFutures.submit() 66/114066/2
Robert Varga [Thu, 17 Oct 2024 15:35:40 +0000 (17:35 +0200)]
Use FluentFutures.submit()

We do not need to decorate the executor -- just use
FluentFutures.submit(), which does the right thing with a plain
Executor.

Change-Id: Ie335a9febf0b1b5d240ba749d300190f15d2cb5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSeal cluster.access.concepts.Message 41/114041/4
Robert Varga [Wed, 16 Oct 2024 19:15:31 +0000 (21:15 +0200)]
Seal cluster.access.concepts.Message

We have 4 different specializations of a Message, make sure we have that
captured in the class hierarchy.

Change-Id: I599441561083fa7365743860943fca78d8aada15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoImprove FrontendReadWriteTransaction.doHandleRequest() 40/114040/3
Robert Varga [Wed, 16 Oct 2024 19:10:39 +0000 (21:10 +0200)]
Improve FrontendReadWriteTransaction.doHandleRequest()

Use a switch expression to dispatch on message types, improving code
density and safety.

Change-Id: I1e2a732cd2f64f9ceb2c624b3e0c365ef6f5e241
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoImprove FrontendReadWriteTransaction transitions 39/114039/3
Robert Varga [Wed, 16 Oct 2024 19:00:26 +0000 (21:00 +0200)]
Improve FrontendReadWriteTransaction transitions

We can use a simple trick to force switches to be exhaustive. Use it to
improve our defensiveness.

Change-Id: Ife894796505927b25627c65aefd25f6029e24189
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSeal TransactionModification 38/114038/4
Robert Varga [Wed, 16 Oct 2024 18:50:30 +0000 (20:50 +0200)]
Seal TransactionModification

We have a trivial class hierarchy. Seal it to allow for exhaustive
handling.

Change-Id: I99141eebeb2894d49f477927c115263ffd4c19fd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoImprove FrontendReadWriteTransactionTest 55/114055/1
Robert Varga [Thu, 17 Oct 2024 11:29:50 +0000 (13:29 +0200)]
Improve FrontendReadWriteTransactionTest

Use explicit assertions instead of expected throws.

Change-Id: I20ddafb8fb5ad13f1c310805cb52cf5ce991702c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoModernize FrontendReadWriteTransaction 37/114037/2
Robert Varga [Wed, 16 Oct 2024 18:44:17 +0000 (20:44 +0200)]
Modernize FrontendReadWriteTransaction

Use switch expressions and local variable type inference to improve code
defensiveness.

Change-Id: I7eeb8220061a57862126300a478a4ce16f13bb7a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoUse exhaustive switches in DTC-IO 34/114034/2
Robert Varga [Wed, 16 Oct 2024 17:08:29 +0000 (19:08 +0200)]
Use exhaustive switches in DTC-IO

We can force the switch to be an exhaustive thing, and thus can ditch a
bit of unused exception code.

Change-Id: Ifdcc003be86c71748df862f1e2795b67009aeaf2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoImprove DataTreeCandidateInputOutput 33/114033/2
Robert Varga [Wed, 16 Oct 2024 17:03:03 +0000 (19:03 +0200)]
Improve DataTreeCandidateInputOutput

Report an explicit IOException when we encounter a problem.

Change-Id: I9f70b8f23889ae6f8b8294f187d51a44250c6b65
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoUse Empty.immediateFuture() 28/114028/1
Robert Varga [Wed, 16 Oct 2024 12:19:38 +0000 (14:19 +0200)]
Use Empty.immediateFuture()

We have a nice utility method, use that instead of brewing our own
constants.

Change-Id: Ifa504f80342907a95950cbbdaff399a72d599fcc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoBump versions to 10.0.4-SNAPSHOT 61/113961/1
Robert Varga [Sat, 12 Oct 2024 09:28:20 +0000 (11:28 +0200)]
Bump versions to 10.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I0bfbda04a3c0520c5f9113739844ed70bdf980eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRelease controller v10.0.3
jenkins-releng [Sat, 12 Oct 2024 07:21:45 +0000 (07:21 +0000)]
Release controller

4 weeks agoBump upstreams 16/113916/3
Robert Varga [Wed, 9 Oct 2024 05:56:50 +0000 (07:56 +0200)]
Bump upstreams

Adopt:
- odlparent-14.0.4
- yangtools-14.0.5
- mdsal-14.0.3

Change-Id: I57f42b186fc6b510ddf0b33e1b5f6935f3fca29e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoFix checkstyle violations 53/113953/1
Robert Varga [Fri, 11 Oct 2024 14:53:02 +0000 (16:53 +0200)]
Fix checkstyle violations

Upgraded checkstyle is finding these, fix them up.

Change-Id: I5688232baf2b6ba5c19ef6784cb856522cce9ec6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoMake state/odl.cluster.client a directory 03/113903/2
Robert Varga [Tue, 8 Oct 2024 15:26:01 +0000 (17:26 +0200)]
Make state/odl.cluster.client a directory

We want to be grouping things and not proliferate properties too much.
Make odl.cluster.client a directory and then use member-name to create
another level.

JIRA: CONTROLLER-2116
Change-Id: I710ff2d8bc75523a41c9b3d05ceff5bc612d08d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoModernize BucketStoreActor a bit 04/113904/1
Robert Varga [Tue, 8 Oct 2024 15:45:59 +0000 (17:45 +0200)]
Modernize BucketStoreActor a bit

Use local variable type inference to clean things up a bit.

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