controller.git
10 months agoRemove JournalReader.getCurrentIndex() 23/111023/1
Robert Varga [Mon, 25 Mar 2024 07:34:32 +0000 (08:34 +0100)]
Remove JournalReader.getCurrentIndex()

This method is used only in tests and has the weird 'or 0' return.
Refactor test asserts and remove this method.

Change-Id: If397f2398e75d08de867cf4c674a1dd14e8add30
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 54cfea6258d62114fea95acdc20514dbad079c2a)

10 months agoRefactor JournalSegmentReader 22/111022/1
Robert Varga [Sat, 23 Mar 2024 21:00:34 +0000 (22:00 +0100)]
Refactor JournalSegmentReader

We have almost-duplicated code in {Disk,Mapped}JournalSegmentReader,
which looks very similar to what DiskJournalSegmentWriter revolves
around.

JournalSegmentReader revolves around tracking current position and
interpreting bytes read. Its specializations provide the means for
access.

JIRA: CONTROLLER-2109
Change-Id: I80b78cde5baf6b222d888e635dd5c854331f261a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7f3eb922fce09a366143387ee71bf6f10b698473)

10 months agoDo not use ByteBufferInput 21/111021/1
Robert Varga [Mon, 25 Mar 2024 07:05:59 +0000 (08:05 +0100)]
Do not use ByteBufferInput

ByteBufferInput ends up calling ByteBuffer.put() in readAscii(). Work
this around by integrating through InputStream. Not exactly nice, but
the best we can do right now.

JIRA: CONTROLLER-2109
Change-Id: I182c3cefb97ada0cd9fdc2b7440256f38341df5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9d980ed146bc4a7b5eede803b9d2450afb3c421f)

10 months agoMove entry tracking to SegmentedJournalReader 20/111020/1
Robert Varga [Sat, 23 Mar 2024 13:51:23 +0000 (14:51 +0100)]
Move entry tracking to SegmentedJournalReader

We have duplicated state tracking just because JournalSegmentReader used
to provide the same API as SegmentedJournalReader.

Rehost tracking the next index and current entry into
SegmentedJournalReader, making it more obvious as to what is going on.

This allows Indexed to enforce the entry being non-null, as we do not
have to use a fake entry anymore.

JIRA: CONTROLLER-2109
Change-Id: I9ebd50fde94d695bb62315bba1b6adb1235b37f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 88a1e0bc7269500b63f519e20145ae6f751485f1)

10 months agoSimplify JournalSegmentReader entry access 19/111019/1
Robert Varga [Sat, 23 Mar 2024 12:27:22 +0000 (13:27 +0100)]
Simplify JournalSegmentReader entry access

The only user is SegmentedJournalReader, which is using these methods to
implement its tryNext() operation.

Mirror this with JournalSegmentReader.tryNext(), which simplifies some
of the logic.

JIRA: CONTROLLER-2109
Change-Id: Id104743b16199b4734b322d1397b85280f03346b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 926877f74ff564663d1e892cbad4c13a25e7e373)

10 months agoJournalIndex.truncate() should return last entry 18/111018/1
Robert Varga [Thu, 21 Mar 2024 08:47:32 +0000 (09:47 +0100)]
JournalIndex.truncate() should return last entry

The only time we are calling truncate(), we are following up with a seek
to the appropriate entry.

Return the last indexed position from truncate(), so we can do better
than a linear search.

JIRA: CONTROLLER-2109
Change-Id: I701b0eefbf1f4d83f74ba95b93c41407289d95cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2a6738b69c763377d1f727da9876ffdd9058262f)

11 months agoMove ENTRY_HEADER_BYTES 54/110954/1
Robert Varga [Wed, 20 Mar 2024 15:52:24 +0000 (16:52 +0100)]
Move ENTRY_HEADER_BYTES

We have SegmentEntry.HEADER_BYTES instead of ENTRY_HEADER_BYTES.

JIRA: CONTROLLER-2109
Change-Id: I4bc66155dccd3e177a61bad28be50e0bc62827ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 479ecb0109aaa1c8682dd083600b777cbd68dc07)

11 months agoIntroduce SegmentEntry 53/110953/1
Robert Varga [Wed, 20 Mar 2024 00:52:54 +0000 (01:52 +0100)]
Introduce SegmentEntry

This is a helper DTO to communicate CRC32 and a buffer slice during
DiskJournalSegmentWriter's indexing.

This allows us improve the reset(long) loop to a manageable size, which
is mostly self-explanatory.

JIRA: CONTROLLER-2109
Change-Id: Ife1bddaf7684a304a0e7cdfd24ca9e774ac5143d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c5e8613d497b97e32484b96f4bf1761cddc0d441)

11 months agoImprove disk entry access 52/110952/1
Robert Varga [Sun, 17 Mar 2024 11:22:10 +0000 (12:22 +0100)]
Improve disk entry access

Eliminate superfluous compactions while a complete entry is available.
This is done by carefully looking at the buffer and figuring out how
many bytes we actually need progress.

JIRA: CONTROLLER-2109
Change-Id: If091b5c6f74da6a989629dae49137ed492725e2d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ffa5f509ead53e7867ceeae9594e6b9906cf5da6)

11 months agoSegmentJournal.log is static 51/110951/1
Robert Varga [Wed, 20 Mar 2024 01:16:42 +0000 (02:16 +0100)]
SegmentJournal.log is static

This is derived from getClass() on a final class -- hence we can
amortize the logger into a static field, from whence it will be
constant-propagated.

Change-Id: Idcc6cf2d86c5ae687694fa5c16089687ac4a949a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b73237d7cfc9067dbeaed9dc7c602ee78884d002)

11 months agoBump versions to 8.0.6-SNAPSHOT 70/110870/1
Robert Varga [Tue, 19 Mar 2024 13:31:46 +0000 (14:31 +0100)]
Bump versions to 8.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: Idf294275ab997cd6bd98b5196cb693267ec4b29c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoRelease controller v8.0.5
jenkins-releng [Tue, 19 Mar 2024 12:06:12 +0000 (12:06 +0000)]
Release controller

11 months agoBump upstreams 64/110864/1
Robert Varga [Tue, 19 Mar 2024 11:16:54 +0000 (12:16 +0100)]
Bump upstreams

Adopt:
- odlparent-13.0.11
- yangtools-11.0.6
- mdsal-12.0.5

