diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2012-05-08 09:43:04 +0200 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2012-05-08 09:43:04 +0200 |
commit | c5924ed42eaf090fbad0494c3774a722e987d5cf (patch) | |
tree | 6b4cfed3dbbfc1b40191cda3f7310023fe01d2b0 /pgsql.c | |
parent | 8e4b3a1e3930fe1b54a94a62ab3521c09fa22df6 (diff) | |
download | pgfuse-c5924ed42eaf090fbad0494c3774a722e987d5cf.tar.gz pgfuse-c5924ed42eaf090fbad0494c3774a722e987d5cf.tar.bz2 |
another truncate logical error fixed
Diffstat (limited to 'pgsql.c')
-rw-r--r-- | pgsql.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -745,6 +745,8 @@ int psql_truncate( PGconn *conn, const size_t block_size, const int64_t id, cons param1 = htobe64( id ); param2 = htobe64( info.to_block ); + syslog( LOG_ERR, "TRUNC: %"PRIu64", block %jd", id, info.to_block ); + /* delete superflous blocks */ dbres = PQexecParams( conn, "DELETE FROM data WHERE dir_id=$1::bigint AND block_no>$2::bigint", 2, NULL, values, lengths, binary, 1 ); @@ -776,9 +778,9 @@ int psql_truncate( PGconn *conn, const size_t block_size, const int64_t id, cons return -EIO; } - if( atoi( PQcmdTuples( dbres ) ) != 1 ) { - syslog( LOG_ERR, "Expecting COUNT(1) in psql_truncate in file '%s' and padded block '%jd'. Data consistency problems!", - path, info.to_block ); + if( atoi( PQcmdTuples( dbres ) ) > 1 ) { + syslog( LOG_ERR, "Expecting COUNT(0/1) in psql_truncate in file '%s' and padded block '%jd'. Data consistency problems (%s)!", + path, info.to_block, sql ); PQclear( dbres ); return -EIO; } |