From: ganiuszka <gan...@gm...> - 2011-03-11 20:46:05
|
Hi, In my example jobid is putting in: ... File.JobId=8... but this "eight": base64_decode_lstat(8,File.LStat) is exactly eight field (encoded filesize field). I seem that you used standard base64 decoder to decode eighth field. Am I right? Bacula lstat is encoded by using non-standard base64 algorithm. Your decoded lstat shows like this: [dev] => 89 [inodes] => 1366434 [mode] => 33200 [links] => 1 [uid] => 80 [gid] => 91 [rdev] => 5481898 [size] => 315 [blksize] => 16384 [blocks] => 4 [atime] => 1299770037 [mtime] => 1299770037 [ctime] => 1299770066 [LinkFl] => 0 [flags] => 0 [data] => 2 I do not understand every field, but most fields is clear. Now, I wrote implementation of Bacula base64_decoder in PHP. I need finish it and make WebGUI for this and I will share this decoder here. For this I am using source code of base64 implementation in Bacula and this: http://old.nabble.com/The-File.LStat-field-td940366.html Regards. gani 2011/3/11 Dan Langille <da...@la...>: > On 3/9/2011 5:36 PM, ganiuszka wrote: > >> 2011/3/9 Mike Eggleston<mik...@ma...>: >>> >>> Afternoon, >>> >>> I just noticed one of my clients had a huge incremental (level 2) >>> backup. I want to see what file caused the huge increase. I tried 'list >>> files jobid=20097' and though I'm shown the files, I'm not shown the >>> size of each file. Is there a command or query that shows me the size >>> of the file? >>> >>> Mike > >> Hi, >> Here you have SQL function for PostgreSQL (I took it from bweb): >> >> CREATE PROCEDURAL LANGUAGE plpgsql; >> BEGIN; >> >> CREATE OR REPLACE FUNCTION base64_decode_lstat(int4, varchar) RETURNS int8 >> AS $$ >> DECLARE >> val int8; >> b64 varchar(64); >> size varchar(64); >> i int; >> BEGIN >> size := split_part($2, ' ', $1); >> b64 := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; >> val := 0; >> FOR i IN 1..length(size) LOOP >> val := val + (strpos(b64, substr(size, i, 1))-1) * (64^(length(size)-i)); >> END LOOP; >> RETURN val; >> END; >> $$ language 'plpgsql'; >> >> COMMIT; >> >> and this is a query which lists file path, filename and size in Bytes >> (in this example for jobid=8): >> >> SELECT Path.Path, Filename.Name, base64_decode_lstat(8,File.LStat) AS >> size FROM Filename, File, Path WHERE File.JobId=8 AND >> File.PathId=Path.PathId AND Filename.FilenameId=File.FilenameId ORDER >> BY size ASC; >> >> I tested it. It works. > > For the record: > > In this query, I see base64_decode_lstat(8,File.LStat) > > What is 8? It is not jobid. It is a field id. This lstat value: > > BZ FNmi IGw B BQ Bb U6Wq E7 EAA E BNeOq1 BNeOq1 BNeOrS A A C > > The eight field, as defined by ' ', is E7. > > -- > Dan Langille - http://langille.org/ > -- "Większej miłości nikt nie ma nad tę, jak gdy kto życie swoje kładzie za przyjaciół swoich." Jezus Chrystus |