[patch] Build pgoutput with MSVC

Started by MauMauover 8 years ago7 messages
#1MauMau
maumau307@gmail.com
1 attachment(s)

Hello,

I tried logical replication on Windows, but it failed like this:

postgres=# create subscription mysub connection 'host=localhost
port=5433 user=tuna dbname=postgres' publication mypub with (nocopy
data);
NOTICE: synchronized table states
ERROR: could not create replication slot "mysub": ERROR: could not
access file "pgoutput": No such file or directory
postgres=#

The pgoutput is not built with MSVC. The attached patch fixes this.
I confirmed that a few INSERTs were replicated correctly.

Should I add this matter in the PostgreSQL 10 Open Items page?

Regards
MauMau

Attachments:

msvc_build_pgoutput.patchapplication/octet-stream; name=msvc_build_pgoutput.patchDownload
��diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm

index 30c126503b..642797d738 100644

--- a/src/tools/msvc/Mkvcbuild.pm

+++ b/src/tools/msvc/Mkvcbuild.pm

@@ -252,6 +252,11 @@ sub mkvcbuild

 	$libpqwalreceiver->AddIncludeDir('src/interfaces/libpq');

 	$libpqwalreceiver->AddReference($postgres, $libpq);

 

+	my $pgoutput = $solution->AddProject(

+		'pgoutput', 'dll', '',

+		'src/backend/replication/pgoutput');

+	$pgoutput->AddReference($postgres);

+

 	my $pgtypes = $solution->AddProject(

 		'libpgtypes', 'dll',

 		'interfaces', 'src/interfaces/ecpg/pgtypeslib');

