/** * Wait for rbw replica to reach the length * @param rbw replica that is being written to * @param len minimum length to reach * @throws IOException on failing to reach the len in given wait time */ private static void waitForMinLength(ReplicaBeingWritten rbw, long len) throws IOException { // Wait for 3 seconds for rbw replica to reach the minimum length for (int i = 0; i < 30 && rbw.getBytesOnDisk() < len; i++) { try { Thread.sleep(100); } catch (InterruptedException ie) { throw new IOException(ie); } } long bytesOnDisk = rbw.getBytesOnDisk(); if (bytesOnDisk < len) { throw new IOException( String.format("Need %d bytes, but only %d bytes available", len, bytesOnDisk)); } }
/** * Wait for rbw replica to reach the length * @param rbw replica that is being written to * @param len minimum length to reach * @throws IOException on failing to reach the len in given wait time */ private static void waitForMinLength(ReplicaBeingWritten rbw, long len) throws IOException { // Wait for 3 seconds for rbw replica to reach the minimum length for (int i = 0; i < 30 && rbw.getBytesOnDisk() < len; i++) { try { Thread.sleep(100); } catch (InterruptedException ie) { throw new IOException(ie); } } long bytesOnDisk = rbw.getBytesOnDisk(); if (bytesOnDisk < len) { throw new IOException( String.format("Need %d bytes, but only %d bytes available", len, bytesOnDisk)); } }
rbw.setWriter(Thread.currentThread()); if (replicaLen != rbw.getBytesOnDisk() || replicaLen != rbw.getBytesAcked()) { throw new ReplicaAlreadyExistsException("RBW replica " + replicaInfo + "bytesRcvd(" + rbw.getNumBytes() + "), bytesOnDisk(" + rbw.getBytesOnDisk() + "), and bytesAcked(" + rbw.getBytesAcked() + ") are not the same.");
rbw.setWriter(Thread.currentThread()); if (replicaLen != rbw.getBytesOnDisk() || replicaLen != rbw.getBytesAcked()) { throw new ReplicaAlreadyExistsException("RBW replica " + replicaInfo + "bytesRcvd(" + rbw.getNumBytes() + "), bytesOnDisk(" + rbw.getBytesOnDisk() + "), and bytesAcked(" + rbw.getBytesAcked() + ") are not the same.");
long bytesOnDisk = rbw.getBytesOnDisk(); long blockDataLength = rbw.getBlockFile().length(); if (bytesOnDisk != blockDataLength) {
long bytesOnDisk = rbw.getBytesOnDisk(); rbw.getNumBytes()); Assert.assertTrue(rbw.getBytesOnDisk() == rbw.getBytesAcked());
long bytesOnDisk = rbw.getBytesOnDisk(); long blockDataLength = rbw.getBlockFile().length(); if (bytesOnDisk != blockDataLength) {