Skip to content

Commit 9397a86

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 3feddfa commit 9397a86

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
@@ -7419,8 +7419,11 @@ void CreateRelationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScrat
74197419
if (externalFile->length() >= sizeof(REL.RDB$EXTERNAL_FILE))
74207420
status_exception::raise(Arg::Gds(isc_dyn_name_longer));
74217421

7422-
if (ISC_check_if_remote(externalFile->c_str(), false))
7422+
if (!(tdbb->tdbb_flags & TDBB_replicator) &&
7423+
ISC_check_if_remote(externalFile->c_str(), false))
7424+
{
74237425
status_exception::raise(Arg::PrivateDyn(163));
7426+
}
74247427

74257428
REL.RDB$EXTERNAL_FILE.NULL = FALSE;
74267429
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
@@ -498,7 +498,7 @@ static bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork*
498498
static void check_computed_dependencies(thread_db* tdbb, jrd_tra* transaction,
499499
const MetaName& fieldName);
500500
static void check_dependencies(thread_db*, const TEXT*, const TEXT*, const TEXT*, int, jrd_tra*);
501-
static void check_filename(const Firebird::string&, bool);
501+
static void check_filename(thread_db*, const Firebird::string&, bool);
502502
static void cleanup_index_creation(thread_db*, DeferredWork*, jrd_tra*);
503503
static bool formatsAreEqual(const Format*, const Format*);
504504
static bool find_depend_in_dfw(thread_db*, TEXT*, USHORT, USHORT, jrd_tra*);
@@ -1883,9 +1883,8 @@ static bool add_file(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_tra*
18831883
// Check the file name for node name. This has already
18841884
// been done for shadows in add_shadow()
18851885

1886-
if (work->dfw_type != dfw_add_shadow) {
1887-
check_filename(work->dfw_name, true);
1888-
}
1886+
if (work->dfw_type != dfw_add_shadow)
1887+
check_filename(tdbb, work->dfw_name, true);
18891888

18901889
// User transaction may be safely used instead of system, cause
18911890
// we requested and got exclusive database access. AP-2008.
@@ -2003,7 +2002,7 @@ static bool add_shadow(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_tr
20032002
return true;
20042003

20052004
case 4:
2006-
check_filename(work->dfw_name, false);
2005+
check_filename(tdbb, work->dfw_name, false);
20072006

20082007
/* could have two cases:
20092008
1) this shadow has already been written to, so add this file using
@@ -2155,7 +2154,7 @@ static bool add_difference(thread_db* tdbb, SSHORT phase, DeferredWork* work, jr
21552154
ERR_post(Arg::Gds(isc_no_meta_update) <<
21562155
Arg::Gds(isc_wrong_backup_state));
21572156
}
2158-
check_filename(work->dfw_name, true);
2157+
check_filename(tdbb, work->dfw_name, true);
21592158
dbb->dbb_backup_manager->setDifference(tdbb, work->dfw_name.c_str());
21602159
}
21612160
break;
@@ -3055,7 +3054,7 @@ static void check_dependencies(thread_db* tdbb,
30553054
}
30563055

30573056

3058-
static void check_filename(const Firebird::string& name, bool shareExpand)
3057+
static void check_filename(thread_db* tdbb, const Firebird::string& name, bool shareExpand)
30593058
{
30603059
/**************************************
30613060
*
@@ -3068,6 +3067,9 @@ static void check_filename(const Firebird::string& name, bool shareExpand)
30683067
* inet node name.
30693068
*
30703069
**************************************/
3070+
if (tdbb->tdbb_flags & TDBB_replicator)
3071+
return;
3072+
30713073
const Firebird::PathName file_name(name.ToPathName());
30723074
const bool valid = file_name.find("::") == Firebird::PathName::npos;
30733075

0 commit comments

Comments
 (0)