#2Michael Paquier
michael.paquier@gmail.com
In reply to: MauMau (#1)
Re: [patch] Build pgoutput with MSVC

On Fri, May 5, 2017 at 6:10 PM, MauMau <maumau307@gmail.com> wrote:

The pgoutput is not built with MSVC. The attached patch fixes this.
I confirmed that a few INSERTs were replicated correctly.

Should I add this matter in the PostgreSQL 10 Open Items page?

Yes, with Peter as committer and Petr as owner.

+    my $pgoutput = $solution->AddProject(
+        'pgoutput', 'dll', '',
+        'src/backend/replication/pgoutput');
+    $pgoutput->AddReference($postgres);
Yup, that's correct.

You have forgotten to update clean.bat, which should clean up pgoutput.dll.
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Magnus Hagander
magnus@hagander.net
In reply to: Michael Paquier (#2)
Re: [patch] Build pgoutput with MSVC

On Fri, May 5, 2017 at 11:58 AM, Michael Paquier <michael.paquier@gmail.com>
wrote:

On Fri, May 5, 2017 at 6:10 PM, MauMau <maumau307@gmail.com> wrote:

The pgoutput is not built with MSVC. The attached patch fixes this.
I confirmed that a few INSERTs were replicated correctly.

Should I add this matter in the PostgreSQL 10 Open Items page?

Yes, with Peter as committer and Petr as owner.

+    my $pgoutput = $solution->AddProject(
+        'pgoutput', 'dll', '',
+        'src/backend/replication/pgoutput');
+    $pgoutput->AddReference($postgres);
Yup, that's correct.

You have forgotten to update clean.bat, which should clean up pgoutput.dll.

If that's all that's required, I'll just go ahead and commit it right away,
including the clean.bat.

I think the problem with clean.bat isn't cleaning up pgoutput.dll -- that
one goes in a different directory. But it does need to clean up the
win32ver.rc file that gets dropped there automaticaly.

The attached patch itself seems broken (it has some sort of byte order
marker at the beginning, but removing that still breaks with "patch
unexpectedly ends in middle of line patch: **** Only garbage was found in
the patch input.". But I can just copy/paste it manually :)

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

#4Petr Jelinek
petr.jelinek@2ndquadrant.com
In reply to: Magnus Hagander (#3)
Re: [patch] Build pgoutput with MSVC

On 05/05/17 12:10, Magnus Hagander wrote:

On Fri, May 5, 2017 at 11:58 AM, Michael Paquier
<michael.paquier@gmail.com <mailto:michael.paquier@gmail.com>> wrote:

On Fri, May 5, 2017 at 6:10 PM, MauMau <maumau307@gmail.com
<mailto:maumau307@gmail.com>> wrote:

The pgoutput is not built with MSVC. The attached patch fixes this.
I confirmed that a few INSERTs were replicated correctly.

Should I add this matter in the PostgreSQL 10 Open Items page?

Yes, with Peter as committer and Petr as owner.

+    my $pgoutput = $solution->AddProject(
+        'pgoutput', 'dll', '',
+        'src/backend/replication/pgoutput');
+    $pgoutput->AddReference($postgres);
Yup, that's correct.

You have forgotten to update clean.bat, which should clean up
pgoutput.dll.

If that's all that's required, I'll just go ahead and commit it right
away, including the clean.bat.

I think the problem with clean.bat isn't cleaning up pgoutput.dll --
that one goes in a different directory. But it does need to clean up the
win32ver.rc file that gets dropped there automaticaly.

The attached patch itself seems broken (it has some sort of byte order
marker at the beginning, but removing that still breaks with "patch
unexpectedly ends in middle of line patch: **** Only garbage was found
in the patch input.". But I can just copy/paste it manually :)

Thanks for fixing this, I admit I have no idea how our windows build
system works.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5MauMau
maumau307@gmail.com
In reply to: Magnus Hagander (#3)
1 attachment(s)
Re: [patch] Build pgoutput with MSVC

From: Magnus Hagander
If that's all that's required, I'll just go ahead and commit it right
away, including the clean.bat.

I think the problem with clean.bat isn't cleaning up pgoutput.dll --
that one goes in a different directory. But it does need to clean up
the win32ver.rc file that gets dropped there automaticaly.

The attached patch itself seems broken (it has some sort of byte order
marker at the beginning, but removing that still breaks with "patch
unexpectedly ends in middle of line patch: **** Only garbage was found
in the patch input.". But I can just copy/paste it manually :)

Thanks, fixed clean.bat, too. My original patch was in UTF-16
unexpectedly. With Git Shell in GitHub Desktop on Windows, "git diff

filename" seems to produce output in UTF-16. I guess that's due to

PowerShell. I think there's nothing else to do, so please commit
this. Also, I added an item in the Open Items page.

Regards
MauMau

Attachments:

msvc_build_pgoutput_v2.patchapplication/octet-stream; name=msvc_build_pgoutput_v2.patchDownload
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 30c126503b..642797d738 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -252,6 +252,11 @@ sub mkvcbuild
 	$libpqwalreceiver->AddIncludeDir('src/interfaces/libpq');
 	$libpqwalreceiver->AddReference($postgres, $libpq);
 
+	my $pgoutput = $solution->AddProject(
+		'pgoutput', 'dll', '',
+		'src/backend/replication/pgoutput');
+	$pgoutput->AddReference($postgres);
+
 	my $pgtypes = $solution->AddProject(
 		'libpgtypes', 'dll',
 		'interfaces', 'src/interfaces/ecpg/pgtypeslib');
diff --git a/src/tools/msvc/clean.bat b/src/tools/msvc/clean.bat
index ab51284e64..de13aa17f4 100755
--- a/src/tools/msvc/clean.bat
+++ b/src/tools/msvc/clean.bat
@@ -20,6 +20,7 @@ del /s /q src\bin\win32ver.rc 2> NUL
 del /s /q src\interfaces\win32ver.rc 2> NUL
 if exist src\backend\win32ver.rc del /q src\backend\win32ver.rc
 if exist src\backend\replication\libpqwalreceiver\win32ver.rc del /q src\backend\replication\libpqwalreceiver\win32ver.rc
+if exist src\backend\replication\libpqwalreceiver\win32ver.rc del /q src\backend\replication\pgoutput\win32ver.rc
 if exist src\backend\snowball\win32ver.rc del /q src\backend\snowball\win32ver.rc
 if exist src\interfaces\ecpg\test\win32ver.rc del /q src\interfaces\ecpg\test\win32ver.rc
 if exist src\pl\plperl\win32ver.rc del /q src\pl\plperl\win32ver.rc
#6Michael Paquier
michael.paquier@gmail.com
In reply to: MauMau (#5)
Re: [patch] Build pgoutput with MSVC

On Sat, May 6, 2017 at 7:07 AM, MauMau <maumau307@gmail.com> wrote:

From: Magnus Hagander
If that's all that's required, I'll just go ahead and commit it right
away, including the clean.bat.

I think the problem with clean.bat isn't cleaning up pgoutput.dll --
that one goes in a different directory. But it does need to clean up
the win32ver.rc file that gets dropped there automaticaly.

The attached patch itself seems broken (it has some sort of byte order
marker at the beginning, but removing that still breaks with "patch
unexpectedly ends in middle of line patch: **** Only garbage was found
in the patch input.". But I can just copy/paste it manually :)

Thanks, fixed clean.bat, too. My original patch was in UTF-16
unexpectedly. With Git Shell in GitHub Desktop on Windows, "git diff

filename" seems to produce output in UTF-16. I guess that's due to

PowerShell. I think there's nothing else to do, so please commit
this. Also, I added an item in the Open Items page.

Magnus has already pushed it as 28d1c8c.

+if exist src\backend\replication\libpqwalreceiver\win32ver.rc del /q
src\backend\replication\pgoutput\win32ver.rc
This is not right by the way, you need to check for the existence of
the file in pgoutput/, not libpqwalreceiver/.
-- 
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#7MauMau
maumau307@gmail.com
In reply to: Michael Paquier (#6)
Re: [patch] Build pgoutput with MSVC

From: Michael Paquier
Magnus has already pushed it as 28d1c8c.

+if exist src\backend\replication\libpqwalreceiver\win32ver.rc del /q
src\backend\replication\pgoutput\win32ver.rc
This is not right by the way, you need to check for the existence of
the file in pgoutput/, not libpqwalreceiver/.

I'm relieved to hear that's already committed. Oh, how careless I
was, thanks.

Regards
MauMau

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers