Delete earlier versions of SVN (subversion)

Source: Internet
Author: User
The last version management server encountered a problem where the hard disk space was insufficient. According to the survey, a version library exists at 47 GB, occupying most of the server hard disk space. After consultation with the company in use, the company decided to delete the early version of the version library resume to reduce the size of the version Library.

The last version management server encountered a problem where the hard disk space was insufficient. According to the survey, a version library exists at 47 GB, occupying most of the server hard disk space. After consultation with the company in use, the company decided to delete the early version of the version library resume to reduce the size of the version Library.
The specific job process is as follows:

Preparations

Stop the apache server and modify the version Library Directory permission to root to prevent all users from using the version Library. Restart apache to ensure that users of other versions continue to use apache.

Back up the original version Library.

Full version database backup can be performed using svnadmin dump or svnadmin hotcopy. Both methods are used throughout the process. First, it is used as a full backup of the version database to prevent immediate restoration of the original version database when a job error occurs in the future. we recommend that you use svnadmin hotcopy. On the one hand, this backup speed is relatively fast. on the other hand, the backup result is a version database that can be used immediately. you just need to copy it back when you need to recover it. The command is as follows:
Svnadmin hotcopy -- clean-logs/path/to/repo./hotcopy> hotcopy. log 2> hotcopy_err.log &
The backup result is a directory with a size of 47 GB, which is basically the same as that of the original database.

Version to be retained in the dump version Library.

Run the svnlook youngest/path/to/repo command to check the version of the version Library. The version library for my job is 14079. After consultation with the other company, the company decided to retain the version between 10000 and 14079. Therefore, dump versions later than 10000 from the version Library. The command is as follows:
Svnadmin dump/path/to/repo-r 10000: 14079> repo_dump_10000-14079.dmp 2> repo_dump_10000-14079.log &
The dump file is about 34 GB.
Check the log file to make sure all required versions are correctly dumped.

Rebuilding the version Library

Rm-rf/path/to/repo
Svnadmin create/path/to/repo
Note that the -- fs-type bdb parameter is not used, so the created version Library is the backend of FSFS. I will continue to explain why I did this later.

Re-import the new version

Svnadmin load/path/to/repo <repo_dump_10000-14079.dmp> repo_load.log 2> repo_load_err.log &
Check the log file to see if load is successful. Run the svnlook command to check the latest version of the library after load.

Modify version Library permissions

Chown-R apache: apache/path/to/repo

The deletion of the previous versions of the version Library ends. It should be noted that the latest version of the new version library should be 4080. In addition, the size of the new version is only 2.7 GB. This result once made me suspect that load was not successful. But it does. It should be noted that the version library that occupies the 47G is in BDB format. I tried to create a BDB back-end version library and imported the dump file in the same way. The size of the result version Library is close to 30 GB. In addition, the import speed is much slower than that of the FSFS back-end version Library. It takes more than an hour. It can be seen that the size difference between the BDB backend and FSFS backend version libraries is astonishing in some cases. Although the manual also said that FSFS would be smaller than BDB, it was never expected to be much smaller. The format of subversion is reasonable. However, I always think that BDB has a longer and more stable history. Therefore, in the future, I prefer to use the BDB backend format when the hard disk space is insufficient.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.