54int XrdXrootdProtocol::do_ChkPnt()
56 static const char *ckpName[] = {
"begin",
"commit",
"query",
"rollback",
"xeq"};
60 SI->Bump(
SI->miscCnt);
68 XrdXrootdFHandle fh(
Request.chkpoint.fhandle);
72 if (!
FTab || !(
IO.File =
FTab->Get(fh.handle)))
74 "chkpoint does not refer to an open file");
88 {ServerResponseBody_ChkPoint ckpQResp;
91 htonl(
static_cast<uint32_t
>(ckpVec.offset));
92 return Response.Send(&ckpQResp,
sizeof(ckpQResp));
99 "chkpoint subcode is invalid");
104 TRACEP(FS,
"fh=" <<fh.handle <<
" chkpnt " <<ckpName[
Request.chkpoint.opcode]
113 snprintf(eBuff,
sizeof(eBuff),
"chkpoint %s returned invalid rc=%d!",
114 ckpName[
Request.chkpoint.opcode], rc);
115 eDest.Emsg(
"Xeq", eBuff);
116 IO.File->XrdSfsp->error.setErrInfo(ENODEV,
"logic error");
118 return fsError(
SFS_ERROR, 0,
IO.File->XrdSfsp->error, 0, 0);
130int XrdXrootdProtocol::do_ChkPntXeq()
132 static const int sidSZ =
sizeof(
Request.header.streamid);
140 {ClientRequestHdr *Subject = (ClientRequestHdr *)(
argp->buff);
170 "Insufficient memory for chkpoint request");
176 {
Resume = &XrdXrootdProtocol::do_ChkPntXeq;
return rc;}
187 reqID =
Request.header.requestid;
195 fh.Set(
Request.pgwrite.fhandle);
199 fh.Set(
Request.truncate.fhandle);
207 if ((rc = do_WriteV()))
return rc;
209 fh.handle =
wvInfo->curFH;
210 for (
int i = 0; i <
wvInfo->vEnd; i++)
211 if (
wvInfo->ioVec[i].info != fh.handle)
214 "multi-file chkpoint writev not supported");
219 "chkpoint request is invalid");
224 if (!
FTab || !(
IO.File =
FTab->Get(fh.handle)))
226 "chkpoint does not refer to an open file");
228 return Link->setEtext(
"chkpnt xeq write protocol violation");
239 ckpVec.size =
Request.header.dlen;
240 n2hll(
Request.pgwrite.offset, ckpVec.offset);
244 if (!rc)
return do_PgWrite();
247 n2hll(
Request.write.offset, ckpVec.offset);
251 if (!rc)
return do_Truncate();
254 ckpVec.size =
Request.header.dlen;
255 n2hll(
Request.write.offset, ckpVec.offset);
259 if (!rc)
return do_Write();
265 {
for (
int i = 0; i <
wvInfo->vEnd; i++)
266 wvInfo->ioVec[i].info = fh.handle;
267 return do_WriteVec();
274 TRACEP(FS,
"fh=" <<fh.handle <<
" chkpnt " <<xeqOp <<
" rc=" <<rc);
282 snprintf(eBuff,
sizeof(eBuff),
283 "chkpoint xeq %s returned invalid rc=%d!", xeqOp, rc);
284 eDest.Emsg(
"Xeq", eBuff);
285 IO.File->XrdSfsp->error.setErrInfo(ENODEV,
"logic error");
289 return do_WriteNone(
static_cast<int>(
Request.pgwrite.pathid));
293 return do_WriteNone(
static_cast<int>(
Request.write.pathid));
295 rc = fsError(
SFS_ERROR, 0,
IO.File->XrdSfsp->error, 0, 0);
static const int kXR_ckpRollback
static const int kXR_ckpXeq
static const int kXR_ckpCommit
static const int kXR_ckpQuery
static const int kXR_ckpBegin
XrdOucTrace * XrdXrootdTrace
@ cpTrunc
Truncate a file within checkpoint.
@ cpDelete
Delete an existing checkpoint.
@ cpRestore
Restore an active checkpoint and delete it.
@ cpWrite
Add data to an existing checkpoint.
@ cpQuery
Return checkpoint limits.
@ cpCreate
Create a checkpoint, one must not be active.
static XrdXrootdStats * SI
XrdXrootdFileTable * FTab
static XrdSysError & eDest
int getData(gdCallBack *gdcbP, const char *dtype, char *buff, int blen)
int(XrdXrootdProtocol::* Resume)()
XrdXrootdResponse Response
static XrdBuffManager * BPool
static const int maxWvecln