Compressed Transitive Delta Encoding 1. Introduction
Total Page:16
File Type:pdf, Size:1020Kb
Compressed Transitive Delta Encoding Dana Shapira Department of Computer Science Ashkelon Academic College Ashkelon 78211, Israel [email protected] Abstract Given a source file S and two differencing files ∆(S; T ) and ∆(T;R), where ∆(X; Y ) is used to denote the delta file of the target file Y with respect to the source file X, the objective is to be able to construct R. This is intended for the scenario of upgrading soft- ware where intermediate releases are missing, or for the case of file system backups, where non consecutive versions must be recovered. The traditional way is to decompress ∆(S; T ) in order to construct T and then apply ∆(T;R) on T and obtain R. The Compressed Transitive Delta Encoding (CTDE) paradigm, introduced in this paper, is to construct a delta file ∆(S; R) working directly on the two given delta files, ∆(S; T ) and ∆(T;R), without any decompression or the use of the base file S. A new algorithm for solving CTDE is proposed and its compression performance is compared against the traditional \double delta decompression". Not only does it use constant additional space, as opposed to the traditional method which uses linear additional memory storage, but experiments show that the size of the delta files involved is reduced by 15% on average. 1. Introduction Differential file compression represents a target file T with respect to a source file S. That is, both the encoder and decoder have available identical copies of S. A new file T is encoded and subsequently decoded by making use of S. Traditional differencing algorithms compress data by finding common strings between two versions of a file and replacing these substrings by a copy reference. The resulting file is often called a delta file. There are many practical applications where new information is received or generated that is highly similar to information already present. For example, when a software revision is released to licensed users, the distributor can require that a user must perform the upgrade on the licensed copy of the existing version, and can then reduce the size of the upgrade file that must be sent to the user by employing differential file compression. In the case of several releases of upgrades of the same software, each revision is given as a delta file with respect to the previous release. Consider the case when a user is interested in a release which its source file is not present on his local computer. The traditional approach would be to start with the version he does have, working his way through all intermediate releases performing delta decoding to each version, until he receives the desired one. This paper suggests skipping delta encoding of upgrade releases when source files are missing, instead of obtaining unnecessary intermediate files. This will be done by generating a single delta file of the required version release with respect to the source file present on the user's computer. Since no assumptions are made about the resources available to the user on the distributor's website, and in order to reduce processing time, the construction of the new delta file is done in time proportional to the size of the input files,1 i.e., without any decompression. 1In practical applications, the size of the compressed file is generally proportional to the size of its original version. However, the definition applies also to the case of a sublinear compressed size as in [2]. Working on the compressed given form, the user can save memory space on the distributor's computer. Moreover, transmitting the created delta file instead of the series of delta files, can reduce the number of I/O operations. Processing time is also saved by decompressing only the constructed delta file instead of several files in the traditional approach. Another application of differential file compression is file system backups, including those done over a network. Incremental backups can not only avoid storing files that have not changed since the previous back-up and save space by standard file compression, but can also save space by differential compression of a file with respect to a similar but not identical version saved in the previous backup. Using the new framework, recovering the last file system based on several differential backups can be done by generating a new delta file of the last backup with respect to the current situation of the system, therefore avoiding delta decoding of unnecessary intermediate files which is done in the traditional way. In addition to the increased speed of decoding, restoring the file system requires only space for the old and new versions using the proposed technique, unlike a spare intermediate file used in the traditional method. Generating a delta file of two given files S and T can be done in two typical ways, LCS (Longest Common Substring) based algorithms (e.g. [7]), and edit-distance based algorithms (e.g. [1, 19, 20]). Hunt, Vo, and Tichy [8] compute a delta file by using the reference file as part of the dictionary to LZ-compress the target file. Their results indicate that delta compression algorithms based on LZ techniques significantly outperform LCS based algorithms in terms of compression performance. In this research we construct a delta file based on edit distance and LZ techniques for differencing. Factor, Sheinwald, and Yassour [4] employ Lempel-Ziv based compression to compress S with respect to a collection of shared files that resemble S; resemblance is indicated by files being of same type and/or produced by the same vendor, etc. They achieve better compression by reducing the set of all shared files to the only relevant subset. Based on these papers the constructed delta file in this research uses edit distance techniques including insert and copy commands. The already compressed part of the target file is also referenced for better compression. Burns and Long [3] achieve in-place reconstruction of standard delta files by eliminating write before read conflicts, where the encoder has specified a copy from a file region where new file data has already been written. Shapira and Storer [18] also study in-place differential file compression. They present a constant factor approximation algorithm based on a simple sliding window data compressor for the non in-place version of this problem which is known to be NP-Hard. Motivated by the constant bound approximation factor they modify the algorithm so that it is suitable for in-place decoding and present the In-Place Sliding Window Algorithm (IPSW). The advantage of the IPSW approach is simplicity and speed, achieves in- place without additional memory, with compression that compares well with existing methods (both in-place and not in-place). Our delta file is not necessarily in-place, but minor changes (such as limiting the offset’s size) can result in an in-place version of the file. Processing the compressed form of the file instead of working on the decompressed file in order to reduce processing time and memory storage was also carried out in the area of compressed pattern matching, i.e. performing pattern matching on the compressed form of the file, unlike the regular way of performing pattern matching on the decompressed file (Amir, Benson and Farach [2]). Compressed pattern matching was also studied in [5, 6, 9, 10, 11, 12, 13, 16, 17]. Working on the compressed delta file without the use of the source file, was also done in the framework of Compressed Delta Encoding, which generates the delta files of two given files S and T while processing their compressed form. Klein, Serebro and Shapira [14] and Klein and Shapira [15] explore the compressed differencing problem on LZW and LZSS compressed files, respectively, and devise a model for constructing delta encodings on compressed files. Experiments showed that the constructed delta file is much smaller than the corresponding input LZW and LZSS compressed files. Let ∆(X; Y ) denote the delta file of the target file Y with respect to the source file X. In this paper we explore the Compressed Transitive Delta Encoding (CTDE) paradigm, which is to construct a delta file ∆(S; R) working directly on the two given delta files, ∆(S; T ) and ∆(T;R), in time proportional to the size of the input. Section 2 defines the problem formally, and introduces two other variations of the problem. Section 3 presents an algorithm for solving the CTDE problem, and finally Section 4 presents experimental results. 2. Formal Discussion of the Problem Given a source file S and a target file T , the delta file ∆(S; T ) can be formed using a format of individual characters and copy items, where copies refer either to S or to T itself. The copies are initially described in the form of ordered pairs. An ordered pair (off; len) in T means that the substring starting at the position corresponding to the current ordered pair can be copied from off characters before the current position in the decompressed file, and the length of this substring (number of characters) is len. An ordered pair (pos; len) in S refers to a copy of a substring starting at position pos, and again the second component, len, is the number of its characters. To distinguish between copies from S and T we use an additional flag bit so that each copy item is in fact a triplet. For example, (0; pos; len) could refer to copies of substrings in S, while (1; off; len) would indicate that the copy is from T . Let S; T; R be 3 files. Given ∆(S; T ) and ∆(T;R) the goal is to be able to construct R.