Skip to content

v0.4: Backport of PR 214 - #218

Merged
joamaki merged 4 commits into
v0.4from
pr/joamaki/v0.4-backports
Nov 19, 2026
Merged

joamaki merged 4 commits into
v0.4from
pr/joamaki/v0.4-backports

Conversation

@joamaki

@joamaki joamaki commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Backport of PR 214 to bring the fix to Cilium v1.18.

[ upstream commit d1a0840 ]

From now on also run CI checks for PRs targeting
v0.* and also after merging.

Signed-off-by: Jussi Maki <jussi@isovalent.com>
@joamaki
joamaki requested review from a team as code owners November 19, 2026 14:47
@joamaki
joamaki requested review from Artyop, derailed and pippolo84 and removed request for a team, Artyop and derailed November 19, 2026 14:47
tklauser and others added 3 commits November 19, 2026 15:52
[ upstream commit 3c6df79 ]

We started seeing the error of the pr workflow [^1]:

    Run thollander/actions-comment-pull-request@v2
    No comment has been found with asked pattern. Creating a new comment.
    Error: Resource not accessible by integration

According to the thollander/actions-comment-pull-request action's
README[^2] we need to add pull-requestes: write permissions to the
workflow.

Do that and also update the action to v3 while at it.

[^1]: #151 (comment)
[^2]: https://github.com/thollander/actions-comment-pull-request/blob/e4a76dd2b0a3c2027c3fd84147a67c22ee4c90fa/README.md?plain=1#L172-L181

Signed-off-by: Tobias Klauser <tobias@cilium.io>
Signed-off-by: Jussi Maki <jussi@isovalent.com>
…iled

[ upstream commit 6917b43 ]

[ backporter's notes: Adapt table creation and explicit registration to
  v0.4. Use channel synchronization instead of synctest to retain Go 1.24
  compatibility. Keep coverage for concurrent updates, failed attempts,
  empty tables with nonzero revisions, and single and batch operations. ]

Regression test for checking that pruning only happens once reconciliation
has been attempted on all objects that existed at the time the table
become initialized.

AIL:3
Signed-off-by: Jussi Maki <jussi@isovalent.com>
[ upstream commit 2514f53 ]

[ backporter's notes: Keep the v0.4 per-round r.incremental API. Omit
  revision/progress bookkeeping that this release does not implement. The
  pruning gate uses exhaustion of the pinned snapshot, as in the upstream
  fix. AIL:3 for backport. ]

Pruning was invoked after the table had initialized but not before
the initial set was reconciled. This is an issue when the Update and
Prune operations have a dependency on each other, e.g. Prune reads
internal state populated by Update.

Fix this by only pruning once reconciliation has been attempted
at least up to the revision at which the table has been initialized.

AIL:0
Signed-off-by: Jussi Maki <jussi@isovalent.com>
@joamaki
joamaki force-pushed the pr/joamaki/v0.4-backports branch from ce358b5 to 7772c55 Compare November 19, 2026 14:52
@github-actions

Copy link
Copy Markdown
$ make
go build ./...
go: downloading go1.24.0 (linux/amd64)
go: downloading go.yaml.in/yaml/v3 v3.0.3
go: downloading github.com/cilium/hive v0.0.0-20250522123230-2946c4940f41
go: downloading golang.org/x/time v0.5.0
go: downloading github.com/spf13/cobra v1.8.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/cilium/stream v0.0.0-20240209152734-a0792b51812d
go: downloading github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
go: downloading github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
go: downloading github.com/go-viper/mapstructure/v2 v2.2.1
go: downloading go.uber.org/dig v1.17.1
go: downloading golang.org/x/term v0.16.0
go: downloading github.com/spf13/viper v1.18.2
go: downloading golang.org/x/sys v0.17.0
go: downloading golang.org/x/tools v0.17.0
go: downloading github.com/spf13/cast v1.6.0
go: downloading github.com/fsnotify/fsnotify v1.7.0
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading github.com/sagikazarmark/slog-shim v0.1.0
go: downloading github.com/spf13/afero v1.11.0
go: downloading github.com/subosito/gotenv v1.6.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading gopkg.in/ini.v1 v1.67.0
go: downloading github.com/magiconair/properties v1.8.7
go: downloading github.com/pelletier/go-toml/v2 v2.1.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading golang.org/x/text v0.14.0
PART_VALIDATE=1 go test ./... -cover -vet=all -test.count 1
go: downloading github.com/stretchr/testify v1.8.4
go: downloading go.uber.org/goleak v1.3.0
go: downloading golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
go: downloading github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
ok  	github.com/cilium/statedb	110.002s	coverage: 83.5% of statements
ok  	github.com/cilium/statedb/index	0.004s	coverage: 28.7% of statements
ok  	github.com/cilium/statedb/internal	0.017s	coverage: 46.7% of statements
ok  	github.com/cilium/statedb/part	166.552s	coverage: 87.0% of statements
ok  	github.com/cilium/statedb/reconciler	0.282s	coverage: 89.9% of statements
	github.com/cilium/statedb/reconciler/benchmark		coverage: 0.0% of statements
	github.com/cilium/statedb/reconciler/example		coverage: 0.0% of statements