Change-Id: I169174144cff41d84774ea4ef6d8573198a3e3b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoChange FileChannel prefix to Disk 63/110763/1
Robert Varga [Fri, 15 Mar 2024 12:26:10 +0000 (13:26 +0100)]
Change FileChannel prefix to Disk

We use FileChannelJournalSegment{Reader,Writer} for StorageLevel.DISK,
and Mapped* for StorageLevel.MAPPED.

Fix this by a quick rename to DiskJournaSegment{Reader,Writer},
improving internal consistency and shortening class names.

Change-Id: Ia6d7311ed93527ff77cde3f7b57bb34689f962cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1ecb4cd57462ff762de03ac89311cd4887ded651)

11 months agoAdd PANTHEON.tech copyright headers 62/110762/1
Robert Varga [Fri, 15 Mar 2024 12:20:47 +0000 (13:20 +0100)]
Add PANTHEON.tech copyright headers

These files have been significantly altered and hence deserve a
contributor copyright with a fresh year.

JIRA: CONTROLLER-2105
Change-Id: Ieceb00a54d204db5ba8bb92971a719f2b0815c59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 3924193f0176e3f114a2dc82e45a49a684fe2375)

11 months agoNormalized copyright header 61/110761/1
Robert Varga [Fri, 15 Mar 2024 12:10:18 +0000 (13:10 +0100)]
Normalized copyright header

Use a closed range and our standard 'and others' moniker.

JIRA: CONTROLLER-2105
Change-Id: I868b02415666da378f395ff711d5092a334d0196
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 046b4f0ce6d29eb651c12e85bd9907732b5fff06)

11 months agoFuther improvements to ByteBuffer invocations 60/110760/1
Robert Varga [Fri, 15 Mar 2024 11:13:18 +0000 (12:13 +0100)]
Futher improvements to ByteBuffer invocations

MappedJournalSegmentWriter should take advantage of fluent APIs of
ByteBuffer.

JIRA: CONTROLLER-2097
Change-Id: If12fe247bd08db450e00ea9878ecfafb7f75596b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2512ece32bd3452bf873176168711d1d270b2966)

11 months agoCentralize entry header size 59/110759/1
Robert Varga [Fri, 15 Mar 2024 11:09:13 +0000 (12:09 +0100)]
Centralize entry header size

We jave 'Integer.BYTES + Integer.BYTES' strewn all across the code,
centralize this constant into a single place.

JIRA: CONTROLLER-2098
Change-Id: If15f944db20b01767ca387f652ddf11fed64e2fa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 129be44b99a5e436beb30008552729b7f9583514)

11 months agoMake JournalSegmentWriter.getNextIndex() final 58/110758/1
Robert Varga [Fri, 15 Mar 2024 10:11:11 +0000 (11:11 +0100)]
Make JournalSegmentWriter.getNextIndex() final

We have duplicated code between the two implementations. Centralize it
to the common superclass.

JIRA: CONTROLLER-2098
Change-Id: I84b1a1d716c2ccbaaf2f75e3728bcbad0aa05ec6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b73ab4c9bbb2e80fc191d35c410a89a7774938dd)

11 months agoMake JournalSegmentWriter.getLastIndex() final 57/110757/1
Robert Varga [Fri, 15 Mar 2024 10:05:21 +0000 (11:05 +0100)]
Make JournalSegmentWriter.getLastIndex() final

We have duplicated code between the two implementations. Centralize it
to the common superclass.

JIRA: CONTROLLER-2098
Change-Id: I805e882566d8f891c23a1f25143d453c94284cd1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f9f7739e90523361e38406d7df15cd99337219c5)

11 months agoImprove ByteBuffer invocations 56/110756/1
Robert Varga [Fri, 15 Mar 2024 09:58:55 +0000 (10:58 +0100)]
Improve ByteBuffer invocations

ByteBuffer has a fluent API, returning the same buffer from methods
which do not return something else.

Take advantage of this a chain invocations, resulting in denser byte
code.

JIRA: CONTROLLER-2097
Change-Id: Ic744e5e4f4d8c3fec5026f9d7edc58b7a5387c0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d65837cffb7128b7a790eca9c73d5d8fabc3da57)

11 months agoImprove FileChannelJournalSegmentWriter's buffer management 55/110755/1
Oleksandr Zharov [Thu, 14 Mar 2024 13:46:11 +0000 (14:46 +0100)]
Improve FileChannelJournalSegmentWriter's buffer management

Minor refactor of logic in FileChannelJournalSegmentWriter class.
Removed unnecessary buffer clearing after each entry. New logic
remove already proccesed entry from the buffer and if needed reads
new data from FileChannel to it's capacity.

JIRA: CONTROLLER-2097
Change-Id: I571d531437b068cd468bdc92b3ab6a4223450a45
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
(cherry picked from commit bb9ef9945ec33f0025a4a426f44c416fb1e0531f)

11 months agoUse correct JournalSegmentWriter for initial indexing 54/110754/1
Robert Varga [Fri, 15 Mar 2024 08:11:41 +0000 (09:11 +0100)]
Use correct JournalSegmentWriter for initial indexing

JournalSegment should look at StorageLevel and pick the appropriate
writer instead of always using FileChannelJournalSegment.

JIRA: CONTROLLER-2099
Change-Id: I060618a2808a837214b5ae61f4860f329c1799f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 14a4cbf04ff2df99027bcaa6167e39394c4091ad)

11 months agoJournalReader is not an Iterator 16/110716/1
Robert Varga [Wed, 13 Mar 2024 12:32:07 +0000 (13:32 +0100)]
JournalReader is not an Iterator

Iterator dictating a two method API, which is not quite appropriate, as
the writer could be manipulated between hasNext() and next() methods --
and next() has to perform validation again.

Introduce JournalReader.tryNext(), which returns a @Nullable Indexed --
either the next entry (as next()), or null (indicating !hasNext() case).

JIRA: CONTROLLER-2106
Change-Id: Ie0338a9869ece8e6381ae719a29e97fd569b442f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit cfe137aaad17ccc691f25ce517bf83a765216b63)

11 months agoCatch JournalReader.next() violations in Mode.COMMITS 04/110704/1
Robert Varga [Wed, 13 Mar 2024 09:39:30 +0000 (10:39 +0100)]
Catch JournalReader.next() violations in Mode.COMMITS

JournalReader.next() is specified as an Iterator and should be throwing
NSEs. This is not the case when we ask for only commits, as the
corresponding check is done only in hasNext() and thus we would give out
uncommitted entries.

