Skip to content

Commit

Permalink
Refactor ChunkDispatch to remove ChunkDispatchInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
svenklemm authored and RobAtticus committed Dec 4, 2018
1 parent 8f5a3c0 commit 966ffd6
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 144 deletions.
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ set(SOURCES
chunk_adaptive.c
chunk_constraint.c
chunk_dispatch.c
chunk_dispatch_info.c
chunk_dispatch_plan.c
chunk_dispatch_state.c
chunk_index.c
Expand Down
95 changes: 0 additions & 95 deletions src/chunk_dispatch_info.c

This file was deleted.

31 changes: 0 additions & 31 deletions src/chunk_dispatch_info.h

This file was deleted.

10 changes: 4 additions & 6 deletions src/chunk_dispatch_plan.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "chunk_dispatch_plan.h"
#include "chunk_dispatch_state.h"
#include "chunk_dispatch_info.h"

/*
* Create a ChunkDispatchState node from this plan. This is the full execution
Expand All @@ -25,7 +24,7 @@
static Node *
create_chunk_dispatch_state(CustomScan *cscan)
{
return (Node *) chunk_dispatch_state_create(linitial(cscan->custom_private),
return (Node *) chunk_dispatch_state_create(linitial_oid(cscan->custom_private),
linitial(cscan->custom_plans));
}

Expand Down Expand Up @@ -117,8 +116,8 @@ build_customscan_targetlist(Relation rel, List *targetlist)
* in a hypertable.
*
* Note that CustomScan nodes cannot be extended (by struct embedding) because
* they might be copied, therefore we pass any extra info as a ChunkDispatchInfo
* in the custom_private field.
* they might be copied, therefore we pass hypertable_relid in the
* custom_private field.
*
* The chunk dispatch plan takes the original tuple-producing subplan, which was
* part of a ModifyTable node, and imposes itself inbetween the ModifyTable plan
Expand All @@ -130,10 +129,9 @@ CustomScan *
chunk_dispatch_plan_create(Plan *subplan, Index hypertable_rti, Oid hypertable_relid, Query *parse)
{
CustomScan *cscan = makeNode(CustomScan);
ChunkDispatchInfo *info = chunk_dispatch_info_create(hypertable_relid, parse);
Relation rel;

cscan->custom_private = list_make1(info);
cscan->custom_private = list_make1_oid(hypertable_relid);
cscan->methods = &chunk_dispatch_plan_methods;
cscan->custom_plans = list_make1(subplan);
cscan->scan.scanrelid = 0; /* Indicate this is not a real relation we are
Expand Down
5 changes: 2 additions & 3 deletions src/chunk_dispatch_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include "chunk_dispatch_state.h"
#include "chunk_dispatch_plan.h"
#include "chunk_dispatch_info.h"
#include "chunk_dispatch.h"
#include "chunk_insert_state.h"
#include "chunk.h"
Expand Down Expand Up @@ -147,12 +146,12 @@ static CustomExecMethods chunk_dispatch_state_methods = {
};

ChunkDispatchState *
chunk_dispatch_state_create(ChunkDispatchInfo *info, Plan *subplan)
chunk_dispatch_state_create(Oid hypertable_relid, Plan *subplan)
{
ChunkDispatchState *state;

state = (ChunkDispatchState *) newNode(sizeof(ChunkDispatchState), T_CustomScanState);
state->hypertable_relid = info->hypertable_relid;
state->hypertable_relid = hypertable_relid;
state->subplan = subplan;
state->cscan_state.methods = &chunk_dispatch_state_methods;
return state;
Expand Down
3 changes: 1 addition & 2 deletions src/chunk_dispatch_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <nodes/parsenodes.h>

typedef struct ChunkDispatch ChunkDispatch;
typedef struct ChunkDispatchInfo ChunkDispatchInfo;
typedef struct Cache Cache;

/* State used for every tuple in an insert statement */
Expand All @@ -39,7 +38,7 @@ typedef struct ChunkDispatchState

#define CHUNK_DISPATCH_STATE_NAME "ChunkDispatchState"

ChunkDispatchState *chunk_dispatch_state_create(ChunkDispatchInfo *, Plan *);
ChunkDispatchState *chunk_dispatch_state_create(Oid, Plan *);
void
chunk_dispatch_state_set_parent(ChunkDispatchState *state, ModifyTableState *parent);

Expand Down
1 change: 0 additions & 1 deletion src/hypertable_insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <catalog/pg_type.h>

#include "hypertable_insert.h"
#include "chunk_dispatch_info.h"
#include "chunk_dispatch_state.h"

/*
Expand Down
5 changes: 0 additions & 5 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
PG_MODULE_MAGIC;
#endif

extern void _chunk_dispatch_info_init(void);
extern void _chunk_dispatch_info_fini(void);

extern void _hypertable_cache_init(void);
extern void _hypertable_cache_fini(void);

Expand Down Expand Up @@ -71,7 +68,6 @@ _PG_init(void)
extension_check_server_version();
bgw_check_loader_api_version();

_chunk_dispatch_info_init();
_cache_init();
_hypertable_cache_init();
_cache_invalidate_init();
Expand Down Expand Up @@ -109,5 +105,4 @@ _PG_fini(void)
_cache_invalidate_fini();
_hypertable_cache_fini();
_cache_fini();
_chunk_dispatch_info_fini();
}

0 comments on commit 966ffd6

Please sign in to comment.