Ticket #278: remove_max_changesets.diff

File remove_max_changesets.diff, 2.0 KB (added by Dan, 14 years ago)
  • xapian-core/backends/brass/brass_database.cc

    diff --git a/xapian-core/backends/brass/brass_database.cc b/xapian-core/backends/brass/brass_database.cc
    index ed821b5..6ad4caa 100644
    a b BrassDatabase::set_revision_number(brass_revision_number_t new_revision)  
    409409                        + changes_name + " to write";
    410410                throw Xapian::DatabaseError(message, errno);
    411411            }
    412         }
     412
     413            // while change sets less than N - max_changesets exist, delete them
     414            int rev = old_revision - max_changesets;
     415            if (rev > 0) {
     416                    while(io_unlink(db_dir + "/changes" + str(rev--))) ;
     417            }
     418        }
    413419    }
    414420
    415421    try {
  • xapian-core/backends/chert/chert_database.cc

    diff --git a/xapian-core/backends/chert/chert_database.cc b/xapian-core/backends/chert/chert_database.cc
    index 451ece6..91e8507 100644
    a b ChertDatabase::set_revision_number(chert_revision_number_t new_revision)  
    405405                                               "/changes" + str(old_revision),
    406406                                               changes_name);
    407407        }
     408
     409        // while change sets less than N - max_changesets exist, delete them
     410        int rev = old_revision - max_changesets;
     411        if (rev > 0) {
     412                while(io_unlink(db_dir + "/changes" + str(rev--))) ;
     413        }
    408414    }
    409415
    410416    try {
  • xapian-core/backends/flint/flint_database.cc

    diff --git a/xapian-core/backends/flint/flint_database.cc b/xapian-core/backends/flint/flint_database.cc
    index d2717f1..5a6099a 100644
    a b FlintDatabase::set_revision_number(flint_revision_number_t new_revision)  
    434434            changes_fd = create_changeset_file(db_dir,
    435435                                               "/changes" + str(old_revision),
    436436                                               changes_name);
    437         }
     437
     438            // while change sets less than N - max_changesets exist, delete them
     439            int rev = old_revision - max_changesets;
     440            if (rev > 0) {
     441                    while(io_unlink(db_dir + "/changes" + str(rev--))) ;
     442            }
     443        }
    438444    }
    439445
    440446    try {