go test -race ./... -test.count 1
ok  	github.com/cilium/statedb	73.344s
ok  	github.com/cilium/statedb/index	1.015s
ok  	github.com/cilium/statedb/internal	1.028s
ok  	github.com/cilium/statedb/part	27.565s
ok  	github.com/cilium/statedb/reconciler	1.287s
?   	github.com/cilium/statedb/reconciler/benchmark	[no test files]
?   	github.com/cilium/statedb/reconciler/example	[no test files]
go test ./... -bench . -benchmem -test.run xxx
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb
cpu: AMD EPYC 9V74 80-Core Processor                
BenchmarkDB_WriteTxn_1-4                    	  694018	      1724 ns/op	    579891 objects/sec	    1448 B/op	      26 allocs/op
BenchmarkDB_WriteTxn_10-4                   	 1939269	       617.4 ns/op	   1619679 objects/sec	     513 B/op	       9 allocs/op
BenchmarkDB_WriteTxn_100-4                  	 2436368	       520.9 ns/op	   1919592 objects/sec	     477 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_1000-4                 	 2199066	       545.8 ns/op	   1832264 objects/sec	     465 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_100_SecondaryIndex-4   	  694851	      1564 ns/op	    639262 objects/sec	    1351 B/op	      37 allocs/op
BenchmarkDB_NewWriteTxn-4                   	 1944156	       619.8 ns/op	     544 B/op	       8 allocs/op
BenchmarkDB_NewReadTxn-4                    	728926018	         1.640 ns/op	       0 B/op	       0 allocs/op
BenchmarkDB_Modify-4                        	    1962	    607748 ns/op	   1645419 objects/sec	  520016 B/op	    8157 allocs/op
BenchmarkDB_GetInsert-4                     	    1798	    668258 ns/op	   1496429 objects/sec	  504738 B/op	    8158 allocs/op
BenchmarkDB_RandomInsert-4                  	    2138	    576748 ns/op	   1733858 objects/sec	  496807 B/op	    7158 allocs/op
BenchmarkDB_RandomReplace-4                 	     430	   2698998 ns/op	    370508 objects/sec	 2188203 B/op	   49205 allocs/op
BenchmarkDB_SequentialInsert-4              	    2230	    547897 ns/op	   1825159 objects/sec	  465812 B/op	    7132 allocs/op
BenchmarkDB_SequentialInsert_Prefix-4       	     526	   2271816 ns/op	    440177 objects/sec	 3750208 B/op	   58568 allocs/op
BenchmarkDB_Changes_Baseline-4              	    1771	    680085 ns/op	   1470405 objects/sec	  540090 B/op	   10236 allocs/op
BenchmarkDB_Changes-4                       	     967	   1232083 ns/op	    811633 objects/sec	  968542 B/op	   14464 allocs/op
BenchmarkDB_RandomLookup-4                  	   28818	     41608 ns/op	  24033754 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_SequentialLookup-4              	   30199	     39821 ns/op	  25112303 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_Prefix_SecondaryIndex-4         	    9238	    118167 ns/op	   8462570 objects/sec	  125114 B/op	    1031 allocs/op
BenchmarkDB_FullIteration_All-4             	    1026	   1143179 ns/op	  87475383 objects/sec	     320 B/op	      11 allocs/op
BenchmarkDB_FullIteration_Get-4             	     229	   5112443 ns/op	  19560120 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_FullIteration_ReadTxnGet-4      	     231	   5170058 ns/op	  19342144 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_PropagationDelay-4              	  756109	      1540 ns/op	        13.00 50th_µs	        16.00 90th_µs	        37.00 99th_µs	    1133 B/op	      22 allocs/op
BenchmarkWatchSet_4-4                       	 3073976	       388.5 ns/op	     320 B/op	       5 allocs/op
BenchmarkWatchSet_16-4                      	  981790	      1197 ns/op	    1096 B/op	       5 allocs/op
BenchmarkWatchSet_128-4                     	  110209	     10810 ns/op	    8904 B/op	       5 allocs/op
BenchmarkWatchSet_1024-4                    	   10000	    109032 ns/op	   73743 B/op	       5 allocs/op
PASS
ok  	github.com/cilium/statedb	32.911s
PASS
ok  	github.com/cilium/statedb/index	0.003s
PASS
ok  	github.com/cilium/statedb/internal	0.003s
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb/part
cpu: AMD EPYC 9V74 80-Core Processor                
Benchmark_Uint64Map_Random-4        	    1621	    691846 ns/op	   1445408 items/sec	 2830703 B/op	   11035 allocs/op
Benchmark_Uint64Map_Sequential-4    	    1852	    662271 ns/op	   1509957 items/sec	 2607237 B/op	   11749 allocs/op
Benchmark_Insert_RootOnlyWatch-4    	   14173	     84763 ns/op	  11797662 objects/sec	   90637 B/op	    2044 allocs/op
Benchmark_Insert-4                  	   10000	    116293 ns/op	   8599005 objects/sec	  206605 B/op	    3076 allocs/op
Benchmark_Modify-4                  	   14864	     81002 ns/op	  12345350 objects/sec	  119666 B/op	    1050 allocs/op
Benchmark_GetInsert-4               	   10000	    104734 ns/op	   9548033 objects/sec	  119900 B/op	    1050 allocs/op
Benchmark_Replace-4                 	37414035	        32.02 ns/op	  31227442 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Replace_RootOnlyWatch-4   	36928839	        32.56 ns/op	  30708559 objects/sec	       0 B/op	       0 allocs/op
Benchmark_txn_1-4                   	 4754488	       251.9 ns/op	   3969838 objects/sec	     296 B/op	       5 allocs/op
Benchmark_txn_10-4                  	11911915	       102.4 ns/op	   9764073 objects/sec	     113 B/op	       2 allocs/op
Benchmark_txn_100-4                 	14754298	        81.39 ns/op	  12286176 objects/sec	     129 B/op	       2 allocs/op
Benchmark_txn_1000-4                	13120951	        90.70 ns/op	  11024899 objects/sec	     123 B/op	       2 allocs/op
Benchmark_txn_delete_1-4            	 1940722	       610.5 ns/op	   1638041 objects/sec	    3288 B/op	       8 allocs/op
Benchmark_txn_delete_10-4           	 9820144	       124.7 ns/op	   8020481 objects/sec	     369 B/op	       2 allocs/op
Benchmark_txn_delete_100-4          	16107907	        72.98 ns/op	  13701810 objects/sec	      83 B/op	       1 allocs/op
Benchmark_txn_delete_1000-4         	16628979	        71.53 ns/op	  13979440 objects/sec	      28 B/op	       1 allocs/op
Benchmark_Get-4                     	   45554	     26679 ns/op	  37482612 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Iterate-4                 	  219400	      5556 ns/op	 179983268 objects/sec	     104 B/op	       4 allocs/op
Benchmark_Hashmap_Insert-4          	   22736	     52745 ns/op	  18959199 objects/sec	   74265 B/op	      20 allocs/op
Benchmark_Hashmap_Get_Uint64-4      	  198868	      5995 ns/op	 166814870 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Hashmap_Get_Bytes-4       	  160867	      7450 ns/op	 134232051 objects/sec	       0 B/op	       0 allocs/op
PASS
ok  	github.com/cilium/statedb/part	26.437s
PASS
ok  	github.com/cilium/statedb/reconciler	0.004s
?   	github.com/cilium/statedb/reconciler/benchmark	[no test files]
?   	github.com/cilium/statedb/reconciler/example	[no test files]
go run ./reconciler/benchmark -quiet
1000000 objects reconciled in 2.20 seconds (batch size 1000)
Throughput 453729.01 objects per second
1296MB total allocated, 6015172 in-use objects, 384MB bytes in use

@joamaki
joamaki merged commit afc8f3b into v0.4 Nov 19, 2026
1 check passed
@joamaki
joamaki deleted the pr/joamaki/v0.4-backports branch November 19, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants