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

Function reader_init

gpcontrib/gpcloud/src/gpreader.cpp:86–123  ·  view source on GitHub ↗

invoked by s3_import(), need to be exception safe

Source from the content-addressed store, hash-verified

84
85// invoked by s3_import(), need to be exception safe
86GPReader* reader_init(const char* url_with_options) {
87 GPReader* reader = NULL;
88 s3extErrorMessage.clear();
89
90 try {
91 if (!url_with_options) {
92 return NULL;
93 }
94
95 string urlWithOptions(url_with_options);
96
97 S3Params params = InitConfig(urlWithOptions);
98
99 InitRemoteLog();
100
101 // Prepare memory to be used for thread chunk buffer.
102 PrepareS3MemContext(params);
103
104 reader = new GPReader(params);
105 if (reader == NULL) {
106 return NULL;
107 }
108
109 reader->open(params);
110 return reader;
111 } catch (S3Exception& e) {
112 delete reader;
113 s3extErrorMessage =
114 "reader_init caught a " + e.getType() + " exception: " + e.getFullMessage();
115 S3ERROR("reader_init caught %s: %s", e.getType().c_str(), s3extErrorMessage.c_str());
116 return NULL;
117 } catch (...) {
118 delete reader;
119 S3ERROR("Caught an unexpected exception.");
120 s3extErrorMessage = "Caught an unexpected exception.";
121 return NULL;
122 }
123}
124
125// invoked by s3_import(), need to be exception safe
126bool reader_transfer_data(GPReader* reader, char* data_buf, int& data_len) {

Callers 3

s3_importFunction · 0.85
checkConfigFunction · 0.85
downloadS3Function · 0.85

Calls 7

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

Tested by

no test coverage detected