summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2012-05-08 09:43:04 +0200
committerAndreas Baumann <abaumann@yahoo.com>2012-05-08 09:43:04 +0200
commitc5924ed42eaf090fbad0494c3774a722e987d5cf (patch)
tree6b4cfed3dbbfc1b40191cda3f7310023fe01d2b0
parent8e4b3a1e3930fe1b54a94a62ab3521c09fa22df6 (diff)
downloadpgfuse-c5924ed42eaf090fbad0494c3774a722e987d5cf.tar.gz
pgfuse-c5924ed42eaf090fbad0494c3774a722e987d5cf.tar.bz2
another truncate logical error fixed
-rw-r--r--pgsql.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pgsql.c b/pgsql.c
index 4932810..e42a6cf 100644
--- a/pgsql.c
+++ b/pgsql.c
@@ -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;
}