-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add on-segment mode for pg_dump utility #1
base: adb-6.x-dev
Are you sure you want to change the base?
Conversation
fb0dd2c
to
43fac53
Compare
This mode is used to save data on each segment locally part by part
if (compressLevel != 0) | ||
return runRestore_CompressedPlainText(inputFileSpec); | ||
#endif | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else
is redundant here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wanted to make it clear but ok, done
ropt = NewRestoreOptions(); | ||
ropt->filename = inputFileSpec; | ||
|
||
if (compressLevel == -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make the code simpler using ternary operator: ropt->compression = (compressLevel == -1) ? 0 : compressLevel;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
static void | ||
setupDumpWorkerDummy(Archive *AH, RestoreOptions *ropt) | ||
{ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add newline at the end of file here and below to make github happy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
((ArchiveHandle *)AH)->ropt = ropt; | ||
|
||
if (plainText) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use format == archNull
in this condition and remove the plainText variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense, done
const int bufferSize = 1024; | ||
const char *buffer[bufferSize]; | ||
|
||
size_t readLen = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 is never used. The readLen value is changed in the next line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
extern int onSegmentHelper_RunRestore(const char *inputFileSpec, int compressLevel, ArchiveFormat format); | ||
extern int onSegmentHelper_RunDump(const char *inputFileSpec, int compressLevel, ArchiveFormat format); | ||
|
||
#endif // PG_DUMP_SEGMENT_HELPER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add newline
Add pg_dump on-segment mode, where data is stored locally on segments
This mode gets activated by using --on-segment flag, it generates dump on client side as usual and data dumps on each used segment, compression level and archive formats are forwarded to segments' archives
Generated dump can be used by pg_restore or psql (for plain texts) as usual
Also to manage data on segments 2 other system modes were added.
First one (--on-segment-internal-dump-mode) reads data from stdin to stores it locally with forwarded archive format and compression level.
Second (--on-segment-internal-restore-mode) reads stored data and passes it to stdout
In this mode utility uses COPY ... TO PROGRAM ... ON SEGMENT instead of normal COPY and passes output of it to pg_dump on each segment.
To restore data it saves COPY ... FROM PROGRAM ... ON SEGMENT operators to final dump, which read data from utility on each segment.