Fix this by adding an override to check for this condition.

JIRA: CONTROLLER-2106
Change-Id: I1f391cc19b9674646786c93656b83519e0f1f47b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 86ff19a91c2d4aa71f88135898ebc75fd3caee85)

11 months agoUse try-with-resources in testCompactAndRecover 03/110703/1
Robert Varga [Wed, 13 Mar 2024 09:24:36 +0000 (10:24 +0100)]
Use try-with-resources in testCompactAndRecover

Eclipse is flagging a warning here, make sure we silence it.

Change-Id: I7bfa9d490e8b9b71bf04511bc42d6d101345b179
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 10622ac62c756d5cacef0f32cb567a128712bbf1)

11 months agoCache reader's nextIndex during reset() 02/110702/1
Robert Varga [Wed, 13 Mar 2024 08:50:03 +0000 (09:50 +0100)]
Cache reader's nextIndex during reset()

JournalSegmentReader.getNextIndex() involves some computation, so do not
call it twice when deciding how to reset SegmentedJournalReader.

JIRA: CONTROLLER-2106
Change-Id: I7527d8f0c47d35b7a59c30558715204a85b24eae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4aa75b385d864cff4409d47264453324b4150fa7)

11 months agoRemove JournalSegmentReader.getCurrentIndex() 01/110701/1
Robert Varga [Wed, 13 Mar 2024 07:45:42 +0000 (08:45 +0100)]
Remove JournalSegmentReader.getCurrentIndex()

This method is only ever called by SegmentedJournalReader, inline it
there. This removes one source of the magic 0 index.

JIRA: CONTROLLER-2106
Change-Id: I0fcb16e806d027d22f8e6370788aab21884c9e71
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b428d29dff287a47dfacc5d02143ac62324169c5)

11 months agoModernize Indexed 00/110700/1
Robert Varga [Tue, 12 Mar 2024 21:17:44 +0000 (22:17 +0100)]
Modernize Indexed

Indexed.getType() is not used anywhere, hence remove it. While we are
here, also turn the class into a record, as it is a pure DTO.

Also add a FIXME to require the actual entry to be non-null.

JIRA: CONTROLLER-2101
Change-Id: I8bd42a815096a3d0993eb41c59cf39655a7ed0fd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit dd05f95d0fe58515adddc0468a6e73d558a70f20)

11 months agoOptimize SegmentedJournalReader.getCurrentEntry() 99/110699/1
Robert Varga [Tue, 12 Mar 2024 20:49:59 +0000 (21:49 +0100)]
Optimize SegmentedJournalReader.getCurrentEntry()

This method has very simple logic, the reasoning for which is left
unexplained.

Add a comment about what is going on and use assign-and-check construct
to trim a bit of byte code.

JIRA: CONTROLLER-2106
Change-Id: I5d4e5551ae089489636da38600109f7821fa306b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a73511c1db6a099397418d2708e073546e8e0a1b)

11 months agoOptimize SegmentedJournalReader.hasNext() 98/110698/1
Robert Varga [Tue, 12 Mar 2024 19:47:54 +0000 (20:47 +0100)]
Optimize SegmentedJournalReader.hasNext()

hasNext() is an extremely hot method and its behaviour depends on
JournalReader.Mode, which is invariant for a particular instance.

Expose the invariant to the JVM by splitting the class into the base,
which services Mode.ALL and a subclass, which performs the commit index
check.

Also move segment acquisition and reader positioning to
SegmentedJournal, as otherwise we would be calling hasNext() from
constructor, which is getting flagged by SpotBugs.

JIRA: CONTROLLER-2106
Change-Id: I29fca69a211fc8f21619a54fe59a8ff4012b01d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 87cf9d356ccaf6153ddbc0a763155c6787dc2932)

11 months agoFix JournalSegment{Reader,Writer} license 97/110697/1
Robert Varga [Wed, 13 Mar 2024 07:23:25 +0000 (08:23 +0100)]
Fix JournalSegment{Reader,Writer} license

atomix-storage is licensed under APL, not EPL. Fix that.

Change-Id: I2a88fb978d0e1e9e22a5aecffcc4a7ca7fc2ae96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4daf276cc8c278a68f95828355ef22483b16d18d)

11 months agoRefactor JournalSegmentReader.readNext() 96/110696/1
Robert Varga [Tue, 12 Mar 2024 19:37:02 +0000 (20:37 +0100)]
Refactor JournalSegmentReader.readNext()

The two implementations share the callout to getNextIndex(), pull it
down to the base class to better define the API we are after.

JIRA: CONTROLLER-2099
Change-Id: Id82a039dbb02156bef43ff9f9398d0e1883cc38f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1880e76a77bfea77088107f241fc859248d3df1c)

11 months agoRemove StorageLevel.MEMORY 77/110677/1
Robert Varga [Tue, 12 Mar 2024 09:25:16 +0000 (10:25 +0100)]
Remove StorageLevel.MEMORY

This enum is defunct and results in DISK being used. Remove it.

JIRA: CONTROLLER-2101
Change-Id: Ibc6f6916f20e5b0fc0f3c8fe6651e65f24074d53
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b22f6f02b36c7de497848802e41387fe24e11b16)

11 months agoRemove JournalWriter.append(Indexed) 76/110676/1
Robert Varga [Tue, 12 Mar 2024 09:24:04 +0000 (10:24 +0100)]
Remove JournalWriter.append(Indexed)

This method is only used in a single test and can be realized via the
usual append(E) method. Remove it.

JIRA: CONTROLLER-2101
Change-Id: Ie1ec3507c18d9970be4968c9239b08ad8323f3a9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 42aa6677b87768cfc3a0f63539c5a6e6a2f509cb)

11 months agoClean up JournalSegment 48/110648/1
Robert Varga [Mon, 11 Mar 2024 12:23:08 +0000 (13:23 +0100)]
Clean up JournalSegment

We have plenty of unused and needlessly-public methods. Clean that up.

Change-Id: Ie93dd9eff7f847be23bf4d7fea9acefcac0beb60
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit fde1015a6e3a1c6c8aeecc81efe26fcdd92f81d5)

11 months agoHide SegmentedJournal{Reader,Writer} 47/110647/1
Robert Varga [Mon, 11 Mar 2024 11:49:40 +0000 (12:49 +0100)]
Hide SegmentedJournal{Reader,Writer}

