Skip to content

Commit c482657

Browse files
committed
wasm fencing
1 parent 1f47e7b commit c482657

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+745
-147
lines changed

contrib/pgstattuple/pgstatindex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,9 +656,9 @@ pgstathashindex(PG_FUNCTION_ARGS)
656656
stats.unused_pages++;
657657
else if (PageGetSpecialSize(page) !=
658658
MAXALIGN(sizeof(HashPageOpaqueData)))
659-
ereport(ERROR,
659+
ereport(WARNING,
660660
(errcode(ERRCODE_INDEX_CORRUPTED),
661-
errmsg("index \"%s\" contains corrupted page at block %u",
661+
errmsg("# 661(FATAL block=%d): index \"%s\" contains corrupted page at block %u", blkno,
662662
RelationGetRelationName(rel),
663663
BufferGetBlockNumber(buf))));
664664
else

contrib/xml2/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DATA = xml2--1.1.sql xml2--1.0--1.1.sql
1111
PGFILEDESC = "xml2 - XPath querying and XSLT"
1212

1313
REGRESS = xml2
14-
14+
PG_CFLAGS=$(shell xml2-config --cflags)
1515
SHLIB_LINK += $(filter -lxslt, $(LIBS)) -lxml2
1616

1717
ifdef USE_PGXS

src/backend/access/nbtree/nbtutils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,7 +2732,7 @@ _bt_allequalimage(Relation rel, bool debugmessage)
27322732
break;
27332733
}
27342734
}
2735-
2735+
#if !defined(__EMSCRIPTEN__)
27362736
if (debugmessage)
27372737
{
27382738
if (allequalimage)
@@ -2742,6 +2742,6 @@ _bt_allequalimage(Relation rel, bool debugmessage)
27422742
elog(DEBUG1, "index \"%s\" cannot use deduplication",
27432743
RelationGetRelationName(rel));
27442744
}
2745-
2745+
#endif
27462746
return allequalimage;
27472747
}

src/backend/access/transam/xact.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,7 @@ RecordTransactionAbort(bool isSubXact)
17401740
if (TransactionIdDidCommit(xid))
17411741
elog(PANIC, "cannot abort transaction %u, it was already committed",
17421742
xid);
1743+
else elog(WARNING, "# 1743: aborting transaction %u", xid);
17431744

17441745
/*
17451746
* Are we using the replication origins feature? Or, in other words, are
@@ -2748,7 +2749,9 @@ AbortTransaction(void)
27482749
* handler. We do this fairly early in the sequence so that the timeout
27492750
* infrastructure will be functional if needed while aborting.
27502751
*/
2752+
#if !defined(__EMSCRIPTEN__) && !defined(__wasi__)
27512753
sigprocmask(SIG_SETMASK, &UnBlockSig, NULL);
2754+
#endif
27522755

27532756
/*
27542757
* check the current transaction state
@@ -5107,7 +5110,10 @@ AbortSubTransaction(void)
51075110
* handler. We do this fairly early in the sequence so that the timeout
51085111
* infrastructure will be functional if needed while aborting.
51095112
*/
5113+
#if !defined(__EMSCRIPTEN__) && !defined(__wasi__)
51105114
sigprocmask(SIG_SETMASK, &UnBlockSig, NULL);
5115+
#endif
5116+
51115117

51125118
/*
51135119
* check the current transaction state

src/backend/access/transam/xlogarchive.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#include "storage/ipc.h"
3434
#include "storage/lwlock.h"
3535

36+
#if defined(__wasi__)
37+
#define system(cmd) system_wasi(cmd)
38+
#endif
39+
3640
/*
3741
* Attempt to retrieve the specified file from off-line archival storage.
3842
* If successful, fill "path" with its complete path (note that this will be

src/backend/bootstrap/bootstrap.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ CheckerModeMain(void)
199199
* to shared memory sizing, options work (or at least do not cause an error
200200
* up to shared memory creation).
201201
*/
202+
#if !defined(__EMSCRIPTEN__) && !defined(__wasi__)
202203
void
204+
#else
205+
int
206+
#endif
203207
BootstrapModeMain(int argc, char *argv[], bool check_only)
204208
{
205209
int i;
@@ -353,7 +357,7 @@ BootstrapModeMain(int argc, char *argv[], bool check_only)
353357
*/
354358
if (pg_link_canary_is_frontend())
355359
elog(ERROR, "backend is incorrectly linked to frontend functions");
356-
360+
puts("# 360: InitPostgres(boot): " __FILE__ );
357361
InitPostgres(NULL, InvalidOid, NULL, InvalidOid, false, false, NULL);
358362

359363
/* Initialize stuff for bootstrap-file processing */
@@ -378,7 +382,12 @@ BootstrapModeMain(int argc, char *argv[], bool check_only)
378382

379383
/* Clean up and exit */
380384
cleanup();
385+
#if !defined(__EMSCRIPTEN__) && !defined(__wasi__)
381386
proc_exit(0);
387+
#else
388+
puts("# 338 cleanup(boot): " __FILE__);
389+
return 0;
390+
#endif
382391
}
383392

