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

Flush logical messages with snapshots and replication origin #379

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/backend/commands/extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ execute_extension_script(Oid extensionOid, ExtensionControlFile *control,
* here so that the control flags are correctly associated with the right
* script(s) if they happen to be set in secondary control files.
*/
if (control->superuser && !superuser())
if (control->superuser && !superuser() && !is_neon_superuser())
{
if (extension_is_trusted(control))
switch_to_superuser = true;
Expand Down
4 changes: 2 additions & 2 deletions src/backend/commands/functioncmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
else
{
/* if untrusted language, must be superuser */
if (!superuser())
if (!(superuser() || (is_neon_superuser() && creating_extension)))
aclcheck_error(ACLCHECK_NO_PRIV, OBJECT_LANGUAGE,
NameStr(languageStruct->lanname));
}
Expand Down Expand Up @@ -2129,7 +2129,7 @@ ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic)
else
{
/* if untrusted language, must be superuser */
if (!superuser())
if (!(superuser() || (is_neon_superuser() && creating_extension)))
aclcheck_error(ACLCHECK_NO_PRIV, OBJECT_LANGUAGE,
NameStr(languageStruct->lanname));
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/replication/logical/origin.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ CheckPointReplicationOrigin(void)
chkp_size += sizeof(crc);

/* NEON specific: persist snapshot in storage using logical message */
LogLogicalMessage("neon-file:pg_logical/replorigin_checkpoint", buf, chkp_size, false);
XLogFlush(LogLogicalMessage("neon-file:pg_logical/replorigin_checkpoint", buf, chkp_size, false));
}
pfree(buf);

Expand Down
4 changes: 2 additions & 2 deletions src/backend/replication/logical/snapbuild.c
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)

/* NEON specific: persist snapshot in storage using logical message */
snprintf(prefix, sizeof(prefix), "neon-file:%s", path);
LogLogicalMessage(prefix, (char*)ondisk, needed_length, false);
XLogFlush(LogLogicalMessage(prefix, (char*)ondisk, needed_length, false));

errno = 0;
pgstat_report_wait_start(WAIT_EVENT_SNAPBUILD_WRITE);
Expand Down Expand Up @@ -2106,7 +2106,7 @@ CheckPointSnapBuild(void)

/* NEON specific: delete file from storage using logical message */
snprintf(prefix, sizeof(prefix), "neon-file:%s", path);
LogLogicalMessage(prefix, NULL, 0, false);
XLogFlush(LogLogicalMessage(prefix, NULL, 0, false));

/*
* It's not particularly harmful, though strange, if we can't
Expand Down
2 changes: 1 addition & 1 deletion src/backend/storage/ipc/dsm_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
* transferring data to the kernel.
*/
char *zbuffer = (char *) palloc0(ZBUFFER_SIZE);
uint32 remaining = request_size;
Size remaining = request_size;
bool success = true;

/*
Expand Down