These classes are define by Journal{Reader,Writer} interfaces, hide them
as they are pure implementation details.

JIRA: CONTROLLER-2098
Change-Id: I1149b970001cb64ffe503f128cce3864e396280a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 66dc95ca1b4cd88e8718086c6c902c9ad201286b)

11 months agoDisconnect JournalSegmentWriter from JournalWriter 46/110646/1
Robert Varga [Mon, 11 Mar 2024 11:08:05 +0000 (12:08 +0100)]
Disconnect JournalSegmentWriter from JournalWriter

JournalSegmentWriter is really the internal API, so it should not have a
public API straightjacket. Disconnect the implementation, making method
properly package-private.

This also makes it very clear that JournalWriter is not something users
should close() -- because doing so would wreck internal machinery rather
thoroughly, rendering the segment writer inoperable -- and that should
only be possible via JournalSegment's lifecycle.

JIRA: CONTROLLER-2098
Change-Id: Ia18b0dc640cba11689bb36cf338c8cef3ae4e6f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 45661c71a7e3d762ceb7ac12ced3c383ba65ac76)

11 months agoRemove MappableJournalSegmentWriter 45/110645/1
Robert Varga [Mon, 11 Mar 2024 10:56:22 +0000 (11:56 +0100)]
Remove MappableJournalSegmentWriter

MappableJournalSegmentWriter is now just mediating implementation access
-- which is always is now guarded by a reference.

This means we can ditch this indirection and give out
SegmentedJournalWriter directly.

JIRA: CONTROLLER-2098
Change-Id: If15bdb10f9a317960aaf41aa80c57e929923ed21
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit cca2548d39eb1c398d98aeb0280c2e47b78852ce)

11 months agoRework JournalSegment writer access 44/110644/1
Robert Varga [Mon, 11 Mar 2024 10:45:51 +0000 (11:45 +0100)]
Rework JournalSegment writer access

The only user of JournalSegment.writer() is SegmentedJournalWriter,
which is using acquire/release to guard access to the writer.

Rework these methods so that acquire/release are internal and exposed
functionality is acquireWriter() and releaseWriter().

JIRA: CONTROLLER-2098
Change-Id: I345cec145fd82ee59c525d183584d69a9e599bf9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ec6312137be61efb00cc03ef745bf6e0af31a0f8)

11 months agoDisconnect JournalSegmentReader from JournalReader 43/110643/1
Robert Varga [Mon, 11 Mar 2024 10:28:37 +0000 (11:28 +0100)]
Disconnect JournalSegmentReader from JournalReader

JournalSegmentReader is the only used by SegmentedJournalReader, which
is the actual implementation of JournalReader.

There is really no point in JournalSegmentReader to conform to the
public API, as not all elements are needed.

This disconnects JournalSegmentReader, eliminating getFirstIndex(), as
that is simply not called -- and was not conforming to the API anyway.

JIRA: CONTROLLER-2098
Change-Id: Icd802ee07207d4f6787e3bdb71e36e553f2010c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f00cb3b9fb1237ee90b2c8bc07821213b4345fb0)

11 months agoEliminate MappableJournalSegmentReader 42/110642/1
Robert Varga [Mon, 11 Mar 2024 10:13:05 +0000 (11:13 +0100)]
Eliminate MappableJournalSegmentReader

MappableJournalSegmentReader is an indirection used by
JournalSegmentReader to get a stable reader and the backend is
manipulated via map()/unmap() operations.

This is sort of a band-aid to lifecycle, as JournalSegment.close()
eagerly closes the writer, which in turn invalidates buffer and all that
jazz.

This dance is quite unnecessary, as JournalSegmentReader always acquires
the Segment, hence as long as it has a reader, the segment is guaranteed
to be mapped -- except for the case of close().

This patch reworks the logic in couple of ways:
- references are now guarding the writer itself, so as long as there are
  some, the writer is not closed.
- createReader() now increments the reference count, which means we can
  directly allocate the appopriate JournalSegmentReader implementation
- JournalSegmentReader.close() now routes to
  JournalSegment.closeReader(), which in turn releases the reference

JIRA: CONTROLLER-2098
Change-Id: I29b926dec5dc1a77e7e5e51ee3e2deb4f0ca6e33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2e8a82c1b46bedf40e5e3d51f03efae75d72ca48)

11 months agoHide JournalSegment 41/110641/1
Robert Varga [Mon, 11 Mar 2024 10:02:19 +0000 (11:02 +0100)]
Hide JournalSegment

JournalSegment is an implementation detail, which we do not want to leak
to the outside world. Hide it an make it final.

JIRA: CONTROLLER-2098
Change-Id: Ife71005f481c7ffb3c2eb6b89d3c5afa5e7f1609
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 08ea7b7900a387c0afb07664147d3c652dc1047e)

11 months agoClean up SegmentedJournalWriter 40/110640/1
Robert Varga [Mon, 11 Mar 2024 08:08:57 +0000 (09:08 +0100)]
Clean up SegmentedJournalWriter

We have duplicated code in append() methods and their recovery is not
obvious. Move common code into a private method and reduce the size of
catch blocks.

JIRA: CONTROLLER-2098
Change-Id: I58e6ff19cf2eaa2e97c56499d70171cb93da6174
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ac277cc850d78c906250263ca9ae196672fa438b)

11 months agoClean up SegmentedJournalReader 39/110639/1
Robert Varga [Mon, 11 Mar 2024 07:44:57 +0000 (08:44 +0100)]
Clean up SegmentedJournalReader

We have bit of duplicated code dealing with moving to next segment.
Concentrate it to a single method.

This shows the code actually has a bug, where it fails to close the
reader -- hence potentially leaking.

JIRA: CONTROLLER-2098
Change-Id: Ib58116d21cedde58c8f84d5fffd245e8e8408935
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c23fa167527d507fe778e3ac838000edd9a81af3)

11 months agoDo not store JournalSegment in JournalSegmentWriter 38/110638/1
Robert Varga [Sun, 10 Mar 2024 22:01:42 +0000 (23:01 +0100)]
Do not store JournalSegment in JournalSegmentWriter

We are only accessing index() and maxSegmentSize. We already copy
index() to firstIndex, so let's do the same maxSegmentSize and use
firstIndex instead of accessing segment.index().

JIRA: CONTROLLER-2098
Change-Id: Ia8a24c7f73187a5803d279309775f361a39c91b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8442a2fb1750d67970672c484fa77f413692ff8c)

