|
@@ -1295,7 +1295,7 @@ public:
|
|
|
void doDelete() // Throw on error!
|
|
|
{
|
|
|
const char *logicalname = lfn.get();
|
|
|
- if (!checkLogicalName(lfn,user,true,true,true,"remove"))
|
|
|
+ if (!lfn.isExternal() && checkLogicalName(lfn,user,true,true,true,"remove"))
|
|
|
ThrowStringException(-1, "Logical Name fails for removal on %s", lfn.get());
|
|
|
|
|
|
// Transaction files have already been unlocked at this point, delete all remaining files
|
|
@@ -4504,7 +4504,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
: parentlname(_parentlname), subfile(_subfile), before(_before), other(_other)
|
|
|
{
|
|
|
}
|
|
|
- bool prepare()
|
|
|
+ virtual bool prepare()
|
|
|
{
|
|
|
parent.setown(transaction->lookupSuperFile(parentlname));
|
|
|
if (!parent)
|
|
@@ -4541,7 +4541,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
sub.clear();
|
|
|
return false;
|
|
|
}
|
|
|
- void run()
|
|
|
+ virtual void run()
|
|
|
{
|
|
|
if (!sub)
|
|
|
throw MakeStringException(-1,"addSubFile(2): File %s cannot be found to add",subfile.get());
|
|
@@ -4549,13 +4549,19 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
if (sf)
|
|
|
sf->doAddSubFile(LINK(sub),before,other,transaction);
|
|
|
}
|
|
|
- void commit()
|
|
|
+ virtual void commit()
|
|
|
{
|
|
|
CDistributedSuperFile *sf = QUERYINTERFACE(parent.get(),CDistributedSuperFile);
|
|
|
if (sf)
|
|
|
sf->updateParentFileAttrs(transaction);
|
|
|
CDFAction::commit();
|
|
|
}
|
|
|
+ virtual void retry()
|
|
|
+ {
|
|
|
+ parent.clear();
|
|
|
+ sub.clear();
|
|
|
+ CDFAction::retry();
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -4573,7 +4579,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
: parentlname(_parentlname), subfile(_subfile), remsub(_remsub)
|
|
|
{
|
|
|
}
|
|
|
- bool prepare()
|
|
|
+ virtual bool prepare()
|
|
|
{
|
|
|
parent.setown(transaction->lookupSuperFile(parentlname));
|
|
|
if (!parent)
|
|
@@ -4611,7 +4617,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
sub.clear();
|
|
|
return false;
|
|
|
}
|
|
|
- void run()
|
|
|
+ virtual void run()
|
|
|
{
|
|
|
CDistributedSuperFile *sf = QUERYINTERFACE(parent.get(),CDistributedSuperFile);
|
|
|
if (sf) {
|
|
@@ -4638,6 +4644,12 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
sf->doRemoveSubFiles(transaction);
|
|
|
}
|
|
|
}
|
|
|
+ virtual void retry()
|
|
|
+ {
|
|
|
+ parent.clear();
|
|
|
+ sub.clear();
|
|
|
+ CDFAction::retry();
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -4653,7 +4665,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
: parentlname(_parentlname), remsub(_remsub)
|
|
|
{
|
|
|
}
|
|
|
- bool prepare()
|
|
|
+ virtual bool prepare()
|
|
|
{
|
|
|
parent.setown(transaction->lookupSuperFile(parentlname));
|
|
|
if (!parent)
|
|
@@ -4666,7 +4678,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
parent.clear();
|
|
|
return false;
|
|
|
}
|
|
|
- void run()
|
|
|
+ virtual void run()
|
|
|
{
|
|
|
CDistributedSuperFile *sf = QUERYINTERFACE(parent.get(),CDistributedSuperFile);
|
|
|
if (sf)
|
|
@@ -4705,6 +4717,11 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ virtual void retry()
|
|
|
+ {
|
|
|
+ parent.clear();
|
|
|
+ CDFAction::retry();
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -4719,7 +4736,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
: super1Name(_super1Name), super2Name(_super2Name)
|
|
|
{
|
|
|
}
|
|
|
- bool prepare()
|
|
|
+ virtual bool prepare()
|
|
|
{
|
|
|
super1.setown(transaction->lookupSuperFile(super1Name));
|
|
|
if (!super1)
|
|
@@ -4747,12 +4764,18 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
|
|
|
super2.clear();
|
|
|
return false;
|
|
|
}
|
|
|
- void run()
|
|
|
+ virtual void run()
|
|
|
{
|
|
|
CDistributedSuperFile *sf = QUERYINTERFACE(super1.get(),CDistributedSuperFile);
|
|
|
if (sf)
|
|
|
sf->doSwapSuperFile(super2,transaction);
|
|
|
}
|
|
|
+ virtual void retry()
|
|
|
+ {
|
|
|
+ super1.clear();
|
|
|
+ super2.clear();
|
|
|
+ CDFAction::retry();
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -5389,9 +5412,6 @@ public:
|
|
|
|
|
|
void attach(const char *_logicalname,IUserDescriptor *user)
|
|
|
{
|
|
|
- // will need more thought but this gives limited support for anon
|
|
|
- if (isAnon())
|
|
|
- return;
|
|
|
assertex(!conn.get()); // already attached
|
|
|
CriticalBlock block (sect);
|
|
|
StringBuffer tail;
|
|
@@ -5409,9 +5429,6 @@ public:
|
|
|
|
|
|
void detach(unsigned timeoutMs=INFINITE)
|
|
|
{
|
|
|
- // will need more thought but this gives limited support for anon
|
|
|
- if (isAnon())
|
|
|
- return;
|
|
|
assertex(conn.get()); // must be attached
|
|
|
CriticalBlock block(sect);
|
|
|
checkModify("CDistributedSuperFile::detach");
|
|
@@ -7400,6 +7417,15 @@ class CCreateSuperFileAction: public CDFAction
|
|
|
IUserDescriptor *user;
|
|
|
bool interleaved, created;
|
|
|
|
|
|
+ void clearSuper()
|
|
|
+ {
|
|
|
+ if (created)
|
|
|
+ {
|
|
|
+ created = false;
|
|
|
+ super->detach();
|
|
|
+ }
|
|
|
+ super.clear();
|
|
|
+ }
|
|
|
public:
|
|
|
CCreateSuperFileAction(CDistributedFileDirectory *_parent,
|
|
|
IUserDescriptor *_user,
|
|
@@ -7429,7 +7455,6 @@ public:
|
|
|
created = true;
|
|
|
transaction->addFile(super);
|
|
|
}
|
|
|
- addFileLock(super);
|
|
|
}
|
|
|
return super.getLink();
|
|
|
}
|
|
@@ -7439,6 +7464,7 @@ public:
|
|
|
// Attach the file to DFS, if wasn't there already
|
|
|
if (created)
|
|
|
super->attach(logicalname.get(), user);
|
|
|
+ addFileLock(super);
|
|
|
if (lock())
|
|
|
return true;
|
|
|
unlock();
|
|
@@ -7451,15 +7477,13 @@ public:
|
|
|
void retry()
|
|
|
{
|
|
|
// on retry, we need to remove the file so next lock doesn't fail
|
|
|
- if (created)
|
|
|
- super->detach();
|
|
|
+ clearSuper();
|
|
|
CDFAction::retry();
|
|
|
}
|
|
|
void rollback()
|
|
|
{
|
|
|
state = TAS_FAILURE;
|
|
|
- if (created)
|
|
|
- super->detach();
|
|
|
+ clearSuper();
|
|
|
CDFAction::rollback();
|
|
|
}
|
|
|
};
|
|
@@ -7544,7 +7568,7 @@ public:
|
|
|
{
|
|
|
logicalname.set(_flname);
|
|
|
}
|
|
|
- bool prepare()
|
|
|
+ virtual bool prepare()
|
|
|
{
|
|
|
// We *have* to make sure the file exists here
|
|
|
super.setown(transaction->lookupSuperFile(logicalname.get(), SDS_SUB_LOCK_TIMEOUT));
|
|
@@ -7573,19 +7597,20 @@ public:
|
|
|
super.clear();
|
|
|
return false;
|
|
|
}
|
|
|
- void retry()
|
|
|
+ virtual void retry()
|
|
|
{
|
|
|
+ super.clear();
|
|
|
if (nestedTransaction)
|
|
|
nestedTransaction->retryActions();
|
|
|
CDFAction::retry();
|
|
|
}
|
|
|
- void run()
|
|
|
+ virtual void run()
|
|
|
{
|
|
|
if (nestedTransaction)
|
|
|
nestedTransaction->runActions();
|
|
|
super->detach();
|
|
|
}
|
|
|
- void commit()
|
|
|
+ virtual void commit()
|
|
|
{
|
|
|
if (nestedTransaction)
|
|
|
nestedTransaction->commitAndClearup();
|
|
@@ -7626,7 +7651,7 @@ public:
|
|
|
ra = ra_regular;
|
|
|
renamed = false;
|
|
|
}
|
|
|
- bool prepare()
|
|
|
+ virtual bool prepare()
|
|
|
{
|
|
|
// We *have* to make sure the source file exists and can be renamed
|
|
|
file.setown(transaction->lookupFile(fromName.get(), SDS_SUB_LOCK_TIMEOUT));
|
|
@@ -7684,12 +7709,17 @@ public:
|
|
|
file.clear();
|
|
|
return false;
|
|
|
}
|
|
|
- void run()
|
|
|
+ virtual void run()
|
|
|
{
|
|
|
doRename(fromName, toName, ra);
|
|
|
renamed = true;
|
|
|
}
|
|
|
- void rollback()
|
|
|
+ virtual void retry()
|
|
|
+ {
|
|
|
+ file.clear();
|
|
|
+ CDFAction::retry();
|
|
|
+ }
|
|
|
+ virtual void rollback()
|
|
|
{
|
|
|
// Only roll back if already renamed
|
|
|
if (renamed)
|
|
@@ -7850,7 +7880,8 @@ bool CDistributedFileDirectory::removeEntry(const char *name, IUserDescriptor *u
|
|
|
{
|
|
|
CDfsLogicalFileName logicalname;
|
|
|
logicalname.set(name);
|
|
|
- checkLogicalName(logicalname,user,true,true,false,"delete");
|
|
|
+ if (!logicalname.isExternal())
|
|
|
+ checkLogicalName(logicalname,user,true,true,false,"delete");
|
|
|
|
|
|
// Create a local transaction that will be destroyed (MORE: make transaction compulsory)
|
|
|
Linked<IDistributedFileTransactionExt> localtrans;
|