Skip to content

Commit fcb3719

Browse files
committed
This should fix #8726: Replication error is raised for CREATE TABLE ... EXTERNAL if the specified disk does not exist on the replica host
1 parent 9129571 commit fcb3719

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/dsql/DdlNodes.epp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7472,8 +7472,11 @@ void CreateRelationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScrat
74727472
if (externalFile->length() >= sizeof(REL.RDB$EXTERNAL_FILE))
74737473
status_exception::raise(Arg::Gds(isc_dyn_name_longer));
74747474

7475-
if (ISC_check_if_remote(externalFile->c_str(), false))
7475+
if (!(tdbb->tdbb_flags & TDBB_replicator) &&
7476+
ISC_check_if_remote(externalFile->c_str(), false))
7477+
{
74767478
status_exception::raise(Arg::PrivateDyn(163));
7479+
}
74777480

74787481
REL.RDB$EXTERNAL_FILE.NULL = FALSE;
74797482
strcpy(REL.RDB$EXTERNAL_FILE, externalFile->c_str());

src/jrd/dfw.epp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ static bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork*
495495
static void check_computed_dependencies(thread_db* tdbb, jrd_tra* transaction,
496496
const MetaName& fieldName);
497497
static void check_dependencies(thread_db*, const TEXT*, const TEXT*, const TEXT*, int, jrd_tra*);
498-
static void check_filename(const Firebird::string&, bool);
498+
static void check_filename(thread_db*, const Firebird::string&, bool);
499499
static void cleanup_index_creation(thread_db*, DeferredWork*, jrd_tra*);
500500
static bool formatsAreEqual(const Format*, const Format*);
501501
static bool find_depend_in_dfw(thread_db*, TEXT*, USHORT, USHORT, jrd_tra*);
@@ -1872,9 +1872,8 @@ static bool add_file(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_tra*
18721872
// Check the file name for node name. This has already
18731873
// been done for shadows in add_shadow()
18741874

1875-
if (work->dfw_type != dfw_add_shadow) {
1876-
check_filename(work->dfw_name, true);
1877-
}
1875+
if (work->dfw_type != dfw_add_shadow)
1876+
check_filename(tdbb, work->dfw_name, true);
18781877

18791878
// User transaction may be safely used instead of system, cause
18801879
// we requested and got exclusive database access. AP-2008.
@@ -1992,7 +1991,7 @@ static bool add_shadow(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_tr
19921991
return true;
19931992

19941993
case 4:
1995-
check_filename(work->dfw_name, false);
1994+
check_filename(tdbb, work->dfw_name, false);
19961995

19971996
/* could have two cases:
19981997
1) this shadow has already been written to, so add this file using
@@ -2144,7 +2143,7 @@ static bool add_difference(thread_db* tdbb, SSHORT phase, DeferredWork* work, jr
21442143
ERR_post(Arg::Gds(isc_no_meta_update) <<
21452144
Arg::Gds(isc_wrong_backup_state));
21462145
}
2147-
check_filename(work->dfw_name, true);
2146+
check_filename(tdbb, work->dfw_name, true);
21482147
dbb->dbb_backup_manager->setDifference(tdbb, work->dfw_name.c_str());
21492148
}
21502149
break;
@@ -2995,7 +2994,7 @@ static void check_dependencies(thread_db* tdbb,
29952994
}
29962995

29972996

2998-
static void check_filename(const Firebird::string& name, bool shareExpand)
2997+
static void check_filename(thread_db* tdbb, const Firebird::string& name, bool shareExpand)
29992998
{
30002999
/**************************************
30013000
*
@@ -3008,6 +3007,9 @@ static void check_filename(const Firebird::string& name, bool shareExpand)
30083007
* inet node name.
30093008
*
30103009
**************************************/
3010+
if (tdbb->tdbb_flags & TDBB_replicator)
3011+
return;
3012+
30113013
const Firebird::PathName file_name(name.ToPathName());
30123014
const bool valid = file_name.find("::") == Firebird::PathName::npos;
30133015

0 commit comments

Comments
 (0)