Skip to content

Foreign copy from for pg_shardman #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 1, 2017

Conversation

arssher
Copy link
Contributor

@arssher arssher commented Dec 1, 2017

Main points:

  • COPY FROM to foreign partitions is performed only if it is needed and possible, nothing should be changed for existing users.
  • Some callback args were simplified.
  • Small bug fixed: previously we could specify COPY FROM ... FREEZE FALSE and copy would fail.

That is, when
1) pg_pathman was compiled against postgres with shardman patches.
2) Shardman's COPY FROM was explicitly asked by setting renderzvous var.

Also, check for 'freeze' option early, as before, to keep regression tests as
they are.
@codecov-io
Copy link

codecov-io commented Dec 1, 2017

Codecov Report

Merging #136 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #136      +/-   ##
==========================================
+ Coverage   92.83%   92.83%   +<.01%     
==========================================
  Files          28       28              
  Lines        5414     5418       +4     
  Branches      915      916       +1     
==========================================
+ Hits         5026     5030       +4     
  Misses        388      388
Impacted Files Coverage Δ
src/partition_filter.c 94.14% <100%> (+0.03%) ⬆️
src/utility_stmt_hooking.c 91.91% <100%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c963933...d7520bb. Read the comment docs.

@@ -43,17 +43,15 @@ typedef struct
} ResultRelInfoHolder;


/* Forward declaration (for on_new_rri_holder()) */
/* Forward declaration (for on_rri_holder()) */
Copy link
Collaborator

@funbringer funbringer Dec 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a necessary change? This callback is intended to be called when a new ResultRelInfo holder is created.

struct ResultPartsStorage;
typedef struct ResultPartsStorage ResultPartsStorage;

/*
* Callback to be fired at rri_holder creation.
* Callback to be fired at rri_holder creation/destruction.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO there should be 2 callbacks: one for creation, and one for destruction. Why would we want to mix these roles?

* Shut down FDWs.
*/
static void
finish_rri_copy(ResultRelInfoHolder *rri_holder,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be passed as a "delete callback". Maybe we should call them rri_init_callback & rri_fini_callback?

*/
#ifndef PG_SHARDMAN
goto bail_out; /* to avoid 'unused label' warning */
#else
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the most disputable change so far. My idea's that we could create a struct of function pointers and allocate it using find_rendezvous_variable(). This would allow us to move the FDW-related logic to pg_shardman. The only drawback of such approach is that pg_shardman would have to include the same definition of such struct. I see several options.

@funbringer
Copy link
Collaborator

Small bug fixed: previously we could specify COPY FROM ... FREEZE FALSE and copy would fail.

Nice one, thanks!

@funbringer funbringer merged commit ee03666 into postgrespro:master Dec 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants