Skip to content
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

Define strerror() for Windows #1834

Merged
merged 1 commit into from Apr 20, 2020
Merged

Conversation

mkindahl
Copy link
Contributor

The symbol pgwin32_socket_strerror was undefined on windows builds at
PG12 and later. This because the function was removed and instead
pg_strerror was introduced to be used on all platforms.

This commit fixes the issue by ensuring to use pg_strerror on PG12
and later, and pgwin32_socket_strerror on Windows builds before PG12.

@mkindahl mkindahl requested a review from a team as a code owner April 20, 2020 07:57
@mkindahl mkindahl requested review from pmwkaa and WireBaron and removed request for a team April 20, 2020 07:57
@mkindahl mkindahl changed the base branch from pg12 to master April 20, 2020 10:43
Copy link
Contributor

@erimatnor erimatnor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits and suggestions.

#endif
}

/* We cannot define `pg_strerror` here because there is a #define in PG12 that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The markdown formatting seems unnecessary in C comments

Copy link
Contributor Author

@mkindahl mkindahl Apr 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use this to avoid confusion when mixing English text with references to symbols in the code.

src/net/conn_plain.c Outdated Show resolved Hide resolved
@@ -25,6 +27,24 @@ set_error(int err)
#endif
}

static int
get_error(void)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
get_error(void)
get_socket_error(void)

Given that this is, at least on Windows, only used for Winsock-related errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, the function itself is not restricted to socket-related errors, it is generic, and there is a corresponding function set_error above this one, so it makes sense to stick to the conventions already established by this.

@mkindahl mkindahl force-pushed the fix_pg_strerror branch 2 times, most recently from 22cf766 to 7648c3f Compare April 20, 2020 10:55
The symbol `pgwin32_socket_strerror` was undefined on windows builds at
PG12 and later. This because the function was removed and instead
`pg_strerror` was introduced to be used on all platforms.

This commit fixes the issue by ensuring to use `pg_strerror` on PG12
and later, and `pgwin32_socket_strerror` on Windows builds before PG12.

Found using `clang-tidy`
@codecov
Copy link

codecov bot commented Apr 20, 2020

Codecov Report

Merging #1834 into master will decrease coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1834      +/-   ##
==========================================
- Coverage   89.72%   89.60%   -0.12%     
==========================================
  Files         150      144       -6     
  Lines       22696    22118     -578     
==========================================
- Hits        20364    19819     -545     
+ Misses       2332     2299      -33     
Flag Coverage Δ
#cron ?
#pr 89.60% <100.00%> (-0.01%) ⬇️
Impacted Files Coverage Δ
src/net/conn_plain.c 84.61% <100.00%> (+0.48%) ⬆️
src/plan_add_hashagg.c 38.33% <0.00%> (-46.67%) ⬇️
src/telemetry/uuid.c 84.61% <0.00%> (-15.39%) ⬇️
src/import/planner.c 69.08% <0.00%> (-11.23%) ⬇️
src/loader/bgw_launcher.c 84.91% <0.00%> (-4.27%) ⬇️
src/histogram.c 87.80% <0.00%> (-3.66%) ⬇️
src/loader/bgw_interface.c 62.96% <0.00%> (-2.56%) ⬇️
src/loader/bgw_message_queue.c 84.82% <0.00%> (-2.36%) ⬇️
src/chunk_dispatch_state.c 94.00% <0.00%> (-2.16%) ⬇️
src/bgw_policy/chunk_stats.c 83.63% <0.00%> (-1.61%) ⬇️
... and 57 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed12257...81d9b71. Read the comment docs.

@mkindahl mkindahl merged commit 8e94875 into timescale:master Apr 20, 2020
@mkindahl mkindahl deleted the fix_pg_strerror branch April 20, 2020 12:54
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request May 15, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* timescale#1834 Define strerror() for Windows
* timescale#1846 Fix segfault on COPY to hypertable
* timescale#1850 Fix scheduler failure due to bad next_start_time for jobs
* timescale#1851 Fix hypertable expansion for UNION ALL
* timescale#1861 Fix qual pushodwn for compressed hypertables where quals have casts
* timescale#1868 Add support for WHERE, HAVING clauses with real time aggregates
* timescale#1871 Don't rely on timescaledb.restoring for upgrade
* timescale#1875 Fix hypertable detection in subqueries

**Thanks**
* @frostwind for reporting issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @dhodyn for reporting an issue with UNION ALL queries
* @pehlert for reporting an issue with pg_upgrade
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request May 15, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* timescale#1834 Define strerror() for Windows
* timescale#1846 Fix segfault on COPY to hypertable
* timescale#1850 Fix scheduler failure due to bad next_start_time for jobs
* timescale#1851 Fix hypertable expansion for UNION ALL
* timescale#1861 Fix qual pushodwn for compressed hypertables where quals have casts
* timescale#1868 Add support for WHERE, HAVING clauses with real time aggregates
* timescale#1871 Don't rely on timescaledb.restoring for upgrade
* timescale#1875 Fix hypertable detection in subqueries

**Thanks**
* @frostwind for reporting issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @dhodyn for reporting an issue with UNION ALL queries
* @pehlert for reporting an issue with pg_upgrade
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request May 15, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* timescale#1834 Define strerror() for Windows
* timescale#1846 Fix segfault on COPY to hypertable
* timescale#1850 Fix scheduler failure due to bad next_start_time for jobs
* timescale#1851 Fix hypertable expansion for UNION ALL
* timescale#1861 Fix qual pushdown for compressed hypertables where quals have casts
* timescale#1864 Fix issue with subplan selection in parallel ChunkAppend
* timescale#1868 Add support for WHERE, HAVING clauses with real time aggregates
* timescale#1871 Don't rely on timescaledb.restoring for upgrade
* timescale#1875 Fix hypertable detection in subqueries

**Thanks**
* @frostwind for reporting issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @airton-neto for reporting an issue with queries over UNIONs of hypertables
* @dhodyn for reporting an issue with UNION ALL queries
* @pehlert for reporting an issue with pg_upgrade
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
@svenklemm svenklemm mentioned this pull request May 15, 2020
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request May 15, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* timescale#1834 Define strerror() for Windows
* timescale#1846 Fix segfault on COPY to hypertable
* timescale#1850 Fix scheduler failure due to bad next_start_time for jobs
* timescale#1851 Fix hypertable expansion for UNION ALL
* timescale#1861 Fix qual pushdown for compressed hypertables where quals have casts
* timescale#1864 Fix issue with subplan selection in parallel ChunkAppend
* timescale#1868 Add support for WHERE, HAVING clauses with real time aggregates
* timescale#1871 Don't rely on timescaledb.restoring for upgrade
* timescale#1875 Fix hypertable detection in subqueries
* timescale#1884 Fix crash on SELECT WHERE NOT with empty table

**Thanks**
* @frostwind for reporting issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @airton-neto for reporting an issue with queries over UNIONs of hypertables
* @dhodyn for reporting an issue with UNION ALL queries
* @pehlert for reporting an issue with pg_upgrade
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
* @michael-sayapin for reporting an issue with INSERTs and WHERE NOT EXISTS
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request May 15, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* timescale#1834 Define strerror() for Windows
* timescale#1846 Fix segfault on COPY to hypertable
* timescale#1850 Fix scheduler failure due to bad next_start_time for jobs
* timescale#1851 Fix hypertable expansion for UNION ALL
* timescale#1854 Fix reorder policy job to skip compressed chunks
* timescale#1861 Fix qual pushdown for compressed hypertables where quals have casts
* timescale#1864 Fix issue with subplan selection in parallel ChunkAppend
* timescale#1868 Add support for WHERE, HAVING clauses with real time aggregates
* timescale#1871 Don't rely on timescaledb.restoring for upgrade
* timescale#1875 Fix hypertable detection in subqueries
* timescale#1884 Fix crash on SELECT WHERE NOT with empty table

**Thanks**
* @frostwind for reporting an issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @airton-neto for reporting an issue with queries over UNIONs of hypertables
* @dhodyn for reporting an issue with UNION ALL queries
* @pehlert for reporting an issue with pg_upgrade
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
* @michael-sayapin for reporting an issue with INSERTs and WHERE NOT EXISTS
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request May 15, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* timescale#1834 Define strerror() for Windows
* timescale#1846 Fix segfault on COPY to hypertable
* timescale#1850 Fix scheduler failure due to bad next_start_time for jobs
* timescale#1851 Fix hypertable expansion for UNION ALL
* timescale#1854 Fix reorder policy job to skip compressed chunks
* timescale#1861 Fix qual pushdown for compressed hypertables where quals have casts
* timescale#1864 Fix issue with subplan selection in parallel ChunkAppend
* timescale#1868 Add support for WHERE, HAVING clauses with real time aggregates
* timescale#1871 Don't rely on timescaledb.restoring for upgrade
* timescale#1875 Fix hypertable detection in subqueries
* timescale#1884 Fix crash on SELECT WHERE NOT with empty table

**Thanks**
* @frostwind for reporting an issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @airton-neto for reporting an issue with queries over UNIONs of hypertables
* @dhodyn for reporting an issue with UNION ALL queries
* @pehlert for reporting an issue with pg_upgrade
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
* @michael-sayapin for reporting an issue with INSERTs and WHERE NOT EXISTS
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request May 15, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading and high priority for users with multiple continuous aggregates.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* timescale#1834 Define strerror() for Windows
* timescale#1846 Fix segfault on COPY to hypertable
* timescale#1850 Fix scheduler failure due to bad next_start_time for jobs
* timescale#1851 Fix hypertable expansion for UNION ALL
* timescale#1854 Fix reorder policy job to skip compressed chunks
* timescale#1861 Fix qual pushdown for compressed hypertables where quals have casts
* timescale#1864 Fix issue with subplan selection in parallel ChunkAppend
* timescale#1868 Add support for WHERE, HAVING clauses with real time aggregates
* timescale#1869 Fix real time aggregate support for multiple continuous aggregates
* timescale#1871 Don't rely on timescaledb.restoring for upgrade
* timescale#1875 Fix hypertable detection in subqueries
* timescale#1884 Fix crash on SELECT WHERE NOT with empty table

**Thanks**
* @airton-neto for reporting an issue with queries over UNIONs of hypertables
* @dhodyn for reporting an issue with UNION ALL queries
* @frostwind for reporting an issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @louisth for reporting an issue with real-time aggregation and multiple continuous aggregates
* @michael-sayapin for reporting an issue with INSERTs and WHERE NOT EXISTS
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
* @pehlert for reporting an issue with pg_upgrade
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request May 17, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading and high priority for users with multiple continuous aggregates.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* timescale#1834 Define strerror() for Windows
* timescale#1846 Fix segfault on COPY to hypertable
* timescale#1850 Fix scheduler failure due to bad next_start_time for jobs
* timescale#1851 Fix hypertable expansion for UNION ALL
* timescale#1854 Fix reorder policy job to skip compressed chunks
* timescale#1861 Fix qual pushdown for compressed hypertables where quals have casts
* timescale#1864 Fix issue with subplan selection in parallel ChunkAppend
* timescale#1868 Add support for WHERE, HAVING clauses with real time aggregates
* timescale#1869 Fix real time aggregate support for multiple continuous aggregates
* timescale#1871 Don't rely on timescaledb.restoring for upgrade
* timescale#1875 Fix hypertable detection in subqueries
* timescale#1884 Fix crash on SELECT WHERE NOT with empty table

**Thanks**
* @airton-neto for reporting an issue with queries over UNIONs of hypertables
* @dhodyn for reporting an issue with UNION ALL queries
* @frostwind for reporting an issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @louisth for reporting an issue with real-time aggregation and multiple continuous aggregates
* @michael-sayapin for reporting an issue with INSERTs and WHERE NOT EXISTS
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
* @pehlert for reporting an issue with pg_upgrade
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request May 18, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading and high priority for users with multiple continuous aggregates.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* timescale#1834 Define strerror() for Windows
* timescale#1846 Fix segfault on COPY to hypertable
* timescale#1850 Fix scheduler failure due to bad next_start_time for jobs
* timescale#1851 Fix hypertable expansion for UNION ALL
* timescale#1854 Fix reorder policy job to skip compressed chunks
* timescale#1861 Fix qual pushdown for compressed hypertables where quals have casts
* timescale#1864 Fix issue with subplan selection in parallel ChunkAppend
* timescale#1868 Add support for WHERE, HAVING clauses with real time aggregates
* timescale#1869 Fix real time aggregate support for multiple continuous aggregates
* timescale#1871 Don't rely on timescaledb.restoring for upgrade
* timescale#1875 Fix hypertable detection in subqueries
* timescale#1884 Fix crash on SELECT WHERE NOT with empty table

**Thanks**
* @airton-neto for reporting an issue with queries over UNIONs of hypertables
* @dhodyn for reporting an issue with UNION ALL queries
* @frostwind for reporting an issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @louisth for reporting an issue with real-time aggregation and multiple continuous aggregates
* @michael-sayapin for reporting an issue with INSERTs and WHERE NOT EXISTS
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
* @pehlert for reporting an issue with pg_upgrade
svenklemm added a commit that referenced this pull request May 18, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading and high priority for users with multiple continuous aggregates.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* #1834 Define strerror() for Windows
* #1846 Fix segfault on COPY to hypertable
* #1850 Fix scheduler failure due to bad next_start_time for jobs
* #1851 Fix hypertable expansion for UNION ALL
* #1854 Fix reorder policy job to skip compressed chunks
* #1861 Fix qual pushdown for compressed hypertables where quals have casts
* #1864 Fix issue with subplan selection in parallel ChunkAppend
* #1868 Add support for WHERE, HAVING clauses with real time aggregates
* #1869 Fix real time aggregate support for multiple continuous aggregates
* #1871 Don't rely on timescaledb.restoring for upgrade
* #1875 Fix hypertable detection in subqueries
* #1884 Fix crash on SELECT WHERE NOT with empty table

**Thanks**
* @airton-neto for reporting an issue with queries over UNIONs of hypertables
* @dhodyn for reporting an issue with UNION ALL queries
* @frostwind for reporting an issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @louisth for reporting an issue with real-time aggregation and multiple continuous aggregates
* @michael-sayapin for reporting an issue with INSERTs and WHERE NOT EXISTS
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
* @pehlert for reporting an issue with pg_upgrade
svenklemm added a commit that referenced this pull request May 18, 2020
This maintenance release contains bugfixes since the 1.7.0 release. We deem it medium
priority for upgrading and high priority for users with multiple continuous aggregates.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates with real-time aggregation and PostgreSQL 12 support.

**Bugfixes**
* #1834 Define strerror() for Windows
* #1846 Fix segfault on COPY to hypertable
* #1850 Fix scheduler failure due to bad next_start_time for jobs
* #1851 Fix hypertable expansion for UNION ALL
* #1854 Fix reorder policy job to skip compressed chunks
* #1861 Fix qual pushdown for compressed hypertables where quals have casts
* #1864 Fix issue with subplan selection in parallel ChunkAppend
* #1868 Add support for WHERE, HAVING clauses with real time aggregates
* #1869 Fix real time aggregate support for multiple continuous aggregates
* #1871 Don't rely on timescaledb.restoring for upgrade
* #1875 Fix hypertable detection in subqueries
* #1884 Fix crash on SELECT WHERE NOT with empty table

**Thanks**
* @airton-neto for reporting an issue with queries over UNIONs of hypertables
* @dhodyn for reporting an issue with UNION ALL queries
* @frostwind for reporting an issue with casts in where clauses on compressed hypertables
* @fvannee for reporting an issue with hypertable detection in inlined SQL functions and an issue with COPY
* @hgiasac for reporting missing where clause with real time aggregates
* @louisth for reporting an issue with real-time aggregation and multiple continuous aggregates
* @michael-sayapin for reporting an issue with INSERTs and WHERE NOT EXISTS
* @Olernov for reporting and fixing an issue with compressed chunks in the reorder policy
* @pehlert for reporting an issue with pg_upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants