Commit 78dedde
committed
Return MergeObserver from IndexWriter.forceMergeDeletes() (#14515)
IndexWriter.forceMergeDeletes() now returns MergePolicy.MergeObserver
instead of void, allowing applications to monitor merge progress and
wait for completion. This enables coordination between merge completion
and other application logic, and supports both synchronous (await) and
asynchronous (CompletableFuture) waiting patterns.
Key capabilities:
- Query merge status: hasNewMerges(), numMerges()
- Wait synchronously: await(), await(timeout, unit)
- Wait asynchronously: awaitAsync() returns CompletableFuture<Void>
- Inspect individual merges: getMerge(int)
Changes:
- Add MergePolicy.MergeObserver nested class
- Update IndexWriter.forceMergeDeletes() methods to return MergeObserver
- Update RandomIndexWriter to propagate return type
- Add comprehensive tests (blocking/non-blocking modes, timeout handling)
Backward compatible: existing code that ignores the return value
continues to work without modification.1 parent 912e906 commit 78dedde
File tree
5 files changed
+441
-15
lines changed- lucene
- core/src
- java/org/apache/lucene/index
- test/org/apache/lucene/index
- test-framework/src/java/org/apache/lucene/tests/index
5 files changed
+441
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
| |||
Lines changed: 17 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2221 | 2221 | | |
2222 | 2222 | | |
2223 | 2223 | | |
| 2224 | + | |
| 2225 | + | |
2224 | 2226 | | |
2225 | | - | |
| 2227 | + | |
2226 | 2228 | | |
2227 | 2229 | | |
2228 | 2230 | | |
| |||
2234 | 2236 | | |
2235 | 2237 | | |
2236 | 2238 | | |
2237 | | - | |
| 2239 | + | |
2238 | 2240 | | |
2239 | 2241 | | |
2240 | | - | |
2241 | | - | |
2242 | | - | |
2243 | | - | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
2244 | 2246 | | |
2245 | 2247 | | |
2246 | 2248 | | |
2247 | 2249 | | |
2248 | 2250 | | |
2249 | | - | |
2250 | | - | |
| 2251 | + | |
| 2252 | + | |
2251 | 2253 | | |
2252 | 2254 | | |
2253 | 2255 | | |
| |||
2263 | 2265 | | |
2264 | 2266 | | |
2265 | 2267 | | |
2266 | | - | |
| 2268 | + | |
2267 | 2269 | | |
2268 | 2270 | | |
2269 | 2271 | | |
| |||
2282 | 2284 | | |
2283 | 2285 | | |
2284 | 2286 | | |
| 2287 | + | |
2285 | 2288 | | |
2286 | 2289 | | |
2287 | 2290 | | |
| |||
2296 | 2299 | | |
2297 | 2300 | | |
2298 | 2301 | | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
2299 | 2305 | | |
2300 | | - | |
2301 | | - | |
| 2306 | + | |
| 2307 | + | |
2302 | 2308 | | |
2303 | 2309 | | |
2304 | 2310 | | |
| |||
Lines changed: 92 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
939 | 939 | | |
940 | 940 | | |
941 | 941 | | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
942 | 1034 | | |
0 commit comments