11 months agoInline SegmentedJournalReader.initialize() 29/110629/1
Robert Varga [Sun, 10 Mar 2024 18:25:50 +0000 (19:25 +0100)]
Inline SegmentedJournalReader.initialize()

This method is only invoked from the constructor, inline it there to
similify lifecycle.

JIRA: CONTROLLER-2098
Change-Id: I2c2790f785e13dd411a23eff299221b129a99630
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit fd16240a8173bf036906b3b815309382db1540b0)

11 months agoRemove MappableJournalSegmentWriter.firstIndex() 28/110628/1
Robert Varga [Sun, 10 Mar 2024 18:20:31 +0000 (19:20 +0100)]
Remove MappableJournalSegmentWriter.firstIndex()

This method is not used anywhere, remove it. This makes
MappableJournalSegmentWriter a pure delegator with map/unmap changing
the delegate object.

JIRA: CONTROLLER-2098
Change-Id: Ifcbc22edb0046ae890837415e9751a4a8274d4d3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2f27f3cc329eec9c6fdae8e2382fd25f115845d8)

11 months agoShare FileChannel across all JournalSegmentReaders 27/110627/1
Robert Varga [Sun, 10 Mar 2024 18:00:39 +0000 (19:00 +0100)]
Share FileChannel across all JournalSegmentReaders

Now that neither the writer not reader manipulates FileChannel state, we
can share a single channel. This has the nice effect of lifting its
lifecycle management completely to JournalSegment.

JIRA: CONTROLLER-2096
Change-Id: Ib7653d1494fdb53d1a1c73ad20ab103b29fedaa0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a9e7d69658a641eb49176078c64881f14add00a6)

11 months agoExpand JournalSegmentReader 26/110626/1
Robert Varga [Sun, 10 Mar 2024 17:21:00 +0000 (18:21 +0100)]
Expand JournalSegmentReader

The two subclasses contain a lot of duplicated code. This patch
centralizes most code to reside in JournalSegmentReader.

JIRA: CONTROLLER-2098
Change-Id: I09a968ff8a283fc86f8591ab3d302cc2af0eb86a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 541edfced96299522aabbfd5c4b6123653efe038)

11 months agoIntroduce JournalSegmentReader 25/110625/1
Robert Varga [Sun, 10 Mar 2024 16:33:55 +0000 (17:33 +0100)]
Introduce JournalSegmentReader

The two implementations for accessing the file have a common API and
potentially share a lot of code. Introduce JournalSegmentReader to act
as a common superclass.

JIRA: CONTROLLER-2098
Change-Id: Ie8b524812f6193206e1df100ac55ed4f11ad9f5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 27d35a2e5f5db0ba2d637a86cbe888c3b874982a)

11 months agoPerform proper handoff between JournalSegmentWriters 24/110624/1
Robert Varga [Sun, 10 Mar 2024 13:27:28 +0000 (14:27 +0100)]
Perform proper handoff between JournalSegmentWriters

Switching between JournalSegmentWriter implementations is a matter of
just handing off state, which is limited to the last entry and position
in the file.

This patch introduces alternative constructors, which allow this state
to be moved to the new implementation without needing to re-read the
file.

JIRA: CONTROLLER-2043
Change-Id: I796cb4da4e09dfe6332ca82a7dfdb76740e30164
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f9698667f48360df0d039e95db709fb140cf9e24)

11 months agoMove JournalSegmentWriter switchover logic 23/110623/1
Robert Varga [Sun, 10 Mar 2024 11:53:21 +0000 (12:53 +0100)]
Move JournalSegmentWriter switchover logic

This patch moves the logic to JournalSegmentWriter implementations,
which allows us to communicate internal state without the need to
re-establish it or leak it to the outside world.

JIRA: CONTROLLER-2043
Change-Id: Ifcb937fdaeaecd46b53a962c541ebfff689ecd40
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d9569bc53baaf2e830144e0200f7b6baba15cbe0)

11 months agoIntroduce JournalSegmentWriter 08/110608/1
Robert Varga [Sun, 10 Mar 2024 11:22:56 +0000 (12:22 +0100)]
Introduce JournalSegmentWriter

MappableJournalSegmentWriter needs to flip between the two
implementations with seamless handoff.

Introduce JournalSegmentWriter as common superclass, exposing
currently-used interface.

JIRA: CONTROLLER-2043
JIRA: CONTROLLER-2098
Change-Id: I11f01ea027a757a32e25bf434d29abeca7d40f6e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b1773fc588ee5ea36f3bf5378ff54aa3dbffb64e)

11 months agoTrack channel position in explicit field 07/110607/1
Robert Varga [Sat, 9 Mar 2024 17:28:02 +0000 (18:28 +0100)]
Track channel position in explicit field

Rather than manipulating the channel, use an explicit field to keep
track of our current position.

JIRA: CONTROLLER-2095
Change-Id: I50adbef833251035f7c54ec624f9a03d59b5c7c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 07f772e01ad41bfa6aacf037c2e19b2be87f3bc6)

11 months agoSimplify FileChannelJournalSegmentWriter position tracking 06/110606/1
Robert Varga [Sat, 9 Mar 2024 17:13:01 +0000 (18:13 +0100)]
Simplify FileChannelJournalSegmentWriter position tracking

This patch makes the obvious switch in state tracking: memory buffer
does not hold anything of value w.r.t. overall state, so there is no
point in marking/resetting and maintaining memory.position() beyond
what we need for reading from it.

Local 'position' acts now as the authoritative source of where we want
to go and we propagate it to channel position when we validate an entry.

JIRA: CONTROLLER-2095
Change-Id: Iab150a3c7348c714170223b397167cd4bb87f087
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7dd119a473054c089c12e66780b136f11eb4f5d2)

11 months agoImprove entry crc32 computation 05/110605/1
Robert Varga [Sat, 9 Mar 2024 15:03:10 +0000 (16:03 +0100)]
Improve entry crc32 computation

We have a codepath difference here, where we use either a ByteBuffer or
a raw array to compute CRC32.

MappedJournalSegmentWriter does not make it immediately clear we use
this buffer twice -- once for CRC32 and once for deserialization.

Move acquisition of slice just after we have read the expected CRC32, so
it is clear it is something we would be doing even if there were no
checksum involved.

Mirror the same in FileChannelJournalSegmentWriter, as this will allow
us to further consolidate the code and stop mucking with memory.limit(),
which is causing us to invalidate our previously-set mark.

