Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
HAWQ-1782. Fix failed to read EXTERNAL TABLE of GPFDIST protocol
Browse files Browse the repository at this point in the history
- revise CREATE EXTERNAL TABLE default to READABLE EXTERNAL TABLE

- fix read from EXTERNAL TABLE of GPFDIST protocol

The documented behaviour of CREATE EXTERNAL TABLE indicates a READABLE
TABLE but used to be violated.

Referring to https://curl.se/libcurl/c/curl_multi_fdset.html,
```
If no file descriptors are set by libcurl, max_fd will contain -1 when
this function returns. Otherwise it will contain the highest descriptor
number libcurl set. When libcurl returns -1 in max_fd, it is because
libcurl currently does something that isn't possible for your
application to monitor with a socket and unfortunately you can then not
know exactly when the current action is completed using select(). You
then need to wait a while before you proceed and call curl_multi_perform
anyway. How long to wait? Unless curl_multi_timeout gives you a lower
number, we suggest 100 milliseconds or so, but you may want to test it
out in your own particular conditions to find a suitable value.
```
it is not an error of `max_fd == -1`. Moreover, the situation of
`max_fd == -1` seems common on macOS.
  • Loading branch information
chiyang10000 committed Feb 4, 2021
1 parent de10f23 commit aa1919b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion .github/workflows/scripts/gtest_filter_negative
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.

export GTEST_FILTER_NEGATIVE=\
TestErrorTable.TestErrorTableAll:\
TestCommonLib.TestHdfsConfig:\
TestExtOrc.TestNormalPath:\
TestExtOrc.BoolTypeTest:\
Expand Down
10 changes: 5 additions & 5 deletions src/backend/access/external/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,13 @@ fill_buffer(URL_FILE *file, int want)
e, curl_easy_strerror(e));
}

if (maxfd <= 0)
if (maxfd == -1)
{
curl->still_running = 0;
break;
/* fall through to curl_multi_perform directly */
pg_usleep(100);
nfds = 1;
}

if (-1 == (nfds = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout)))
else if (-1 == (nfds = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout)))
{
if (errno == EINTR || errno == EAGAIN)
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/parser/gram.y
Original file line number Diff line number Diff line change
Expand Up @@ -4707,7 +4707,7 @@ CreateExternalStmt: CREATE OptWritable EXTERNAL OptWeb OptTemp TABLE qualified_n

OptWritable: WRITABLE { $$ = TRUE; }
| READABLE { $$ = FALSE; }
| /*EMPTY*/ { $$ = TRUE; }
| /*EMPTY*/ { $$ = FALSE; }
;

OptWeb: WEB { $$ = TRUE; }
Expand Down

0 comments on commit aa1919b

Please sign in to comment.