Commit c9637a3f authored by Fabrizio Furano's avatar Fabrizio Furano
Browse files

Merge branch 'replica-rtype-fixes' into 'develop'

Fixed missing r_type (broken SRM / GridFTP transfers)

See merge request !57
parents 3bbf2fff 37a2ade5
......@@ -1159,9 +1159,9 @@ DmStatus DomeMySql::getReplicabyRFN(dmlite::Replica &r, std::string rfn) {
stmt.bindResult( 3, &r.atime);
stmt.bindResult( 4, &r.ptime);
stmt.bindResult( 5, &r.ltime);
stmt.bindResult( 6, &ctype, 1);
stmt.bindResult( 7, &cstatus, 1);
stmt.bindResult( 8, &crtype, 1);
stmt.bindResult( 6, &crtype, 1);
stmt.bindResult( 7, &ctype, 1);
stmt.bindResult( 8, &cstatus, 1);
stmt.bindResult( 9, setnm, sizeof(setnm));
stmt.bindResult(10, cpool, sizeof(cpool));
stmt.bindResult(11, cserver, sizeof(cserver));
......
......@@ -325,6 +325,7 @@ void DomeAdapterHeadCatalog::updateReplica(const Replica& replica) {
params.put("replicaid", replica.replicaid);
params.put("status", replica.status);
params.put("type", replica.type);
params.put("rtype", replica.rtype);
params.put("setname", replica.setname);
params.put("xattr", replica.serialize());
......@@ -344,6 +345,7 @@ void DomeAdapterHeadCatalog::addReplica(const Replica& rep) {
params.put("rfn", rep.rfn);
params.put("status", rep.status);
params.put("type", rep.type);
params.put("rtype", rep.rtype);
params.put("setname", rep.setname);
params.put("xattr", rep.serialize());
......
......@@ -837,7 +837,7 @@ std::vector<Replica> INodeMySql::getReplicas(ino_t inode)
char cfilesystem[512];
char crfn[4096];
char cmeta[4096];
char ctype, cstatus;
char crtype, ctype, cstatus;
Log(Logger::Lvl4, mysqllogmask, mysqllogname, " inode:" << inode);
......@@ -856,14 +856,15 @@ std::vector<Replica> INodeMySql::getReplicas(ino_t inode)
stmt.bindResult( 3, &replica.atime);
stmt.bindResult( 4, &replica.ptime);
stmt.bindResult( 5, &replica.ltime);
stmt.bindResult( 6, &cstatus, 1);
stmt.bindResult( 7, &ctype, 1);
stmt.bindResult( 8, setnm, sizeof(setnm));
stmt.bindResult( 9, cpool, sizeof(cpool));
stmt.bindResult( 10, cserver, sizeof(cserver));
stmt.bindResult(11, cfilesystem, sizeof(cfilesystem));
stmt.bindResult(12, crfn, sizeof(crfn));
stmt.bindResult(13, cmeta, sizeof(cmeta));
stmt.bindResult( 6, &crtype, 1);
stmt.bindResult( 7, &cstatus, 1);
stmt.bindResult( 8, &ctype, 1);
stmt.bindResult( 9, setnm, sizeof(setnm));
stmt.bindResult(10, cpool, sizeof(cpool));
stmt.bindResult(11, cserver, sizeof(cserver));
stmt.bindResult(12, cfilesystem, sizeof(cfilesystem));
stmt.bindResult(13, crfn, sizeof(crfn));
stmt.bindResult(14, cmeta, sizeof(cmeta));
std::vector<Replica> replicas;
......@@ -874,6 +875,7 @@ std::vector<Replica> INodeMySql::getReplicas(ino_t inode)
replica.rfn = crfn;
replica.server = cserver;
replica.rtype = static_cast<Replica::ReplicaPS>(crtype);
replica.status = static_cast<Replica::ReplicaStatus>(cstatus);
replica.type = static_cast<Replica::ReplicaType>(ctype);
replica.setname = std::string(setnm);
......@@ -908,7 +910,7 @@ Replica INodeMySql::getReplica(int64_t rid)
char cfilesystem[512];
char crfn[4096];
char cmeta[4096];
char ctype, cstatus;
char crtype, ctype, cstatus;
stmt.bindResult( 0, &r.replicaid);
stmt.bindResult( 1, &r.fileid);
......@@ -916,14 +918,15 @@ Replica INodeMySql::getReplica(int64_t rid)
stmt.bindResult( 3, &r.atime);
stmt.bindResult( 4, &r.ptime);
stmt.bindResult( 5, &r.ltime);
stmt.bindResult( 6, &cstatus, 1);
stmt.bindResult( 7, &ctype, 1);
stmt.bindResult( 8, setnm, sizeof(setnm));
stmt.bindResult( 9, cpool, sizeof(cpool));
stmt.bindResult(10, cserver, sizeof(cserver));
stmt.bindResult(11, cfilesystem, sizeof(cfilesystem));
stmt.bindResult(12, crfn, sizeof(crfn));
stmt.bindResult(13, cmeta, sizeof(cmeta));
stmt.bindResult( 6, &crtype, 1);
stmt.bindResult( 7, &cstatus, 1);
stmt.bindResult( 8, &ctype, 1);
stmt.bindResult( 9, setnm, sizeof(setnm));
stmt.bindResult(10, cpool, sizeof(cpool));
stmt.bindResult(11, cserver, sizeof(cserver));
stmt.bindResult(12, cfilesystem, sizeof(cfilesystem));
stmt.bindResult(13, crfn, sizeof(crfn));
stmt.bindResult(14, cmeta, sizeof(cmeta));
if (!stmt.fetch())
throw DmException(DMLITE_NO_SUCH_REPLICA, "Replica %d not found", rid);
......@@ -931,6 +934,7 @@ Replica INodeMySql::getReplica(int64_t rid)
r.rfn = crfn;
r.server = cserver;
r.setname = std::string(setnm);
r.rtype = static_cast<Replica::ReplicaPS>(crtype);
r.status = static_cast<Replica::ReplicaStatus>(cstatus);
r.type = static_cast<Replica::ReplicaType>(ctype);
r.deserialize(cmeta);
......@@ -961,7 +965,7 @@ DmStatus INodeMySql::getReplica(Replica &r, const std::string& rfn)
char cfilesystem[512];
char crfn[4096];
char cmeta[4096];
char ctype, cstatus;
char crtype, ctype, cstatus;
stmt.bindResult( 0, &r.replicaid);
stmt.bindResult( 1, &r.fileid);
......@@ -969,14 +973,15 @@ DmStatus INodeMySql::getReplica(Replica &r, const std::string& rfn)
stmt.bindResult( 3, &r.atime);
stmt.bindResult( 4, &r.ptime);
stmt.bindResult( 5, &r.ltime);
stmt.bindResult( 6, &cstatus, 1);
stmt.bindResult( 7, &ctype, 1);
stmt.bindResult( 8, setnm, sizeof(setnm));
stmt.bindResult( 9, cpool, sizeof(cpool));
stmt.bindResult(10, cserver, sizeof(cserver));
stmt.bindResult(11, cfilesystem, sizeof(cfilesystem));
stmt.bindResult(12, crfn, sizeof(crfn));
stmt.bindResult(13, cmeta, sizeof(cmeta));
stmt.bindResult( 6, &crtype, 1);
stmt.bindResult( 7, &cstatus, 1);
stmt.bindResult( 8, &ctype, 1);
stmt.bindResult( 9, setnm, sizeof(setnm));
stmt.bindResult(10, cpool, sizeof(cpool));
stmt.bindResult(11, cserver, sizeof(cserver));
stmt.bindResult(12, cfilesystem, sizeof(cfilesystem));
stmt.bindResult(13, crfn, sizeof(crfn));
stmt.bindResult(14, cmeta, sizeof(cmeta));
if (!stmt.fetch())
return DmStatus(DMLITE_NO_SUCH_REPLICA, "Replica %s not found", rfn.c_str());
......@@ -984,6 +989,7 @@ DmStatus INodeMySql::getReplica(Replica &r, const std::string& rfn)
r.rfn = crfn;
r.server = cserver;
r.setname = std::string(setnm);
r.rtype = static_cast<Replica::ReplicaPS>(crtype);
r.status = static_cast<Replica::ReplicaStatus>(cstatus);
r.type = static_cast<Replica::ReplicaType>(ctype);
r.deserialize(cmeta);
......@@ -1008,6 +1014,7 @@ void INodeMySql::updateReplica(const Replica& rdata)
Log(Logger::Lvl4, mysqllogmask, mysqllogname, " rdata:" << rdata.rfn);
// Update
char rtype = static_cast<char>(rdata.rtype);
char status = static_cast<char>(rdata.status);
char type = static_cast<char>(rdata.type);
......@@ -1018,23 +1025,24 @@ void INodeMySql::updateReplica(const Replica& rdata)
stmt.bindParam(1, rdata.atime);
stmt.bindParam(2, rdata.ptime);
stmt.bindParam(3, rdata.ltime);
stmt.bindParam(4, std::string(&type, 1));
stmt.bindParam(5, std::string(&status, 1));
stmt.bindParam(6, rdata.getString("pool"));
stmt.bindParam(7, rdata.server);
stmt.bindParam(8, rdata.getString("filesystem"));
stmt.bindParam(9, rdata.rfn);
stmt.bindParam(10, rdata.serialize());
stmt.bindParam(4, std::string(&rtype, 1));
stmt.bindParam(5, std::string(&type, 1));
stmt.bindParam(6, std::string(&status, 1));
stmt.bindParam(7, rdata.getString("pool"));
stmt.bindParam(8, rdata.server);
stmt.bindParam(9, rdata.getString("filesystem"));
stmt.bindParam(10, rdata.rfn);
stmt.bindParam(11, rdata.serialize());
if (rdata.setname.size() == 0) {
stmt.bindParam(11, NULL, 0);
stmt.bindParam(12, NULL, 0);
}
else {
stmt.bindParam(11, rdata.setname);
stmt.bindParam(12, rdata.setname);
}
stmt.bindParam(12, rdata.replicaid);
stmt.bindParam(13, rdata.replicaid);
stmt.execute();
......
......@@ -34,19 +34,19 @@ const char* STMT_GET_SYMLINK =
const char* STMT_GET_FILE_REPLICAS =
"SELECT rowid, fileid, nbaccesses,\
atime, ptime, ltime,\
status, f_type, setname, poolname, host, fs, sfn, COALESCE(xattr, '')\
r_type, status, f_type, setname, poolname, host, fs, sfn, COALESCE(xattr, '')\
FROM Cns_file_replica\
WHERE fileid = ?";
const char* STMT_GET_REPLICA_BY_ID =
"SELECT rowid, fileid, nbaccesses,\
atime, ptime, ltime,\
status, f_type, setname, poolname, host, fs, sfn, COALESCE(xattr, '')\
r_type, status, f_type, setname, poolname, host, fs, sfn, COALESCE(xattr, '')\
FROM Cns_file_replica\
WHERE rowid = ?";
const char* STMT_GET_REPLICA_BY_URL =
"SELECT rowid, fileid, nbaccesses,\
atime, ptime, ltime,\
status, f_type, setname, poolname, host, fs, sfn, COALESCE(xattr, '')\
r_type, status, f_type, setname, poolname, host, fs, sfn, COALESCE(xattr, '')\
FROM Cns_file_replica\
WHERE sfn = ?";
const char* STMT_GET_COMMENT =
......@@ -146,7 +146,7 @@ const char* STMT_UTIME =
const char* STMT_UPDATE_REPLICA =
"UPDATE Cns_file_replica\
SET nbaccesses = ?, ctime = UNIX_TIMESTAMP(), atime = ?, ptime = ?, ltime = ?, \
f_type = ?, status = ?, poolname = ?, \
r_type, f_type = ?, status = ?, poolname = ?, \
host = ?, fs = ?, sfn = ?, xattr = ?, setname = ?\
WHERE rowid = ?";
const char* STMT_CHANGE_SIZE =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment