void
TruncateAOSegmentFile(File fd, Relation rel, int32 segFileNum, int64 offset, AOVacuumRelStats *vacrelstats)
{
char *relname = RelationGetRelationName(rel);
int64 filesize_before;
Assert(fd > 0);
Assert(offset >= 0);
RelationOpenSmgr(rel);
filesize_before = rel->rd_smgr->smgr_ao->smgr_FileSize(fd);
if (filesize_before < offset)
ereport(ERROR,
(errmsg("\"%s\": file size smaller than logical eof: %m",
relname)));
ttt=# CREATE TABLE test_sokolov
(
vendorid int8 NULL,
pickup_date date NULL,
tpep_pickup_dttm timestamp(0) NULL,
tpep_dropoff_dttm timestamp(0) NULL,
passenger_count bigint NULL,
trip_distance float8 NULL,
ratecodeid float8 NULL,
store_and_fwd_flag bpchar(1) NULL,
pulocationid int8 NULL,
dolocationid int8 NULL,
payment_type int8 NULL,
fare_amount float8 NULL,
extra float8 NULL,
mta_tax float8 NULL,
tip_amount float8 NULL,
tolls_amount float8 NULL,
improvement_surcharge float8 NULL,
total_amount float8 NULL,
congestion_surcharge float8 NULL,
airport_fee float8 NULL
)
with
(
appendoptimized=true,
orientation=column,
compresstype=ZLIB,
compresslevel=6
)
DISTRIBUTED RANDOMLY
PARTITION BY RANGE(pickup_date)
(
START (date '2013-01-01') INCLUSIVE
END (date '2025-01-01') EXCLUSIVE
EVERY (INTERVAL '1 year'),
default partition other
);
CREATE TABLE
ttt=# insert into test_sokolov values (1, now(), now(), now(), 1, 1, 1, '1', 1,1,1, 1,1,1, 1,1,1, 1,1,1);
INSERT 0 1
ttt=# vacuum ANALYZE test_sokolov;
ERROR: "test_sokolov_1_prt_other": file size smaller than logical eof: Success (aomd.c:207) (seg0 10.129.0.32:6000 pid=3454980) (aomd.c:207)
ttt=#
Apache Cloudberry version
No response
What happened
When the error happens,
filesize_beforeis file size of the main fork ofpg_aocsseg, andoffsetis size of the first column file.What you think should happen instead
No response
How to reproduce
The reproduction is not stable
Operating System
Ubuntu
Anything else
No response
Are you willing to submit PR?
Code of Conduct