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

Function DownloadThreadFunc

gpcontrib/gpcloud/src/s3key_reader.cpp:147–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147static void* DownloadThreadFunc(void* data) {
148 MaskThreadSignals();
149
150 ChunkBuffer* buffer = static_cast<ChunkBuffer*>(data);
151
152 uint64_t filledSize = 0;
153 S3DEBUG("Downloading thread starts");
154 do {
155 if (S3QueryIsAbortInProgress()) {
156 S3INFO("Downloading thread is interrupted");
157
158 // error is shared between all chunks, so all chunks will stop.
159 buffer->setSharedError(true, S3QueryAbort("Downloading thread is interrupted"));
160
161 // have to unlock ChunkBuffer::read in some certain conditions, for instance, status is
162 // not ReadyToRead, and read() is waiting for signal stat_cond.
163 buffer->setStatus(ReadyToRead);
164 pthread_cond_signal(buffer->getStatCond());
165
166 return NULL;
167 }
168
169 filledSize = buffer->fill();
170
171 if (filledSize != 0) {
172 if (buffer->isError()) {
173 S3DEBUG("Failed to fill downloading buffer");
174 break;
175 } else {
176 S3DEBUG("Size of filled data is %" PRIu64, filledSize);
177 }
178 }
179 } while (!buffer->isEOF());
180 S3DEBUG("Downloading thread ended");
181 return NULL;
182}
183
184void S3KeyReader::open(const S3Params& params) {
185 S3_CHECK_OR_DIE(this->s3Interface != NULL, S3RuntimeError, "s3Interface must not be NULL");

Callers

nothing calls this directly

Calls 9

S3QueryAbortClass · 0.85
getStatCondMethod · 0.80
fillMethod · 0.80
isErrorMethod · 0.80
isEOFMethod · 0.80
MaskThreadSignalsFunction · 0.70
S3QueryIsAbortInProgressFunction · 0.70
setSharedErrorMethod · 0.45
setStatusMethod · 0.45

Tested by

no test coverage detected