Example #1
0
        private void  VerifyCommitOrder(System.Collections.IList commits)
        {
            IndexCommit firstCommit = ((IndexCommit)commits[0]);
            long        last        = SegmentInfos.GenerationFromSegmentsFileName(firstCommit.GetSegmentsFileName());

            Assert.AreEqual(last, firstCommit.GetGeneration());
            long lastVersion   = firstCommit.GetVersion();
            long lastTimestamp = firstCommit.GetTimestamp();

            for (int i = 1; i < commits.Count; i++)
            {
                IndexCommit commit       = ((IndexCommit)commits[i]);
                long        now          = SegmentInfos.GenerationFromSegmentsFileName(commit.GetSegmentsFileName());
                long        nowVersion   = commit.GetVersion();
                long        nowTimestamp = commit.GetTimestamp();
                Assert.IsTrue(now > last, "SegmentInfos commits are out-of-order");
                Assert.IsTrue(nowVersion > lastVersion, "SegmentInfos versions are out-of-order");
                Assert.IsTrue(nowTimestamp >= lastTimestamp, "SegmentInfos timestamps are out-of-order: now=" + nowTimestamp + " vs last=" + lastTimestamp);
                Assert.AreEqual(now, commit.GetGeneration());
                last          = now;
                lastVersion   = nowVersion;
                lastTimestamp = nowTimestamp;
            }
        }