1#!/bin/sh 2# 3# Test if Bareos can handle big fileset 4# This test create 2M files on a directory and 5# backup it twice in accurate mode. 6# 7# Creating 2M files is very long, so the "many-files" 8# directory isn' cleaned at the end. 9# 10 11TestName="big-files-test" 12JobName=BigFiles 13. scripts/functions 14 15copy_test_confs 16 17echo "${cwd}/many-files" >${cwd}/tmp/file-list 18if [ ! -f ${cwd}/many-files/100000file100000 ]; then 19 mkdir -p ${cwd}/many-files 20 cd ${cwd}/many-files 21 print_debug "Creating 2000000 files..." 22 time perl -e 'for($i=0; $i < 2000000; $i++) {open(FP, ">${i}file${i}") or die "$!"; print FP "$i\n"; close(FP); print "\r$i " if ($i%10000);}' 23fi 24 25cd $cwd} 26 27sed 's%# Label Format% Label Format%' ${cwd}/bin/bareos-dir.conf > ${cwd}/tmp/1 28# sed 's%Type = Backup%Type = Backup; Accurate = yes%' ${cwd}/tmp/1 > ${cwd}/bin/bareos-dir.conf 29sed 's%Type = Backup%Type = Backup%' ${cwd}/tmp/1 > ${cwd}/bin/bareos-dir.conf 30 31$bperl -e "add_attribute('$conf/bareos-dir.conf', 'Max Run Time', '90min', 'Job')" 32$bperl -e "add_attribute('$conf/bareos-dir.conf', 'SpoolData', 'no', 'Job')" 33 34change_jobname MonsterFileSet $JobName 35start_test 36 37cat <<END_OF_SCRIPT >${cwd}/tmp/bconcmds 38@$out /dev/null 39messages 40@$out ${cwd}/tmp/log1.out 41status all 42status all 43list pools 44messages 45@#setdebug level=110 storage=File 46run job=$JobName spooldata=no storage=File yes 47list pools 48list volumes 49wait 50sql 51SELECT StartTime, JobFiles, JobId, Level, count(*) AS nb_jobmedia 52FROM JobMedia join Job using (JobId) join Client using (ClientId) 53where Client.Name = 'localhost-fd' group by JobId, Level, StartTime, 54JobFiles order by JobId desc ; 55 56messages 57run job=$JobName spooldata=no storage=File yes 58wait 59messages 60@# 61@# now do a restore 62@# 63@$out ${cwd}/tmp/log2.out 64@#setdebug level=400 storage=File 65restore where=${cwd}/many-files/bareos-restores select storage=File 66unmark * 67mark * 68count 69find 10file10 70pwd 71estimate 72done 73yes 74wait 75messages 76quit 77END_OF_SCRIPT 78 79run_bareos 80check_for_zombie_jobs storage=File || exit 1 81stop_bareos 82 83check_two_logs 84 85# we are really more interested to know if backup and restore 86# worked, but checking the files restored is non-trivial due 87# to the big fileset exclusions 88# check_restore_diff 89 90zstat=0 91dstat=0 92bstat=0 93rstat=0 94end_test 95