mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
9c53e07e46
Summary: Add optional compress on put controlled by a command line option. Other than costing some CPU time, this may be a good option when populating repos from existing uncompressed stores to new stores. Reviewed By: farnz Differential Revision: D22037756 fbshipit-source-id: e75190ddf9cfd4ed3ea9a18a0ec6d9342a90707b
40 lines
1.6 KiB
Perl
40 lines
1.6 KiB
Perl
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License found in the LICENSE file in the root
|
|
# directory of this source tree.
|
|
|
|
$ . "${TEST_FIXTURES}/library.sh"
|
|
|
|
setup configuration in usual uncompressed way
|
|
$ MULTIPLEXED=1 PACK_BLOB=0 default_setup_blobimport "blob_files"
|
|
hg repo
|
|
o C [draft;rev=2;26805aba1e60]
|
|
|
|
|
o B [draft;rev=1;112478962961]
|
|
|
|
|
o A [draft;rev=0;426bada5c675]
|
|
$
|
|
blobimporting
|
|
|
|
Check the stores have expected counts
|
|
$ ls blobstore/0/blobs/ | wc -l
|
|
30
|
|
$ ls blobstore/1/blobs/ | wc -l
|
|
30
|
|
|
|
Check that the packed sizes are larger due to the packblob wrappers on store 0
|
|
$ PACKED=$(du -s --bytes blobstore/0/blobs/ | cut -f1); UNPACKED=$(du -s --bytes blobstore/1/blobs/ | cut -f1)
|
|
$ if [[ "$PACKED" -le "$UNPACKED" ]]; then echo "expected packed $PACKED to be larger than unpacked $UNPACKED due to thift wrappers"; fi
|
|
|
|
Move the uncompressed packed store aside
|
|
$ mv "$TESTTMP/blobstore/0" "$TESTTMP/blobstore.raw"
|
|
$ rm -rf "$TESTTMP/monsql/sqlite_dbs" "$TESTTMP/blobstore_sync_queue/sqlite_dbs" "$TESTTMP/blobstore"
|
|
|
|
Blobimport again, but this time enable zstd compression
|
|
$ blobimport repo-hg/.hg repo --blobstore-write-zstd-level 0
|
|
|
|
Check that the packed sizes are smaller due to compression
|
|
$ PACKED=$(du -s --bytes blobstore/0/blobs/ | cut -f1); OLDPACKED=$(du -s --bytes blobstore.raw/blobs/ | cut -f1)
|
|
$ if [[ "$PACKED" -ge "$OLDPACKED" ]]; then echo "expected packed $PACKED to be smaller than packed $OLDPACKED due to compression"; fi
|