static void verifyRecordWithCorruptedLastRecord(LogRecord record) { if (record.type == Type.REMOVE && record.status.onDiskRecord.numFiles < record.numFiles) { // if we found a corruption in the last record, then we continue only // if the number of files matches exactly for all previous records. record.setError(String.format("Incomplete fileset detected for sstable [%s]: " + "number of files [%d] should have been [%d].", record.fileName(), record.status.onDiskRecord.numFiles, record.numFiles)); } }
static void verifyRecordWithCorruptedLastRecord(LogRecord record) { if (record.type == Type.REMOVE && record.status.onDiskRecord.numFiles < record.numFiles) { // if we found a corruption in the last record, then we continue only // if the number of files matches exactly for all previous records. record.setError(String.format("Incomplete fileset detected for sstable [%s]: " + "number of files [%d] should have been [%d].", record.fileName(), record.status.onDiskRecord.numFiles, record.numFiles)); } }
void setError(LogRecord record, String error) { record.setError(error); setErrorInReplicas(record); }
void setError(LogRecord record, String error) { record.setError(error); setErrorInReplicas(record); }
void setError(LogRecord record, String error) { record.setError(error); setErrorInReplicas(record); }
static void verifyRecordWithCorruptedLastRecord(LogRecord record) { if (record.type == Type.REMOVE && record.status.onDiskRecord.numFiles < record.numFiles) { // if we found a corruption in the last record, then we continue only // if the number of files matches exactly for all previous records. record.setError(String.format("Incomplete fileset detected for sstable [%s]: " + "number of files [%d] should have been [%d].", record.fileName(), record.status.onDiskRecord.numFiles, record.numFiles)); } }
void setError(LogRecord record, String error) { record.setError(error); setErrorInReplicas(record); }
static void verifyRecordWithCorruptedLastRecord(LogRecord record) { if (record.type == Type.REMOVE && record.status.onDiskRecord.numFiles < record.numFiles) { // if we found a corruption in the last record, then we continue only // if the number of files matches exactly for all previous records. record.setError(String.format("Incomplete fileset detected for sstable [%s]: " + "number of files [%d] should have been [%d].", record.fileName(), record.status.onDiskRecord.numFiles, record.numFiles)); } }
public static LogRecord make(String line) { try { Matcher matcher = REGEX.matcher(line); if (!matcher.matches()) return new LogRecord(Type.UNKNOWN, null, 0, 0, 0, line) .setError(String.format("Failed to parse [%s]", line)); Type type = Type.fromPrefix(matcher.group(1)); return new LogRecord(type, matcher.group(2) + Component.separator, // see comment on CASSANDRA-13294 below Long.parseLong(matcher.group(3)), Integer.parseInt(matcher.group(4)), Long.parseLong(matcher.group(5)), line); } catch (IllegalArgumentException e) { return new LogRecord(Type.UNKNOWN, null, 0, 0, 0, line) .setError(String.format("Failed to parse line: %s", e.getMessage())); } }
public static LogRecord make(String line) { try { Matcher matcher = REGEX.matcher(line); if (!matcher.matches()) return new LogRecord(Type.UNKNOWN, null, 0, 0, 0, line) .setError(String.format("Failed to parse [%s]", line)); Type type = Type.fromPrefix(matcher.group(1)); return new LogRecord(type, matcher.group(2), Long.parseLong(matcher.group(3)), Integer.parseInt(matcher.group(4)), Long.parseLong(matcher.group(5)), line); } catch (IllegalArgumentException e) { return new LogRecord(Type.UNKNOWN, null, 0, 0, 0, line) .setError(String.format("Failed to parse line: %s", e.getMessage())); } }
public static LogRecord make(String line) { try { Matcher matcher = REGEX.matcher(line); if (!matcher.matches()) return new LogRecord(Type.UNKNOWN, null, 0, 0, 0, line) .setError(String.format("Failed to parse [%s]", line)); Type type = Type.fromPrefix(matcher.group(1)); return new LogRecord(type, matcher.group(2) + Component.separator, // see comment on CASSANDRA-13294 below Long.parseLong(matcher.group(3)), Integer.parseInt(matcher.group(4)), Long.parseLong(matcher.group(5)), line); } catch (IllegalArgumentException e) { return new LogRecord(Type.UNKNOWN, null, 0, 0, 0, line) .setError(String.format("Failed to parse line: %s", e.getMessage())); } }
public static LogRecord make(String line) { try { Matcher matcher = REGEX.matcher(line); if (!matcher.matches()) return new LogRecord(Type.UNKNOWN, null, 0, 0, 0, line) .setError(String.format("Failed to parse [%s]", line)); Type type = Type.fromPrefix(matcher.group(1)); return new LogRecord(type, matcher.group(2) + Component.separator, // see comment on CASSANDRA-13294 below Long.parseLong(matcher.group(3)), Integer.parseInt(matcher.group(4)), Long.parseLong(matcher.group(5)), line); } catch (IllegalArgumentException e) { return new LogRecord(Type.UNKNOWN, null, 0, 0, 0, line) .setError(String.format("Failed to parse line: %s", e.getMessage())); } }
static void verifyRecord(LogRecord record) { if (record.checksum != record.computeChecksum()) { record.setError(String.format("Invalid checksum for sstable [%s]: [%d] should have been [%d]", record.fileName(), record.checksum, record.computeChecksum())); return; } if (record.type != Type.REMOVE) return; // Paranoid sanity checks: we create another record by looking at the files as they are // on disk right now and make sure the information still matches. We don't want to delete // files by mistake if the user has copied them from backup and forgot to remove a txn log // file that obsoleted the very same files. So we check the latest update time and make sure // it matches. Because we delete files from oldest to newest, the latest update time should // always match. record.status.onDiskRecord = record.withExistingFiles(); if (record.updateTime != record.status.onDiskRecord.updateTime && record.status.onDiskRecord.updateTime > 0) { record.setError(String.format("Unexpected files detected for sstable [%s]: " + "last update time [%tT] should have been [%tT]", record.fileName(), record.status.onDiskRecord.updateTime, record.updateTime)); } }
static void verifyRecord(LogRecord record) { if (record.checksum != record.computeChecksum()) { record.setError(String.format("Invalid checksum for sstable [%s]: [%d] should have been [%d]", record.fileName(), record.checksum, record.computeChecksum())); return; } if (record.type != Type.REMOVE) return; // Paranoid sanity checks: we create another record by looking at the files as they are // on disk right now and make sure the information still matches. We don't want to delete // files by mistake if the user has copied them from backup and forgot to remove a txn log // file that obsoleted the very same files. So we check the latest update time and make sure // it matches. Because we delete files from oldest to newest, the latest update time should // always match. record.status.onDiskRecord = record.withExistingFiles(); if (record.updateTime != record.status.onDiskRecord.updateTime && record.status.onDiskRecord.updateTime > 0) { record.setError(String.format("Unexpected files detected for sstable [%s]: " + "last update time [%tT] should have been [%tT]", record.fileName(), record.status.onDiskRecord.updateTime, record.updateTime)); } }
static void verifyRecord(LogRecord record) { if (record.checksum != record.computeChecksum()) { record.setError(String.format("Invalid checksum for sstable [%s]: [%d] should have been [%d]", record.fileName(), record.checksum, record.computeChecksum())); return; } if (record.type != Type.REMOVE) return; // Paranoid sanity checks: we create another record by looking at the files as they are // on disk right now and make sure the information still matches. We don't want to delete // files by mistake if the user has copied them from backup and forgot to remove a txn log // file that obsoleted the very same files. So we check the latest update time and make sure // it matches. Because we delete files from oldest to newest, the latest update time should // always match. record.status.onDiskRecord = record.withExistingFiles(); if (record.updateTime != record.status.onDiskRecord.updateTime && record.status.onDiskRecord.updateTime > 0) { record.setError(String.format("Unexpected files detected for sstable [%s]: " + "last update time [%tT] should have been [%tT]", record.fileName(), record.status.onDiskRecord.updateTime, record.updateTime)); } }
static void verifyRecord(LogRecord record) { if (record.checksum != record.computeChecksum()) { record.setError(String.format("Invalid checksum for sstable [%s]: [%d] should have been [%d]", record.fileName(), record.checksum, record.computeChecksum())); return; } if (record.type != Type.REMOVE) return; // Paranoid sanity checks: we create another record by looking at the files as they are // on disk right now and make sure the information still matches. We don't want to delete // files by mistake if the user has copied them from backup and forgot to remove a txn log // file that obsoleted the very same files. So we check the latest update time and make sure // it matches. Because we delete files from oldest to newest, the latest update time should // always match. record.status.onDiskRecord = record.withExistingFiles(); if (record.updateTime != record.status.onDiskRecord.updateTime && record.status.onDiskRecord.updateTime > 0) { record.setError(String.format("Unexpected files detected for sstable [%s]: " + "last update time [%tT] should have been [%tT]", record.fileName(), record.status.onDiskRecord.updateTime, record.updateTime)); } }