JIRA: CONTROLLER-2095
Change-Id: I355bd97cd8acb4f5d9d91310de97ecb2cbd70282
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b8dfbae75d8e13b78d3a7d5db48de2f5e262cd87)

11 months agoInvert checksum check 04/110604/1
Robert Varga [Sat, 9 Mar 2024 14:49:37 +0000 (15:49 +0100)]
Invert checksum check

We have a hardly-visible else branch which terminates our loop. Increase
its visibility by making it a dedicated if.

JIRA: CONTROLLER-2095
Change-Id: Ia0f6901793b1847a13afc5a3da3fdd5382180606
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b004038a282786fc29b4ba7fc9f8874debe21afd)

11 months agoDo not use java.util.zip.Checksum 03/110603/1
Robert Varga [Sat, 9 Mar 2024 14:32:01 +0000 (15:32 +0100)]
Do not use java.util.zip.Checksum

We are using this interface only for local variable type declaration,
use CRC32 directly, just as MappedJournalSegmentWriter does.

JIRA: CONTROLLER-2095
Change-Id: I054c639ae49b4fccef863a363c6e8665ea1322f6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c6e60291d8e698572867a51dd0fbbf7f55b533b9)

11 months agoReduce position changes during read 02/110602/1
Robert Varga [Sat, 9 Mar 2024 14:29:56 +0000 (15:29 +0100)]
Reduce position changes during read

Rather than using a read() which updates the position, requiring us to
set the position again, set it only once and use read with offset --
eliminating one syscall.

JIRA: CONTROLLER-2095
Change-Id: I478ba1cbb1f5737a751b43cb6ed0d018e49e6485
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit fe1081dadbe4aa27600ef4454bbad5357f50e331)

11 months agoClean up initial FileChannel writer reset's read 01/110601/1
Robert Varga [Sat, 9 Mar 2024 14:13:20 +0000 (15:13 +0100)]
Clean up initial FileChannel writer reset's read

The code here bears marks of 'copy, paste and cudgel to compliance'
programming and is strikingly similar to what MappedJournalSegmentWriter
does -- except it needs to deal with reading as well.

This patch takes the first step towards sanity by eliminating a useless
if() and uses FileChannel.read(ByteBuffer, long) to reduce position
adjustments.

JIRA: CONTROLLER-2095
Change-Id: I528cb14608402a406e20d168a7e8520c9eb66edf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 62351d41be04a723dce6c1268475f27a0ca0dfe6)

11 months agoOptimize MappedJournalSegmentWriter.truncate() 00/110600/1
Robert Varga [Sat, 9 Mar 2024 13:33:11 +0000 (14:33 +0100)]
Optimize MappedJournalSegmentWriter.truncate()

Reduce code duplication by separating current position manipulation and
entry zero-out.

Also use a single putLong() instead of two putInt()s, eliminating one
range check.

Overall this makes the two implementations much more similar, allowing
sharing code at some later point in the future.

JIRA: CONTROLLER-2095
Change-Id: I9791b5e27a779210b5500a7923ccada7156f26e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 5b9d16d22b8645011f8a79167da4d31a46195327)

11 months agoOptimize FileChannelJournalSegmentWriter.truncate() 99/110599/1
Robert Varga [Sat, 9 Mar 2024 13:09:45 +0000 (14:09 +0100)]
Optimize FileChannelJournalSegmentWriter.truncate()

FileChannelJournalSegmentWriter.truncate() is inefficient in that it
zeroes-out its memory buffer and then writes it completely out.

This patch aligns it with what MappedJournalSegmentWriter does, which is
just zeroing out the entry header -- reducing both IO and CPU overheads.

JIRA: CONTROLLER-2095
Change-Id: I487157e78524cc9b00c9efff2064dbe892638ae4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4a74d808e33fef2e002af1acc996b7a2ba228757)

11 months agoImprove FileChannelJournalSegmentWriter.truncate() 98/110598/1
Robert Varga [Sat, 9 Mar 2024 12:30:12 +0000 (13:30 +0100)]
Improve FileChannelJournalSegmentWriter.truncate()

Reduce the dance around channel position by explicitly passing it down,
thus reducing the number of syscalls we incur.

Also inline FileChannelJournalSegmentWriter.zero() and add a FIXME to
improve our zero-out strategy.

JIRA: CONTROLLER-2095
Change-Id: I885947fef51132a294c900396d902cf5481e2bd8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b2106c7c4fbc91f6cdfd8bf4371b723db6fdae2f)

11 months agoRemove unused {FileChannel,Mapped}JournalSegmentWriter methods 97/110597/1
Robert Varga [Sat, 9 Mar 2024 12:38:05 +0000 (13:38 +0100)]
Remove unused {FileChannel,Mapped}JournalSegmentWriter methods

We have a few methods which are not used anywhere, remove them to
simplify things.

JIRA: CONTROLLER-2095
Change-Id: I508d92cc2c761a6432e24e70db400636764753c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c15f343c9fdf01aaff0170c58398d0b8a7259822)

11 months agoOptimize FileChannelJournalSegmentReader channel use 96/110596/1
Robert Varga [Sat, 9 Mar 2024 09:47:49 +0000 (10:47 +0100)]
Optimize FileChannelJournalSegmentReader channel use

We use FileChannel to maintain our position for a particular reader,
which is a naive implementation.

Since FileChannel's position is tied to the underlying file descriptor,
each such manipulation involves locking and system calls.

Switch to maintaining the position ourselves and using
FileChannel.read(buffer, position), improving performance.

JIRA: CONTROLLER-2094
Change-Id: I7f462f3fd8aa9bc47c16201dd32faeb2a7c18a32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2d9ad8ba93602b8b90b29a923a6d961b9cc42011)

11 months agoAdd RTD configuration 36/110536/2
Robert Varga [Thu, 7 Mar 2024 13:31:29 +0000 (14:31 +0100)]
Add RTD configuration

RTD requires configuration, add it.

Change-Id: I620a33a647f667c7b534f6b1ac19c50fe7dc6866
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit afdb785648021cd3143399d8551737880d2885ec)

11 months agoBump Scala to 2.13.13 87/110387/1
Robert Varga [Tue, 27 Feb 2024 09:39:19 +0000 (10:39 +0100)]
Bump Scala to 2.13.13

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

Change-Id: I365019424a8969ee87837c81c4022d9853e67539
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit dea84739bb45d034ac827d304bc525aed773c82d)

