Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test zero-byte files error #7534

Draft
wants to merge 1 commit into
base: 9.2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,16 @@ public void messageArrived(CellMessage envelope, TransferCompleteMessage message
}

public void messageArrived(CellMessage envelope, TransferFailedMessage message) {

LOGGER.error("TESTING ZERO_BYTE messageArrived 1 ");

messageArrived(Duration.of(envelope.getLocalAge(), MILLIS));

LOGGER.error("TESTING ZERO_BYTE messageArrived 2 " );

RemoteTransfer transfer = _transfers.get(message.getId());
LOGGER.error("TESTING ZERO_BYTE is transfer null " + transfer );

if (transfer != null) {
String error = String.valueOf(message.getErrorObject());
_activity.execute(() -> transfer.completed(error));
Expand Down Expand Up @@ -1114,6 +1122,8 @@ private void addDigestResponseHeader(FileAttributes attributes) {
}

private void completed(String transferError) {
LOGGER.error("TESTING ZERO_BYTE call completed id " + _id );

if (_transfers.remove(_id) == null) {
// Something else called complete, so do nothing.
return;
Expand All @@ -1127,6 +1137,8 @@ private void completed(String transferError) {
fetchChecksums();
} else {
if (_direction == Direction.PULL) {
LOGGER.error("TESTING ZERO_BYTE call deleteFile id " + _id );

error = deleteFile()
.map(e -> transferError + " (" + e + ")")
.orElse(transferError);
Expand Down Expand Up @@ -1157,6 +1169,8 @@ private Optional<String> deleteFile() {
* restrictions removed.
*/
PnfsHandler pnfs = new PnfsHandler(_pnfs, null);
LOGGER.error("TESTING ZERO_BYTE call deletePnfsEntry" );

pnfs.deletePnfsEntry(_pnfsId, _path.toString(),
EnumSet.of(FileType.REGULAR), EnumSet.noneOf(FileAttribute.class));
} catch (FileNotFoundCacheException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public void getInfo(PrintWriter pw) {
public void messageArrived(DoorTransferFinishedMessage message) {
long id = message.getId();
TransferManagerHandler h = getHandler(id);
LOGGER.error("TESTING ZERO_BYTE id is {}, handler is {} ", id, h );
if (h != null) {
h.poolDoorMessageArrived(message);
}
Expand Down Expand Up @@ -359,6 +360,7 @@ public void addActiveTransfer(long id, TransferManagerHandler handler) {
}

public void removeActiveTransfer(long id) {
LOGGER.error("TESTING ZERO_BYTE removeActive transfer id {}", id);
TransferManagerHandler handler = _activeTransfers.remove(id);
if (handler == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ public void success(Message message) {
setState(RECEIVED_PNFS_ENTRY_DELETE);
LOGGER.debug("Received PnfsDeleteEntryMessage, Deleted : {}",
deleteReply.getPnfsPath());
LOGGER.error("TESTING ZERO_BYTE Received PnfsDeleteEntryMessage, Deleted : {}",
deleteReply.getPnfsPath());
sendErrorReply();
}
}
Expand Down Expand Up @@ -588,18 +590,24 @@ public void deletePnfsEntry() {
setState(WAITING_FOR_PNFS_ENTRY_DELETE);
manager.persist(this);
pnfsMsg.setReplyRequired(true);
LOGGER.error("TESTING ZERO_BYTE set RECEIVED_PNFS_CHECK_BEFORE_DELETE_STATE" );

CellStub.addCallback(manager.getPnfsManagerStub().send(pnfsMsg), this, executor);
} else {
PnfsGetFileAttributes message = new PnfsGetFileAttributes(pnfsPath,
EnumSet.noneOf(FileAttribute.class));
setState(WAITING_FOR_PNFS_CHECK_BEFORE_DELETE_STATE);
LOGGER.error("TESTING ZERO_BYTE set WAITING_FOR_PNFS_CHECK_BEFORE_DELETE_STATE" );

CellStub.addCallback(manager.getPnfsManagerStub().send(message), this, executor);
}
}

public void poolDoorMessageArrived(DoorTransferFinishedMessage doorMessage) {
LOGGER.debug("poolDoorMessageArrived, doorMessage.getReturnCode()={}",
doorMessage.getReturnCode());
LOGGER.error("TESTING ZERO_BYTE poolDoorMessageArrived, doorMessage.getReturnCode()={}",
doorMessage.getReturnCode());
if (doorMessage.getReturnCode() != 0) {
sendErrorReply(CacheException.THIRD_PARTY_TRANSFER_FAILED,
doorMessage.getErrorObject());
Expand All @@ -621,7 +629,12 @@ private void sendErrorReply(int replyCode, Serializable errorObject) {
&& created) {// Timur: I think this check is not needed, we might not ever get storage info and pnfs id: && pnfsId != null && aMetadata != null && aMetadata.getFileSize() == 0) {
if (state != WAITING_FOR_PNFS_ENTRY_DELETE && state != RECEIVED_PNFS_ENTRY_DELETE) {
LOGGER.debug("deleting pnfs entry we created: {}", pnfsPath);
LOGGER.error("TESTING ZERO_BYTE ptest store {}, created {}, state {}",
store, created, state);
deletePnfsEntry();
LOGGER.error("TESTING ZERO_BYTE afetre delete");
LOGGER.error("TESTING ZERO_BYTE TEST THREAD " + Thread.currentThread().getName());

return;
}
}
Expand All @@ -648,15 +661,20 @@ private void sendErrorReply(int replyCode, Serializable errorObject) {
}
manager.finishTransfer();
try {

TransferFailedMessage errorReply = new TransferFailedMessage(transferRequest, replyCode,
errorObject);
LOGGER.error("TESTING ZERO_BYTE TransferFailedMessage errorObject {}, errorObject {}",
errorObject,replyCode);
manager.sendMessage(new CellMessage(requestor, errorReply));
} catch (RuntimeException e) {
LOGGER.error("Send message failed:", e);
//can not do much more here!!!
}
//this will allow the handler to be garbage collected
// once we sent a response
LOGGER.error("TESTING ZERO_BYTE 1 removeActive transfer id {}", id);

manager.removeActiveTransfer(id);
}

Expand Down Expand Up @@ -691,6 +709,8 @@ private void sendErrorReply() {
}
manager.finishTransfer();
try {
LOGGER.error("TESTING ZERO_BYTE ind sendError without argumentsTransferFailedMessage errorObject {}, errorObject {}",
errorObject,replyCode);
TransferFailedMessage errorReply = new TransferFailedMessage(transferRequest, replyCode,
errorObject);
manager.sendMessage(new CellMessage(requestor, errorReply));
Expand All @@ -700,6 +720,8 @@ private void sendErrorReply() {
}
//this will allow the handler to be garbage collected
// once we sent a response
LOGGER.error("TESTING ZERO_BYTE 2 removeActive transfer id {}", id);

manager.removeActiveTransfer(id);
}

Expand Down Expand Up @@ -733,6 +755,8 @@ public void sendSuccessReply() {
}
//this will allow the handler to be garbage collected
// once we sent a response
LOGGER.error("TESTING ZERO_BYTE 3 removeActive transfer id {}", id);

manager.removeActiveTransfer(id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.dcache.namespace.FileAttribute.PNFSID;
import static org.dcache.namespace.FileType.DIR;
import static org.dcache.namespace.FileType.LINK;
import static org.dcache.qos.QoSTransitionEngine.LOGGER;

import com.google.common.util.concurrent.ListenableFuture;
import diskCacheV111.namespace.NameSpaceProvider.Link;
Expand Down Expand Up @@ -386,6 +387,8 @@ public void deletePnfsEntry(PnfsId pnfsid, String path)
public FileAttributes deletePnfsEntry(PnfsId pnfsid, String path, Set<FileType> allowed,
Set<FileAttribute> attr)
throws CacheException {
LOGGER.error("TESTING ZERO_BYTE call deletePnfsEntry send request" );

return request(new PnfsDeleteEntryMessage(pnfsid, path, allowed, attr)).getFileAttributes();
}

Expand Down
Loading