Skip to content

Commit e8d526b

Browse files
committed
-
1 parent 260738c commit e8d526b

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

contrib/pg_exchange/expath.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* expath.c
3+
*
4+
*/
5+
6+
#include "postgres.h"
7+
8+
#include "optimizer/pathnode.h"
9+
10+
#include "expath.h"
11+
12+
13+
/*
14+
* FDW paths and EXCHANGE paths are incompatible and can't be combined at a plan.
15+
* We need to construct two non-intersecting path branches across all plan.
16+
* Costs of this plans is not an indicator of path quality at intermediate
17+
* stages of a plan building. We need bypass add_path() path checking procedure.
18+
*/
19+
void
20+
force_add_path(RelOptInfo *rel, Path *path)
21+
{
22+
List *pathlist = rel->pathlist;
23+
24+
rel->pathlist = NIL;
25+
rel->cheapest_parameterized_paths = NIL;
26+
rel->cheapest_startup_path = rel->cheapest_total_path =
27+
rel->cheapest_unique_path = NULL;
28+
add_path(rel, path);
29+
rel->pathlist = list_concat(rel->pathlist, pathlist);
30+
set_cheapest(rel);
31+
}

contrib/pg_exchange/expath.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* expath.h
3+
*
4+
*/
5+
6+
#ifndef EXPATH_H_
7+
#define EXPATH_H_
8+
9+
#include "nodes/relation.h"
10+
11+
void force_add_path(RelOptInfo *rel, Path *path);
12+
13+
#endif /* EXPATH_H_ */

contrib/pg_exchange/sbuf.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* sbuf.c
3+
*
4+
*/
5+
6+
#include "sbuf.h"
7+
8+
void
9+
initTupleBuffer(TupleBuffer *tbuf, size_t mem_size)
10+
{
11+
tbuf->curptr = &tbuf->data;
12+
/* Will corrected before send to DMQ for 'trim tails' purpose. */
13+
tbuf->size = mem_size;
14+
}

contrib/pg_exchange/sbuf.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* sbuf.h
3+
*
4+
*/
5+
6+
#ifndef SBUF_H_
7+
#define SBUF_H_
8+
9+
#include "postgres.h"
10+
11+
typedef struct TupleBuffer
12+
{
13+
size_t size;
14+
void *curptr;
15+
char data[FLEXIBLE_ARRAY_MEMBER];
16+
} TupleBuffer;
17+
18+
#define DEFAULT_TUPLEBUF_SIZE (BLCKSZ * 2)
19+
20+
extern void initTupleBuffer(TupleBuffer *tbuf, size_t mem_size);
21+
22+
#endif /* SBUF_H_ */

0 commit comments

Comments
 (0)