Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 34eefe8

Browse files
committed
PGPRO-202 # comment force truncation of compressed file
1 parent eb14659 commit 34eefe8

File tree

1 file changed

+2
-1
lines changed
  • src/backend/storage/file

1 file changed

+2
-1
lines changed

src/backend/storage/file/fd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,8 @@ FileTruncate(File file, off_t offset)
21222122
pg_atomic_write_u32(&map->virtSize, offset);
21232123
pg_atomic_fetch_sub_u32(&map->usedSize, released);
21242124
cfs_unlock_file(map);
2125-
returnCode = 0;
2125+
/* We can truncate compressed file only with zero offset */
2126+
returnCode = (offset == 0) ? ftruncate(VfdCache[file].fd, 0) : 0;
21262127
} else {
21272128
returnCode = ftruncate(VfdCache[file].fd, offset);
21282129
}

0 commit comments

Comments
 (0)