32TB relation size make mdnblocks overflow

From: 陈佳昕(步真) <buzhen(dot)cjx(at)alibaba-inc(dot)com>
To: "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: 32TB relation size make mdnblocks overflow
Date: 2022-01-18 06:21:14
Message-ID: c948baf6-b191-47c6-aea6-ec34c4e741ce.buzhen.cjx@alibaba-inc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

We know that PostgreSQL doesn't support a single relation size over 32TB, limited by the MaxBlockNumber. But if we just 'insert into' one relation over 32TB, it will get an error message 'unexpected data beyond EOF in block 0 of relation' in ReadBuffer_common. The '0 block' is from mdnblocks function where the segment number is over 256 and make segno * RELSEG_SIZE over uint32's max value. So is it necessary to make the error message more readable like 'The relation size is over max value ...' and elog in mdnblocks?

This scene we met is as below, 'shl $0x18, %eax' make $ebx from 256 to 0, which makes segno from 256 to 0.

0x0000000000c2cc51 <+289>: callq 0xc657f0 <PathNameOpenFilePerm>
0x0000000000c2cc56 <+294>: mov -0x8(%r15),%rdi
0x0000000000c2cc5a <+298>: mov %r15,%rsi
0x0000000000c2cc5d <+301>: mov %eax,%r14d
0x0000000000c2cc60 <+304>: mov 0x10(%rdi),%rax
0x0000000000c2cc64 <+308>: callq *0x8(%rax)
0x0000000000c2cc67 <+311>: test %r14d,%r14d
0x0000000000c2cc6a <+314>: jns 0xc2cd68 <mdnblocks+568>
=> 0x0000000000c2cc70 <+320>: add $0x28,%rsp
0x0000000000c2cc74 <+324>: mov %ebx,%eax
0x0000000000c2cc76 <+326>: shl $0x18,%eax
0x0000000000c2cc79 <+329>: pop %rbx
0x0000000000c2cc7a <+330>: pop %r12
0x0000000000c2cc7c <+332>: pop %r13
0x0000000000c2cc7e <+334>: pop %r14
0x0000000000c2cc80 <+336>: pop %r15
0x0000000000c2cc82 <+338>: pop %rbp
0x0000000000c2cc83 <+339>: retq

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rushabh Lathia 2022-01-18 06:25:17 Re: tweak to a few index tests to hits ambuildempty() routine.
Previous Message Amit Langote 2022-01-18 06:11:34 Re: a misbehavior of partition row movement (?)