13 months agoEnable requiremens in sal-distributed-datastore 66/109966/1
Robert Varga [Wed, 24 Jan 2024 09:39:23 +0000 (10:39 +0100)]
Enable requiremens in sal-distributed-datastore

The upstream issue has been fixed a few moons back, remove the
workaround we carry.

Change-Id: I5ed8030f98638f6202d4e9d67c309c704401840b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b794a34925a0e0a26496cdd5f7f777607ee8bd58)

13 months agoSeal TransmitQueue 47/109547/1
Robert Varga [Fri, 5 Jan 2024 20:01:06 +0000 (21:01 +0100)]
Seal TransmitQueue

There should ever only be two implementations, seal the base class.

Change-Id: I2a511e49a5b29c89f5c3849972f298d98137462b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2af83947ffd063f10811bb4de0d22a3c19378cac)

13 months agoMigrate ActorBehaviorTest to JUnit5 66/109566/2
Robert Varga [Fri, 29 Dec 2023 11:10:26 +0000 (12:10 +0100)]
Migrate ActorBehaviorTest to JUnit5

Eliminate the need for mockito-subclass by migrating to JUnit5 and
correcting mocking configuration.

Change-Id: I3d3a772abe71e0d0576474aa9f2b22cef7fbea0a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a6874e13b031a6ef918affcc0942a0a78f09590b)

13 months agoDeprecate EmptyExternalizable for removal 44/109544/1
Robert Varga [Sat, 30 Dec 2023 20:44:53 +0000 (21:44 +0100)]
Deprecate EmptyExternalizable for removal

This class is not used anywhere, deprecate it for removal.

Change-Id: I3303a14570bfadaa524841e7622f20dd955f67e3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b3616bb71b8dfb8aab44fcf25f0b3026487e04e0)

13 months agoDeprecate SuccessReply for removal 43/109543/1
Robert Varga [Sat, 30 Dec 2023 20:39:31 +0000 (21:39 +0100)]
Deprecate SuccessReply for removal

This class is not used anywhere, deprecate it for removal.

Change-Id: I26b51aeda81ed9811171b53e9f797baa1c2bf994
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7ffa5d19fcfb401db31dd5be595ff66492c0e106)

13 months agoDo not use static import for Patterns.ask() 42/109542/1
Robert Varga [Sat, 30 Dec 2023 21:46:02 +0000 (22:46 +0100)]
Do not use static import for Patterns.ask()

Improve call site visibility by explicitly referencing this method as
Patterns.ask().

Change-Id: I94f21ba9a5e2d0a2e3de89f6826896ea98a24641
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9d48ffddd3e11efc5806efcc5895d5b5e997f5b2)

13 months agoUse instanceof patterns in ShardManager 41/109541/1
Robert Varga [Sat, 30 Dec 2023 21:58:36 +0000 (22:58 +0100)]
Use instanceof patterns in ShardManager

Reduce the amount of casts we perform by using instanceof patterns.

Change-Id: I918a15cf52f67ee072a1e7e88d5624bf161cdb3e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 96075120775de844c6863cd9cc16522cb87acddc)

13 months agoTurn ShardContainer into a record 40/109540/1
Robert Varga [Sun, 31 Dec 2023 00:23:35 +0000 (01:23 +0100)]
Turn ShardContainer into a record

We have Java 17 now, use a record instead of a final class.

Change-Id: I340bf3f288ef8264dafc7d77403c5482f307a671
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 504ff6b7425c1a1d189e15141fa0843448948455)

13 months agoAccess clientActor exactly once 39/109539/1
Robert Varga [Sun, 31 Dec 2023 02:39:35 +0000 (03:39 +0100)]
Access clientActor exactly once

Make sure the null check is explicit to everyone.

Change-Id: I299728e411712ad73a83e78d66d078b0d79453b4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit dd91a3825bea25bb2919cc2ee63036f523083af2)

13 months agoBump Kryo to 4.0.3 45/109545/2
Robert Varga [Sun, 31 Dec 2023 12:16:35 +0000 (13:16 +0100)]
Bump Kryo to 4.0.3

https://github.com/EsotericSoftware/kryo/releases/tag/kryo-parent-4.0.3

Change-Id: Iebb8fb4a24c2406053a77fc141fc6ed8ad9b2462
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c586853109faec36f9423dc65955ece72b9f3b5d)

13 months agoMake LocalSnapshotStore final 38/109538/1
Robert Varga [Sun, 31 Dec 2023 18:36:31 +0000 (19:36 +0100)]
Make LocalSnapshotStore final

We have a SpotBugs suppression which ends up being unnecessary if the
class is final.

Change-Id: If58497303871ae136875c80b8b094276ccda9d64
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ddebb0ff6a098847b362d6f2bcf5d58f683714d3)

13 months agoTurn LongSerdes into an enum 37/109537/1
Robert Varga [Sun, 31 Dec 2023 14:38:29 +0000 (15:38 +0100)]
Turn LongSerdes into an enum

Use proper singleton for reuse.

JIRA: CONTROLLER-2089
Change-Id: Ia03b8610370521e97e45f67def07a32f1bf7d59b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a879ebe46dc775b82e8b233117e16af2f1a27851)

13 months agoRename DataJournalEntrySerializer 36/109536/1
Robert Varga [Sun, 31 Dec 2023 14:39:50 +0000 (15:39 +0100)]
Rename DataJournalEntrySerializer

DataJournalEntrySerdes is the proper name, use that.

JIRA: CONTROLLER-2089
Change-Id: I53247f7b226ed7ab0ff42ac24ad6f4d549e5db97
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 11483316054fd9862949e68f09326b90de1834b4)

13 months agoModernize sal-akka-segmented-journal 35/109535/1
Robert Varga [Fri, 29 Dec 2023 11:58:53 +0000 (12:58 +0100)]
Modernize sal-akka-segmented-journal

Use local variable type inference, instanceof patterns and seal
DataJournalEntry.

JIRA: CONTROLLER-2089
Change-Id: I3c2ee2de5eaae6874e2f75a44dfd6fce0942e8ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7e629cabf95cf30562f10a658c8ebdd724d1b18d)

13 months agoServerInfo should be a plain record 34/109534/1
Robert Varga [Fri, 29 Dec 2023 12:30:50 +0000 (13:30 +0100)]
ServerInfo should be a plain record

This is a pure DTO, turn it into a record, eliminating quite a bit of
verbosity.

