Commit a014f55
Ali Beyad
Sequence Numbers Lucene commit data uses Iterable interface
Sequence number related data (maximum sequence number, local checkpoint,
and global checkpoint) gets stored in Lucene on each commit. The logical
place to store this data is on each Lucene commit's user commit data
structure (see IndexWriter#setCommitData and the new version
IndexWriter#setLiveCommitData). However, previously we did not store the
maximum sequence number in the commit data because the commit data got
copied over before the Lucene IndexWriter flushed the documents to segments
in the commit. This means that between the time that the commit data was
set on the IndexWriter and the time that the IndexWriter completes the commit,
documents with higher sequence numbers could have entered the commit.
Hence, we would use FieldStats on the _seq_no field in the documents to get
the maximum sequence number value, but this suffers the drawback that if the
last sequence number in the commit corresponded to a delete document action,
that sequence number would not show up in FieldStats as there would be no
corresponding document in Lucene.
In Lucene 6.2, the commit data was changed to take an Iterable interface, so
that the commit data can be calculated and retrieved *after* all documents
have been flushed, while the commit data itself is being set on the Lucene commit.
This commit changes max_seq_no so it is stored in the commit data instead of
being calculated from FieldStats, taking advantage of the deferred calculation
of the max_seq_no through passing an Iterable that dynamically sets the iterator
data.1 parent 27eab74 commit a014f55
File tree
3 files changed
+56
-30
lines changed- core/src
- main/java/org/elasticsearch/index
- engine
- seqno
- test/java/org/elasticsearch/index/engine
3 files changed
+56
-30
lines changedLines changed: 32 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
| |||
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
62 | | - | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
| |||
86 | 84 | | |
87 | 85 | | |
88 | 86 | | |
89 | | - | |
90 | | - | |
91 | 87 | | |
92 | 88 | | |
93 | 89 | | |
| |||
121 | 117 | | |
122 | 118 | | |
123 | 119 | | |
| 120 | + | |
124 | 121 | | |
125 | 122 | | |
126 | 123 | | |
| |||
326 | 323 | | |
327 | 324 | | |
328 | 325 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | 340 | | |
356 | 341 | | |
357 | 342 | | |
| |||
1336 | 1321 | | |
1337 | 1322 | | |
1338 | 1323 | | |
1339 | | - | |
| 1324 | + | |
1340 | 1325 | | |
1341 | 1326 | | |
1342 | | - | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
1343 | 1344 | | |
1344 | 1345 | | |
1345 | 1346 | | |
| |||
1395 | 1396 | | |
1396 | 1397 | | |
1397 | 1398 | | |
1398 | | - | |
| 1399 | + | |
| 1400 | + | |
1399 | 1401 | | |
1400 | 1402 | | |
1401 | 1403 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
586 | 590 | | |
587 | 591 | | |
588 | 592 | | |
| |||
608 | 612 | | |
609 | 613 | | |
610 | 614 | | |
| 615 | + | |
| 616 | + | |
611 | 617 | | |
612 | 618 | | |
613 | 619 | | |
| |||
1625 | 1631 | | |
1626 | 1632 | | |
1627 | 1633 | | |
| 1634 | + | |
1628 | 1635 | | |
1629 | 1636 | | |
1630 | 1637 | | |
| |||
1653 | 1660 | | |
1654 | 1661 | | |
1655 | 1662 | | |
| 1663 | + | |
1656 | 1664 | | |
1657 | 1665 | | |
1658 | 1666 | | |
| |||
1661 | 1669 | | |
1662 | 1670 | | |
1663 | 1671 | | |
| 1672 | + | |
1664 | 1673 | | |
1665 | 1674 | | |
1666 | 1675 | | |
| |||
1671 | 1680 | | |
1672 | 1681 | | |
1673 | 1682 | | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
1674 | 1686 | | |
1675 | 1687 | | |
1676 | 1688 | | |
| |||
1681 | 1693 | | |
1682 | 1694 | | |
1683 | 1695 | | |
| 1696 | + | |
1684 | 1697 | | |
1685 | 1698 | | |
1686 | 1699 | | |
1687 | 1700 | | |
1688 | 1701 | | |
1689 | 1702 | | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
1690 | 1707 | | |
1691 | 1708 | | |
1692 | 1709 | | |
| |||
0 commit comments