Skip to content

Commit 67a6e9b

Browse files
authored
Merge pull request #6750 from EnterpriseDB/DOCS-1258-pgd-document-function-bdr-galloc_chunk_info-
Porting galloc content to 5.8
2 parents 73dd00d + 16ff2ca commit 67a6e9b

File tree

6 files changed

+422
-408
lines changed

6 files changed

+422
-408
lines changed

product_docs/docs/pgd/5.8/reference/index.json

Lines changed: 374 additions & 373 deletions
Large diffs are not rendered by default.

product_docs/docs/pgd/5.8/reference/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ The reference section is a definitive listing of all functions, views, and comma
373373
* [`bdr.extract_nodeid_from_timeshard`](sequences#bdrextract_nodeid_from_timeshard)
374374
* [`bdr.extract_localseqid_from_timeshard`](sequences#bdrextract_localseqid_from_timeshard)
375375
* [`bdr.timestamp_to_timeshard`](sequences#bdrtimestamp_to_timeshard)
376+
* [`bdr.galloc_chunk_info`](sequences#bdrgalloc_chunk_info)
376377
### [KSUUID v2 functions](sequences#ksuuid-v2-functions)
377378
* [`bdr.gen_ksuuid_v2`](sequences#bdrgen_ksuuid_v2)
378379
* [`bdr.ksuuid_v2_cmp`](sequences#bdrksuuid_v2_cmp)

product_docs/docs/pgd/5.8/reference/sequences.mdx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,31 @@ bdr.timestamp_to_timeshard(ts timestamptz)
224224

225225
This function executes only on the local node.
226226

227+
228+
### `bdr.galloc_chunk_info`
229+
230+
This function retrieves the ranges allocated to a galloc sequence on the local
231+
node.
232+
233+
An empty result set will be returned if the sequence has not yet been accessed
234+
on the local node.
235+
236+
An ERROR will be raised if the provided sequence name is not a galloc sequence.
237+
238+
#### Synopsis
239+
240+
```sql
241+
bdr.galloc_chunk_info(seqname regclass)
242+
```
243+
244+
#### Parameters
245+
246+
- `seqname` - the name of the galloc sequence to query
247+
248+
#### Notes
249+
250+
This function executes only on the local node.
251+
227252
## KSUUID v2 functions
228253

229254
Functions for working with `KSUUID` v2 data, K-Sortable UUID data. See also [KSUUID in the sequences documentation](../sequences/#ksuuids).

product_docs/docs/pgd/5.8/rel_notes/pgd_5.8.0_rel_notes.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ EDB Postgres Distributed 5.8.0 includes a number of enhancements and bug fixes.
1313

1414
## Highlights
1515

16-
None yet.
16+
* Simpler sequence management with `bdr.galloc_chunk_info()`
1717

18-
## Bug Fixes
18+
## Enhancements
1919

2020
<table class="table w-100"><thead><tr><th>Component</th><th>Version</th><th>Description</th><th width="10%">Addresses</th></tr></thead><tbody>
21-
<tr><td>BDR</td><td>5.8.0</td><td>Release note here</td><td></td></tr>
21+
<tr><td>BDR</td><td>5.8.0</td><td>Added `bdr.galloc_chunk_info()` function to simplify sequences</td><td></td></tr>
2222
</tbody></table>
2323

2424

product_docs/docs/pgd/5.8/rel_notes/src/relnote_5.8.0.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ components:
1111
intro: |
1212
EDB Postgres Distributed 5.8.0 includes a number of enhancements and bug fixes.
1313
highlights: |
14-
None yet.
14+
* Simpler sequence management with `bdr.galloc_chunk_info()`
1515
relnotes:
16-
- relnote: Release note here
16+
- relnote: Added `bdr.galloc_chunk_info()` function to simplify sequences
1717
description: |
18-
This is a release note for the EDB Postgres Distributed 5.8.0 release.
19-
type: Bug Fix
18+
The `bdr.galloc_chunk_info()` function provides information about the chunk
19+
allocation for a given sequence. This function returns the chunk ID, the
20+
sequence ID, and the chunk size. This function is useful for debugging and
21+
understanding how sequences are allocated in BDR.
2022
component: BDR
21-
version: 5.8.0
22-
impact: Lowest
23-
23+
impact: Medium
24+
jira: BDR-6144
25+
addresses: ""
26+
type: Enhancement

product_docs/docs/pgd/5.8/sequences.mdx

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -332,48 +332,32 @@ SELECT * FROM bdr.sequence_alloc
332332
(1 row)
333333
```
334334

335-
To see the ranges currently assigned to a given sequence on each node, use
336-
these queries:
335+
336+
To see the ranges currently assigned to a given sequence on each node, execute the function
337+
[`bdr.galloc_chunk_info`](reference/sequences/#bdrgalloc_chunk_info).
337338

338339
* Node `Node1` is using range from `333` to `2000333`.
339340

340341
```sql
341-
SELECT last_value AS range_start, log_cnt AS range_end
342-
FROM categories_category_seq WHERE ctid = '(0,2)'; -- first range
343-
range_start | range_end
342+
SELECT * FROM bdr.galloc_chunk_info('categories_category_seq');
343+
chunk_start | chunk_end
344344
-------------+-----------
345345
334 | 1000333
346-
(1 row)
347-
348-
SELECT last_value AS range_start, log_cnt AS range_end
349-
FROM categories_category_seq WHERE ctid = '(0,3)'; -- second range
350-
range_start | range_end
351-
-------------+-----------
352346
1000334 | 2000333
353-
(1 row)
347+
(2 rows)
354348
```
355349

356350
* Node `Node2` is using range from `2000334` to `4000333`.
357351

358352
```sql
359-
SELECT last_value AS range_start, log_cnt AS range_end
360-
FROM categories_category_seq WHERE ctid = '(0,2)'; -- first range
361-
range_start | range_end
362-
-------------+-----------
363-
2000334 | 3000333
364-
(1 row)
365353

366-
SELECT last_value AS range_start, log_cnt AS range_end
367-
FROM categories_category_seq WHERE ctid = '(0,3)'; -- second range
368-
range_start | range_end
354+
SELECT * FROM bdr.galloc_chunk_info('categories_category_seq');
355+
chunk_start | chunk_end
369356
-------------+-----------
357+
2000334 | 3000333
370358
3000334 | 4000333
371359
```
372360

373-
!!! NOTE
374-
You can't combine it to a single query (like `WHERE ctid IN ('(0,2)', '(0,3)')`),
375-
as that still shows only the first range.
376-
377361
When a node finishes a chunk, it asks a consensus for a new one and gets the
378362
first available. In the example, it's from 4000334 to 5000333. This is
379363
the new reserved chunk and starts to consume the old reserved chunk.

0 commit comments

Comments
 (0)