384393

src/backend/catalog/index.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2993,7 +2993,7 @@ index_build(Relation heapRelation,
29932993
indexInfo->ii_ParallelWorkers =
29942994
plan_create_index_workers(RelationGetRelid(heapRelation),
29952995
RelationGetRelid(indexRelation));
2996-
2996+
#if !defined(__EMSCRIPTEN__)
29972997
if (indexInfo->ii_ParallelWorkers == 0)
29982998
ereport(DEBUG1,
29992999
(errmsg_internal("building index \"%s\" on table \"%s\" serially",
@@ -3005,7 +3005,7 @@ index_build(Relation heapRelation,
30053005
RelationGetRelationName(indexRelation),
30063006
RelationGetRelationName(heapRelation),
30073007
indexInfo->ii_ParallelWorkers)));
3008-
3008+
#endif
30093009
/*
30103010
* Switch to the table owner's userid, so that any index functions are run
30113011
* as that user. Also lock down security-restricted operations and

src/backend/commands/collationcmds.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -828,14 +828,14 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
828828
maxaliases = 100;
829829
aliases = (CollAliasData *) palloc(maxaliases * sizeof(CollAliasData));
830830
naliases = 0;
831-
832831
locale_a_handle = OpenPipeStream("locale -a", "r");
833-
if (locale_a_handle == NULL)
832+
if (locale_a_handle == NULL) {
833+
puts("======================== ERROR ================");
834834
ereport(ERROR,
835835
(errcode_for_file_access(),
836836
errmsg("could not execute command \"%s\": %m",
837837
"locale -a")));
838-
838+
}
839839
while (fgets(localebuf, sizeof(localebuf), locale_a_handle))
840840
{
841841
size_t len;

src/backend/commands/dbcommands.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,8 +1783,9 @@ dropdb(const char *dbname, bool missing_ok, bool force)
17831783
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
17841784

17851785
/* Close all smgr fds in all backends. */
1786+
#if !defined(__wasi__) && !defined(__EMSCRIPTEN__)
17861787
WaitForProcSignalBarrier(EmitProcSignalBarrier(PROCSIGNAL_BARRIER_SMGRRELEASE));
1787-
1788+
#endif
17881789
/*
17891790
* Remove all tablespace subdirs belonging to the database.
17901791
*/

src/backend/commands/event_trigger.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,8 @@ EventTriggerDDLCommandStart(Node *parsetree)
642642
List *runlist;
643643
EventTriggerData trigdata;
644644

645+
#if defined(__EMSCRIPTEN__) || defined(__wasi__)
646+
#else
645647
/*
646648
* Event Triggers are completely disabled in standalone mode. There are
647649
* (at least) two reasons for this:
@@ -660,6 +662,7 @@ EventTriggerDDLCommandStart(Node *parsetree)
660662
*/
661663
if (!IsUnderPostmaster)
662664
return;
665+
#endif
663666

664667
runlist = EventTriggerCommonSetup(parsetree,
665668
EVT_DDLCommandStart,
@@ -690,12 +693,15 @@ EventTriggerDDLCommandEnd(Node *parsetree)
690693
List *runlist;
691694
EventTriggerData trigdata;
692695

696+
#if defined(__EMSCRIPTEN__) || defined(__wasi__)
697+
#else
693698
/*
694699
* See EventTriggerDDLCommandStart for a discussion about why event
695700
* triggers are disabled in single user mode.
696701
*/
697702
if (!IsUnderPostmaster)
698703
return;
704+
#endif
699705

700706
/*
701707
* Also do nothing if our state isn't set up, which it won't be if there
@@ -738,12 +744,15 @@ EventTriggerSQLDrop(Node *parsetree)
738744
List *runlist;
739745
EventTriggerData trigdata;
740746

747+
#if defined(__EMSCRIPTEN__) || defined(__wasi__)
748+
#else
741749
/*
742750
* See EventTriggerDDLCommandStart for a discussion about why event
743751
* triggers are disabled in single user mode.
744752
*/
745753
if (!IsUnderPostmaster)
746754
return;
755+
#endif
747756

748757
/*
749758
* Use current state to determine whether this event fires at all. If
@@ -809,12 +818,15 @@ EventTriggerTableRewrite(Node *parsetree, Oid tableOid, int reason)
809818
List *runlist;
810819
EventTriggerData trigdata;
811820

821+
#if defined(__EMSCRIPTEN__) || defined(__wasi__)
822+
#else
812823
/*
813824
* See EventTriggerDDLCommandStart for a discussion about why event
814825
* triggers are disabled in single user mode.
815826
*/
816827
if (!IsUnderPostmaster)
817828
return;
829+
#endif
818830

819831
/*
820832
* Also do nothing if our state isn't set up, which it won't be if there

0 commit comments

Comments
 (0)