Skip to content

Extensions to StatusSet - #185

Merged
joamaki merged 2 commits into
mainfrom
pr/joamaki/statusset-init
Aug 27, 2026
Merged

Extensions to StatusSet#185
joamaki merged 2 commits into
mainfrom
pr/joamaki/statusset-init

Conversation

@joamaki

@joamaki joamaki commented Aug 26, 2026

Copy link
Copy Markdown
Contributor
  • Add optional list of required reconciler names to StatusSet.Pending
  • Add StatusSet.Delete so reconciler can remove itself from the set

In some use-cases we'll want the StatusSet to always be populated
with some set of reconciler names so that we can wait for reconciliation
to finish. Extend the Pending method to allow specifying the required
set of reconcilers.

The specific use-case for this is the `node.Writer`
(https://github.com/cilium/cilium/blob/main/pkg/node/writer.go) for which
we'll want to be able to register reconcilers up-front so any consumer
of the table can wait for a node to have all its registered reconcilers
to be marked done.

Signed-off-by: Jussi Maki <jussi@isovalent.com>
Add the ability to remove a reconciler from a StatusSet.

Signed-off-by: Jussi Maki <jussi@isovalent.com>
@joamaki
joamaki requested a review from a team as a code owner August 26, 2026 11:28
@joamaki
joamaki requested review from derailed and removed request for a team August 26, 2026 11:28
@github-actions

Copy link
Copy Markdown
$ make
go build ./...
go: downloading github.com/cilium/hive v1.0.4
go: downloading golang.org/x/time v0.15.0
go: downloading go.yaml.in/yaml/v3 v3.0.4
go: downloading github.com/spf13/cobra v1.10.2
go: downloading github.com/spf13/pflag v1.0.10
go: downloading github.com/cilium/stream v0.0.1
go: downloading github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
go: downloading github.com/spf13/viper v1.18.2
go: downloading go.uber.org/dig v1.17.1
go: downloading golang.org/x/term v0.16.0
go: downloading github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
go: downloading github.com/mitchellh/mapstructure v1.5.0
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/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
STATEDB_VALIDATE=1 go test ./... -cover -vet=all -test.count 1
go: downloading github.com/stretchr/testify v1.11.1
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	428.742s	coverage: 79.4% of statements
ok  	github.com/cilium/statedb/index	0.009s	coverage: 33.7% of statements
ok  	github.com/cilium/statedb/internal	0.024s	coverage: 42.9% of statements
ok  	github.com/cilium/statedb/lpm	4.958s	coverage: 77.9% of statements
ok  	github.com/cilium/statedb/part	75.012s	coverage: 86.1% of statements
ok  	github.com/cilium/statedb/reconciler	0.259s	coverage: 93.3% 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	40.731s
ok  	github.com/cilium/statedb/index	1.014s
ok  	github.com/cilium/statedb/internal	1.026s
ok  	github.com/cilium/statedb/lpm	2.765s
ok  	github.com/cilium/statedb/part	36.225s
ok  	github.com/cilium/statedb/reconciler	1.393s
?   	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 7763 64-Core Processor                
BenchmarkDB_WriteTxn_1-4                      	  745358	      1495 ns/op	    669078 objects/sec	     704 B/op	      17 allocs/op
BenchmarkDB_WriteTxn_10-4                     	 1699089	       626.0 ns/op	   1597436 objects/sec	     386 B/op	       8 allocs/op
BenchmarkDB_WriteTxn_100-4                    	 2327877	       514.5 ns/op	   1943714 objects/sec	     349 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_1000-4                   	 2143497	       559.4 ns/op	   1787569 objects/sec	     350 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_100_SecondaryIndex-4     	 1436959	       830.5 ns/op	   1204156 objects/sec	     459 B/op	      10 allocs/op
BenchmarkDB_WriteTxn_CommitOnly_100Tables-4   	  910998	      1286 ns/op	    1128 B/op	       6 allocs/op
BenchmarkDB_WriteTxn_CommitOnly_1Table-4      	 1411251	       852.5 ns/op	     240 B/op	       6 allocs/op
BenchmarkDB_NewWriteTxn-4                     	 1564882	       765.9 ns/op	     216 B/op	       5 allocs/op
BenchmarkDB_WriteTxnCommit100-4               	  829396	      1272 ns/op	    1112 B/op	       6 allocs/op
BenchmarkDB_NewReadTxn-4                      	549635655	         2.184 ns/op	       0 B/op	       0 allocs/op
BenchmarkDB_Modify-4                          	    1966	    599415 ns/op	   1668293 objects/sec	  374574 B/op	    8080 allocs/op
BenchmarkDB_GetInsert-4                       	    1795	    669844 ns/op	   1492885 objects/sec	  358571 B/op	    8080 allocs/op
BenchmarkDB_RandomInsert-4                    	    2157	    567767 ns/op	   1761285 objects/sec	  350565 B/op	    7080 allocs/op
BenchmarkDB_RandomReplace-4                   	    1014	   1070920 ns/op	    933777 objects/sec	  472499 B/op	   11109 allocs/op
BenchmarkDB_SequentialInsert-4                	    2142	    554841 ns/op	   1802317 objects/sec	  350565 B/op	    7080 allocs/op
BenchmarkDB_SequentialInsert_Prefix-4         	     529	   2259536 ns/op	    442569 objects/sec	 2840378 B/op	   45536 allocs/op
BenchmarkDB_Changes_Baseline-4                	    1720	    690554 ns/op	   1448113 objects/sec	  444577 B/op	    9201 allocs/op
BenchmarkDB_Changes-4                         	     968	   1244911 ns/op	    803270 objects/sec	  660753 B/op	   12371 allocs/op
BenchmarkDB_RandomLookup-4                    	   24122	     50043 ns/op	  19982809 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_SequentialLookup-4                	   29106	     40965 ns/op	  24411185 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_Prefix_SecondaryIndex-4           	    6735	    163432 ns/op	   6118753 objects/sec	  124952 B/op	    1026 allocs/op
BenchmarkDB_FullIteration_All-4               	     932	   1150757 ns/op	  86899297 objects/sec	     104 B/op	       4 allocs/op
BenchmarkDB_FullIteration_Prefix-4            	     933	   1194054 ns/op	  83748286 objects/sec	     136 B/op	       5 allocs/op
BenchmarkDB_FullIteration_Get-4               	     237	   5112853 ns/op	  19558552 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_FullIteration_Get_Secondary-4     	     122	   9740583 ns/op	  10266326 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_FullIteration_ReadTxnGet-4        	     232	   5186116 ns/op	  19282252 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_PropagationDelay-4                	  703968	      1544 ns/op	        13.00 50th_µs	        16.00 90th_µs	        47.00 99th_µs	     878 B/op	      20 allocs/op
BenchmarkDB_WriteTxn_100_LPMIndex-4           	  518262	      2342 ns/op	    426949 objects/sec	    1638 B/op	      37 allocs/op
BenchmarkDB_WriteTxn_1_LPMIndex-4             	  142155	     14293 ns/op	     69966 objects/sec	   13849 B/op	      83 allocs/op
BenchmarkDB_LPMIndex_Get-4                    	     414	   2875147 ns/op	   3478083 objects/sec	       0 B/op	       0 allocs/op
BenchmarkWatchSet_4-4                         	 2366220	       500.4 ns/op	     296 B/op	       4 allocs/op
BenchmarkWatchSet_16-4                        	  731606	      1553 ns/op	    1096 B/op	       5 allocs/op
BenchmarkWatchSet_128-4                       	   90766	     13247 ns/op	    8904 B/op	       5 allocs/op
BenchmarkWatchSet_1024-4                      	    8889	    132925 ns/op	   73743 B/op	       5 allocs/op
PASS
ok  	github.com/cilium/statedb	44.164s
PASS
ok  	github.com/cilium/statedb/index	0.003s
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb/internal
cpu: AMD EPYC 7763 64-Core Processor                
Benchmark_SortableMutex-4   	 6140134	       195.3 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/cilium/statedb/internal	1.203s
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb/lpm
cpu: AMD EPYC 7763 64-Core Processor                
Benchmark_txn_insert/batchSize=1-4         	    1858	    647230 ns/op	   1545046 objects/sec	  838412 B/op	   13975 allocs/op
Benchmark_txn_insert/batchSize=10-4        	    2998	    401241 ns/op	   2492265 objects/sec	  385195 B/op	    6668 allocs/op
Benchmark_txn_insert/batchSize=100-4       	    3249	    377544 ns/op	   2648698 objects/sec	  345615 B/op	    6027 allocs/op
Benchmark_txn_delete/batchSize=1-4         	    1492	    793162 ns/op	   1260776 objects/sec	 1286470 B/op	   13976 allocs/op
Benchmark_txn_delete/batchSize=10-4        	    3070	    388849 ns/op	   2571691 objects/sec	  372417 B/op	    5769 allocs/op
Benchmark_txn_delete/batchSize=100-4       	    3477	    369683 ns/op	   2705021 objects/sec	  286753 B/op	    5038 allocs/op
Benchmark_LPM_Lookup-4                     	    7911	    149578 ns/op	   6685488 objects/sec	       0 B/op	       0 allocs/op
Benchmark_LPM_All-4                        	  142218	      8979 ns/op	 111370219 objects/sec	      32 B/op	       1 allocs/op
Benchmark_LPM_Prefix-4                     	  131577	      9549 ns/op	 104723011 objects/sec	      32 B/op	       1 allocs/op
Benchmark_LPM_LowerBound-4                 	  253525	      4711 ns/op	 106135456 objects/sec	     288 B/op	       2 allocs/op
PASS
ok  	github.com/cilium/statedb/lpm	12.219s
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb/part
cpu: AMD EPYC 7763 64-Core Processor                
Benchmark_Set_Singleton_Create-4              	21670629	        55.58 ns/op	      24 B/op	       1 allocs/op
Benchmark_Set_Singleton_Has-4                 	100000000	        11.23 ns/op	       0 B/op	       0 allocs/op
Benchmark_StringMap_Txn_Insert-4              	    8104	    139116 ns/op	   7188264 items/sec	   98250 B/op	    1306 allocs/op
Benchmark_Uint64Map_Random-4                  	    1852	    678523 ns/op	   1473790 items/sec	 1322709 B/op	    6037 allocs/op
Benchmark_Uint64Map_Sequential-4              	    1915	    612191 ns/op	   1633478 items/sec	 1703088 B/op	    5753 allocs/op
Benchmark_Uint64Map_Sequential_Insert-4       	    2215	    547300 ns/op	   1827152 items/sec	 1695085 B/op	    4752 allocs/op
Benchmark_Uint64Map_Sequential_Txn_Insert-4   	   10000	    114385 ns/op	   8742378 items/sec	   90464 B/op	    2031 allocs/op
Benchmark_Uint64Map_Random_Insert-4           	    2204	    563775 ns/op	   1773758 items/sec	 1314591 B/op	    5032 allocs/op
Benchmark_Uint64Map_Random_Txn_Insert-4       	    6615	    182137 ns/op	   5490369 items/sec	  117839 B/op	    2412 allocs/op
Benchmark_Insert_RootOnlyWatch-4              	    9778	    115054 ns/op	   8691571 objects/sec	   75552 B/op	    2036 allocs/op
Benchmark_Insert-4                            	    8378	    139525 ns/op	   7167195 objects/sec	   84256 B/op	    3067 allocs/op
Benchmark_WatchReplace-4                      	    9807	    117637 ns/op	   8500698 objects/sec	   65346 B/op	    2011 allocs/op
Benchmark_Modify-4                            	   12948	     92411 ns/op	  10821275 objects/sec	   58056 B/op	    1007 allocs/op
Benchmark_GetInsert-4                         	   10000	    116760 ns/op	   8564566 objects/sec	   58056 B/op	    1007 allocs/op
Benchmark_Replace-4                           	33661912	        35.23 ns/op	  28382479 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Replace_RootOnlyWatch-4             	33713143	        35.26 ns/op	  28362429 objects/sec	       0 B/op	       0 allocs/op
Benchmark_txn_1-4                             	 8025175	       149.1 ns/op	   6707072 objects/sec	      64 B/op	       3 allocs/op
Benchmark_txn_10-4                            	10915788	       109.4 ns/op	   9144398 objects/sec	      76 B/op	       2 allocs/op
Benchmark_txn_100-4                           	12106545	        97.59 ns/op	  10247060 objects/sec	      67 B/op	       2 allocs/op
Benchmark_txn_1000-4                          	10681921	       111.3 ns/op	   8987896 objects/sec	      65 B/op	       2 allocs/op
Benchmark_txn_delete_1-4                      	 5426520	       223.2 ns/op	   4480101 objects/sec	     632 B/op	       3 allocs/op
Benchmark_txn_delete_10-4                     	11212464	       106.3 ns/op	   9405163 objects/sec	     103 B/op	       1 allocs/op
Benchmark_txn_delete_100-4                    	13579286	        87.46 ns/op	  11433850 objects/sec	      35 B/op	       1 allocs/op
Benchmark_txn_delete_1000-4                   	13786852	        86.25 ns/op	  11593750 objects/sec	      28 B/op	       1 allocs/op
Benchmark_Get-4                               	   44317	     27064 ns/op	  36949192 objects/sec	       0 B/op	       0 allocs/op
Benchmark_GetWatch-4                          	   41499	     28937 ns/op	  34558276 objects/sec	       0 B/op	       0 allocs/op
Benchmark_All-4                               	  141296	      8467 ns/op	 118102383 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Iterator_All-4                      	  158047	      7591 ns/op	 131739324 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Iterator_Next-4                     	  152792	      7862 ns/op	 127198363 objects/sec	     896 B/op	       1 allocs/op
Benchmark_Hashmap_Insert-4                    	   14938	     80426 ns/op	  12433737 objects/sec	   74264 B/op	      20 allocs/op
Benchmark_Hashmap_Get_Uint64-4                	  134569	      8916 ns/op	 112158934 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Hashmap_Get_Bytes-4                 	  110073	     10855 ns/op	  92119332 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Delete_Random-4                     	      81	  14938363 ns/op	   6694174 objects/sec	 2539429 B/op	  102756 allocs/op
Benchmark_find16-4                            	213620611	         5.628 ns/op	       0 B/op	       0 allocs/op
Benchmark_findIndex16-4                       	87121167	        13.52 ns/op	       0 B/op	       0 allocs/op
Benchmark_find64-4                            	296348163	         4.048 ns/op	       0 B/op	       0 allocs/op
Benchmark_findIndex64_hit-4                   	295791723	         4.057 ns/op	       0 B/op	       0 allocs/op
Benchmark_findIndex64_miss-4                  	295633092	         4.054 ns/op	       0 B/op	       0 allocs/op
Benchmark_find4-4                             	422197828	         2.844 ns/op	       0 B/op	       0 allocs/op
Benchmark_findIndex4-4                        	320830570	         3.739 ns/op	       0 B/op	       0 allocs/op
BenchmarkSmallWriteTxn/updates_1-4            	  470379	      2450 ns/op	    3529 B/op	       4 allocs/op
BenchmarkSmallWriteTxn/updates_2-4            	  340959	      3451 ns/op	    4742 B/op	       6 allocs/op
BenchmarkSmallWriteTxn/updates_4-4            	  214111	      5426 ns/op	    7155 B/op	      11 allocs/op
BenchmarkSmallWriteTxn/updates_8-4            	  128394	      9198 ns/op	   11927 B/op	      20 allocs/op
BenchmarkSmallWriteTxn/updates_16-4           	   70752	     17175 ns/op	   21289 B/op	      38 allocs/op
PASS
ok  	github.com/cilium/statedb/part	55.168s
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 1.70 seconds (batch size 1000)
Throughput 589000.46 objects per second
568MB total allocated, 6015199 in-use objects, 239MB bytes in use

@joamaki
joamaki merged commit b822f02 into main Aug 27, 2026
1 check passed
@joamaki
joamaki deleted the pr/joamaki/statusset-init branch August 27, 2026 07:59
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.

2 participants