public virtual void OnInit(System.Collections.IList commits) { for (System.Collections.IEnumerator iterator = commits.GetEnumerator(); iterator.MoveNext();) { IndexCommit commit = (IndexCommit)iterator.Current; System.Collections.Generic.IDictionary <string, string> userData = commit.GetUserData(); if (userData.Count > 0) { // Label for a commit point is "Records 1-30" // This code reads the last id ("30" in this example) and deletes it // if it is after the desired rollback point System.String x = (System.String)userData["index"]; System.String lastVal = x.Substring(x.LastIndexOf("-") + 1); int last = System.Int32.Parse(lastVal); if (last > rollbackPoint) { /* * System.out.print("\tRolling back commit point:" + * " UserData="+commit.getUserData() +") ("+(commits.size()-1)+" commit points left) files="); * Collection files = commit.getFileNames(); * for (Iterator iterator2 = files.iterator(); iterator2.hasNext();) { * System.out.print(" "+iterator2.next()); * } * System.out.println(); */ commit.Delete(); } } } }
public override void Delete() { lock (outerInstance) { // Suppress the delete request if this commit point is // currently snapshotted. if (!outerInstance.m_refCounts.ContainsKey(m_cp.Generation)) { m_cp.Delete(); } } }
public override void Delete() { lock (Enclosing_Instance) { // Suppress the delete request if this commit point is // our current snapshot. if (Enclosing_Instance.snapshot == null || !Enclosing_Instance.snapshot.Equals(GetSegmentsFileName())) { cp.Delete(); } } }
public virtual void OnInit(System.Collections.IList commits) { Enclosing_Instance.VerifyCommitOrder(commits); numOnInit++; // On init, delete all commit points: System.Collections.IEnumerator it = commits.GetEnumerator(); while (it.MoveNext()) { IndexCommit commit = (IndexCommit)it.Current; commit.Delete(); Assert.IsTrue(commit.IsDeleted()); } }
public override void Delete() { UninterruptableMonitor.Enter(outerInstance); try { // Suppress the delete request if this commit point is // currently snapshotted. if (!outerInstance.m_refCounts.ContainsKey(m_cp.Generation)) { m_cp.Delete(); } } finally { UninterruptableMonitor.Exit(outerInstance); } }
public virtual void OnCommit(System.Collections.IList commits) { Enclosing_Instance.VerifyCommitOrder(commits); IndexCommit lastCommit = (IndexCommit)commits[commits.Count - 1]; // Any commit older than expireTime should be deleted: double expireTime = dir.FileModified(lastCommit.GetSegmentsFileName()) / 1000.0 - expirationTimeSeconds; System.Collections.IEnumerator it = commits.GetEnumerator(); while (it.MoveNext()) { IndexCommit commit = (IndexCommit)it.Current; double modTime = dir.FileModified(commit.GetSegmentsFileName()) / 1000.0; if (commit != lastCommit && modTime < expireTime) { commit.Delete(); numDelete += 1; } } }