Also clean up RaftActorContextImpl.updatePeerIds() so we do not juggle
two booleans and set/reset our voting status.

Change-Id: Ifbb2ae0c8163472b8ef3b59210f12dccb1b8e30d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6213d7379b8c4d76a507ffd114a00ff9a8122287)

13 months agoBump versions to 8.0.5-SNAPSHOT 71/109471/1
Robert Varga [Fri, 29 Dec 2023 07:27:57 +0000 (08:27 +0100)]
Bump versions to 8.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: Ib1a36a0278af6034f2378fa91a7e2103b9abf0ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRelease controller v8.0.4
jenkins-releng [Fri, 29 Dec 2023 05:11:03 +0000 (05:11 +0000)]
Release controller

13 months agoClean up Shard a bit 63/109463/2
Robert Varga [Fri, 29 Dec 2023 02:40:00 +0000 (03:40 +0100)]
Clean up Shard a bit

Use instanceof patterns and local variable type inference to simplify
code a bit.

Change-Id: If437909b1a012a60fa5fd296dda6bffeb161fd25
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months ago{Start,Stop}DropMessages is generic 57/109457/3
Robert Varga [Fri, 29 Dec 2023 01:19:26 +0000 (02:19 +0100)]
{Start,Stop}DropMessages is generic

Add a diamond to constructor invocations to remove warnings.

Change-Id: I29f063eaf65656aef6715a8fe710e2afb35169e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove setupDistributedDataStore() 58/109458/1
Robert Varga [Fri, 29 Dec 2023 01:40:16 +0000 (02:40 +0100)]
Remove setupDistributedDataStore()

These methods are no longer in use, remove them.

JIRA: CONTROLLER-2054
Change-Id: I8be5220eddb093e43ff3c71aa13fa40a60ddcc5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoBump upstreams 48/109448/4
Robert Varga [Thu, 28 Dec 2023 20:35:07 +0000 (21:35 +0100)]
Bump upstreams

Adopt:
- odlparent-13.0.10
- yangtools-11.0.5
- mdsal-12.0.4

Change-Id: Ia6f7420c5751436ec97d0a45187d79dadf9c3d94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoClean up ClientBackedDataStoreTest 54/109454/2
Robert Varga [Fri, 29 Dec 2023 00:46:03 +0000 (01:46 +0100)]
Clean up ClientBackedDataStoreTest

Use local variable type inference to simplify code a bit.

Change-Id: I5d6c116f40fb84250b3f775e92b98de558dde14d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove setupDistributedDataStoreWithoutConfig() 53/109453/2
Robert Varga [Fri, 29 Dec 2023 00:40:16 +0000 (01:40 +0100)]
Remove setupDistributedDataStoreWithoutConfig()

These legacy methods have been deprecated since previous major version,
remove them.

JIRA: CONTROLLER-2054
Change-Id: I13077de6ca505af6bf8627d7094e49a719636e32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoUse constructor injection in OSGiDistributedDataStore 50/109450/1
Robert Varga [Thu, 28 Dec 2023 21:27:36 +0000 (22:27 +0100)]
Use constructor injection in OSGiDistributedDataStore

Upgraded SpotBugs does not like unitialized fields. Use constructor
injection to properly set them up.

Change-Id: I8d5226a8b0b6b2929eba3d4d9a73ac8e1c72613a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoUse VarHandles.fullFence() instead of an 'updated' field 49/109449/1
Robert Varga [Thu, 28 Dec 2023 21:10:15 +0000 (22:10 +0100)]
Use VarHandles.fullFence() instead of an 'updated' field

Upgraded SpotBugs does not like an otherwise-unused field. Preempt
failures by using VarHandles.fullFence() instead.

Also modernize ActorUtils by using instanceof patterns and local
variable type inference.

Change-Id: Iec9b717eaf821657f3ced659e0c6e86f360b21c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoUse constructor injection in OSGiActorSystemProvider 47/109447/1
Robert Varga [Thu, 28 Dec 2023 20:57:03 +0000 (21:57 +0100)]
Use constructor injection in OSGiActorSystemProvider

Upgraded SpotBugs does not like us not having initialized fields, use
contructor injection to side-step these warnings.

Change-Id: I3eef23b3cea88c97ccd8cb8794ec0587f07ccc77
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoDo not allow global timer to be stopped 46/109446/1
Robert Varga [Thu, 28 Dec 2023 20:34:11 +0000 (21:34 +0100)]
Do not allow global timer to be stopped

We have a globally-shared instance, it should never be stopped via
Timer.stop(). Log a warning whenever that is atttempted.

Change-Id: Id29f3799024b826d2278bf95f75cc661f85ab8e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoUse constructor injection for OSGiGlobalTimer 45/109445/1
Robert Varga [Thu, 28 Dec 2023 20:32:15 +0000 (21:32 +0100)]
Use constructor injection for OSGiGlobalTimer

Upgraded SpotBugs is warning about field initialization, side-step it by
using constructor injection.

Change-Id: I1697459db8d72c956649f3c61f3d090322c3e9fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoUse constructor injection in OSGiRemoteOpsProvider 44/109444/1
Robert Varga [Thu, 28 Dec 2023 20:18:13 +0000 (21:18 +0100)]
Use constructor injection in OSGiRemoteOpsProvider

We have a simple component here, use constructor injection to preempty
upgraded SpotBugs issuing errors on it.

Change-Id: Id65f63b374497aabccb98ebe06b52195f76f8099
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoEliminate SE_BAD_FIELD suppressions 56/109056/1
Robert Varga [Fri, 24 Nov 2023 15:10:33 +0000 (16:10 +0100)]
Eliminate SE_BAD_FIELD suppressions

We are implementing Serializable Proxy pattern, which should really be
enforced via throwing appropriate exceptions from
readObject()/writeObject() et al.

This retrofits the mininal set to keep SpotBugs happy, eliminating the
associated suppressions.

Change-Id: I8264114b1f0ed74123f0163d62d953dc45a8a9d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoBump versions to 8.0.4-SNAPSHOT 68/108768/1
Robert Varga [Tue, 31 Oct 2023 10:24:46 +0000 (11:24 +0100)]
Bump versions to 8.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I69bcc13470a9ac9ae85c9f4fa7f585527d4c58fa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRelease controller v8.0.3
jenkins-releng [Tue, 31 Oct 2023 08:38:10 +0000 (08:38 +0000)]
Release controller