-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
None
-
None
I've successfully gotten replication to work on FreeBSD. However, when a schema change happens, my changes will get overwritten. There's a few issues:
Issue 1
diff --git a/admin/replication/LoadReplicationChanges b/admin/replication/LoadReplicationChanges index ff38102..ae1ccdf 100755 --- a/admin/replication/LoadReplicationChanges +++ b/admin/replication/LoadReplicationChanges @@ -219,7 +219,7 @@ $SIG{'INT'} = sub { exit 3 }; my $mydir = tempdir("loadrep-XXXXXX", DIR => $tmpdir, CLEANUP => not $fKeepFiles); print localtime() . " : Decompressing $localfile to $mydir\n"; -system "/bin/tar", +system "/usr/bin/tar", "-C", $mydir, "--bzip2", "-xvf",
On FreeBSD, tar is in /usr/bin, not /bin. I suggest a simple code snippet to find tar and make sure it's not a symlink, e.g.
my @tar_binaries = ( qw( /bin/tar /usr/bin/tar ) ); my $tar_bin = undef; foreach my $check (@tar_binaries) { if (-f $check && -x _) { $tar_bin = $check; last; } } die "No suitable tar binary found\n" unless (defined($tar_bin));
Issue 2
The admin/cron/slave.sh script assumes one uses bash. Some of us do not use this (c.f. the shellshock exploits) and have rarely, if ever, used it on FreeBSD (and elsewhere). What you have is find for bourne shell (/bin/sh) which is everywhere Unix is.
Not Really An Issue 3
On FreeBSD, we don't add packages to /usr/sbin and /usr/bin. All "rpm" style packages (which are really "ports" in FreeBSD) go in /usr/local. Thus I had to change the logrotate default. I recognize you did this as an environment variable so no change is really necessary but I wanted to explain why the patch shows it to be different.
Maybe an Issue 4
Your logrotate trick does not appear to work on FreeBSD even though we have a /dev/stdin. So I altered how it works.
Here is the patch for slave.sh on my system:
--- a/admin/cron/slave.sh +++ b/admin/cron/slave.sh @@ -1,23 +1,26 @@ -#!/bin/bash - +#!/bin/sh mb_server=`dirname $0`/../.. cd $mb_server eval `./admin/ShowDBDefs` X=${SLAVE_LOG:=$MB_SERVER_ROOT/slave.log} -X=${LOGROTATE:=/usr/sbin/logrotate --state $MB_SERVER_ROOT/.logrotate-state} +X=${LOGROTATE:=/usr/local/sbin/logrotate --state $MB_SERVER_ROOT/.logrotate-state} ./admin/replication/LoadReplicationChanges >> $SLAVE_LOG 2>&1 || { RC=$? echo `date`" : LoadReplicationChanges failed (rc=$RC) - see $SLAVE_LOG" + } -$LOGROTATE /dev/stdin <<EOF +TMPFILE="/tmp/mblogrot" +rm $TMPFILE >/dev/null 2>&1 +cat >$TMPFILE <<EOF $SLAVE_LOG { daily rotate 30 } EOF +$LOGROTATE $TMPFILE # eof