MCPcopy Create free account
hub / github.com/apache/cloudberry / writer_init

Function writer_init

gpcontrib/gpcloud/src/gpwriter.cpp:65–103  ·  view source on GitHub ↗

invoked by s3_export(), need to be exception safe

Source from the content-addressed store, hash-verified

63
64// invoked by s3_export(), need to be exception safe
65GPWriter* writer_init(const char* url_with_options, const char* format) {
66 GPWriter* writer = NULL;
67 s3extErrorMessage.clear();
68
69 try {
70 if (!url_with_options) {
71 return NULL;
72 }
73
74 string urlWithOptions(url_with_options);
75
76 S3Params params = InitConfig(urlWithOptions);
77
78 InitRemoteLog();
79
80 // Prepare memory to be used for thread chunk buffer.
81 PrepareS3MemContext(params);
82
83 string extName = params.isAutoCompress() ? string(format) + ".gz" : format;
84 writer = new GPWriter(params, extName);
85 if (writer == NULL) {
86 return NULL;
87 }
88
89 writer->open(params);
90 return writer;
91 } catch (S3Exception& e) {
92 delete writer;
93 s3extErrorMessage =
94 "writer_init caught a " + e.getType() + " exception: " + e.getFullMessage();
95 S3ERROR("writer_init caught %s: %s", e.getType().c_str(), s3extErrorMessage.c_str());
96 return NULL;
97 } catch (...) {
98 delete writer;
99 S3ERROR("Caught an unexpected exception.");
100 s3extErrorMessage = "Caught an unexpected exception.";
101 return NULL;
102 }
103}
104
105// invoked by s3_export(), need to be exception safe
106bool writer_transfer_data(GPWriter* writer, char* data_buf, int data_len) {

Callers 2

s3_exportFunction · 0.85
uploadS3Function · 0.85

Calls 8

InitRemoteLogFunction · 0.85
PrepareS3MemContextFunction · 0.85
clearMethod · 0.80
isAutoCompressMethod · 0.80
getFullMessageMethod · 0.80
InitConfigFunction · 0.70
openMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected