Commit 3e91229e authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

Made setting of the checksum optional in RFIO, so to support RFIOv2

parent 591237b1
......@@ -705,7 +705,9 @@ BEGIN
END;
/
/* This procedure implements the Cns_closex API */
/* This procedure implements the Cns_closex API.
* inCksumType can be either 'AD' or 'NO' for no checksum.
*/
CREATE OR REPLACE PROCEDURE closex(inFid IN INTEGER,
inFileSize IN INTEGER,
inCksumType IN VARCHAR2,
......@@ -748,7 +750,7 @@ BEGIN
RETURN;
END IF;
-- Validate checksum type
IF inCksumType != 'AD' THEN
IF inCksumType != 'AD' AND inCksumType != 'NO' THEN
outRC := serrno.EINVAL;
outMsg := serrno.EINVAL_MSG ||' : incorrect checksum type detected '|| inCksumType;
ROLLBACK;
......@@ -774,8 +776,8 @@ BEGIN
-- All right, update file size and other metadata
UPDATE Cns_file_metadata
SET fileSize = inFileSize,
csumType = inCksumType,
csumValue = inCksumValue,
csumType = CASE WHEN inCksumType != 'NO' THEN inCksumType ELSE NULL END,
csumValue = CASE WHEN inCksumType != 'NO' THEN inCksumValue ELSE NULL END,
ctime = inMTime,
mtime = inMTime
WHERE fileId = inFid;
......
......@@ -169,11 +169,13 @@ int rfio_handle_close(void *ctx,
/* first we try to read a file xattr for checksum */
if ((xattr_len = ceph_posix_getxattr(internal_context->pfn, "user.castor.checksum.value", csumvalue, CA_MAXCKSUMLEN)) == -1) {
(*logfunc)(LOG_ERR, "rfio_handle_close: getxattr failed for user.castor.checksum.value, skipping checksum. Error=%d\n", errno);
strcpy(csumtype, "NO");
} else {
csumvalue[xattr_len] = '\0';
(*logfunc)(LOG_DEBUG,"rfio_handle_close: csumvalue for the file on the disk=0x%s\n", csumvalue);
if ((xattr_len = ceph_posix_getxattr(internal_context->pfn, "user.castor.checksum.type", csumtype, CA_MAXCKSUMNAMELEN)) == -1) {
(*logfunc)(LOG_ERR, "rfio_handle_close: getxattr failed for user.castor.checksum.type, skipping checksum. Error=%d\n", errno);
strcpy(csumtype, "NO");
} else {
csumtype[xattr_len] = '\0';
(*logfunc)(LOG_DEBUG, "rfio_handle_close: csumtype is %s\n", csumtype);
......
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