Bend.Repl.ReplHandler.truncateLogs_Hack C# (CSharp) Method

truncateLogs_Hack() public method

public truncateLogs_Hack ( ) : void
return void
        public void truncateLogs_Hack()
        {
            // we want to erase all log entries except the last to cause a gap
            // force others to full rebuild

            Console.WriteLine("*** ReplHandler({0}): truncateLogs_Hack!!", this.ctx.server_guid);

            foreach (var ls in this.getStatusForLogs()) {
                var scan_old_log_entries = new ScanRange<RecordKey>(
                    new RecordKey().appendKeyPart("_logs").appendKeyPart(ls.server_guid),
                    new RecordKey().appendKeyPart("_logs").appendKeyPart(ls.server_guid).appendKeyPart(ls.log_commit_head),
                    null);

                foreach (var row in this.next_stage.scanForward(scan_old_log_entries)) {
                    // make sure we stop before we delete the last entry
                    LogEntry le = _decodeLogEntry(row.Key, row.Value);
                    if (le.logstamp.Equals(ls.log_commit_head)) {
                        // we reached the head...
                        break;
                    }
                    this.next_stage.setValue(row.Key, RecordUpdate.DeletionTombstone());
                    Console.WriteLine("   truncateLogs({0}): deleting {1}", ctx.server_guid, row);
                }
            }
        }