use of java.io.IOError in project eiger by wlloyd.
the class LazilyCompactedRow method update.
public void update(MessageDigest digest) {
assert !closed;
// no special-case for rows.size == 1, we're actually skipping some bytes here so just
// blindly updating everything wouldn't be correct
DataOutputBuffer out = new DataOutputBuffer();
try {
ColumnFamily.serializer().serializeCFInfo(emptyColumnFamily, out);
out.writeInt(columnCount);
digest.update(out.getData(), 0, out.getLength());
} catch (IOException e) {
throw new IOError(e);
}
Iterator<IColumn> iter = iterator();
while (iter.hasNext()) {
iter.next().updateDigest(digest);
}
close();
}
use of java.io.IOError in project eiger by wlloyd.
the class CommitLogSegment method close.
/**
* Close the segment file.
*/
public void close() {
if (closed)
return;
try {
logFileAccessor.close();
closed = true;
} catch (IOException e) {
throw new IOError(e);
}
}
use of java.io.IOError in project eiger by wlloyd.
the class Directories method migrateFile.
private static void migrateFile(File file, File ksDir, String additionalPath) {
try {
if (file.isDirectory())
return;
String name = file.getName();
boolean isManifest = name.endsWith(LeveledManifest.EXTENSION);
String cfname = isManifest ? name.substring(0, name.length() - LeveledManifest.EXTENSION.length()) : name.substring(0, name.indexOf(Component.separator));
// idx > 0 => secondary index
int idx = cfname.indexOf(SECONDARY_INDEX_NAME_SEPARATOR);
String dirname = idx > 0 ? cfname.substring(0, idx) : cfname;
File destDir = getOrCreate(ksDir, dirname, additionalPath);
File destFile = new File(destDir, isManifest ? name : ksDir.getName() + Component.separator + name);
logger.debug(String.format("[upgrade to 1.1] Moving %s to %s", file, destFile));
FileUtils.renameWithConfirm(file, destFile);
} catch (IOException e) {
throw new IOError(e);
}
}
use of java.io.IOError in project eiger by wlloyd.
the class Directories method sstablesNeedsMigration.
/**
* To check if sstables needs migration, we look at the System directory.
* If it contains a directory for the status cf, we'll attempt a sstable
* migration.
* Note that it is mostly harmless to try a migration uselessly, except
* maybe for some wasted cpu cycles.
*/
public static boolean sstablesNeedsMigration() {
if (StorageService.instance.isClientMode())
return false;
boolean hasSystemKeyspace = false;
for (File location : dataFileLocations) {
File systemDir = new File(location, Table.SYSTEM_TABLE);
hasSystemKeyspace |= (systemDir.exists() && systemDir.isDirectory());
File statusCFDir = new File(systemDir, SystemTable.STATUS_CF);
if (statusCFDir.exists())
return false;
}
if (!hasSystemKeyspace)
// This is a brand new node.
return false;
// Check whether the migration migth create too long a filename
int longestLocation = -1;
try {
for (File loc : dataFileLocations) longestLocation = Math.max(longestLocation, loc.getCanonicalPath().length());
} catch (IOException e) {
throw new IOError(e);
}
for (KSMetaData ksm : Schema.instance.getTableDefinitions()) {
String ksname = ksm.name;
for (Map.Entry<String, CFMetaData> entry : ksm.cfMetaData().entrySet()) {
String cfname = entry.getKey();
// max path is roughly (guess-estimate) <location>/ksname/cfname/snapshots/1324314347102-somename/ksname-cfname-tmp-hb-1024-Statistics.db
if (longestLocation + (ksname.length() + cfname.length()) * 2 + 62 > 256)
throw new RuntimeException("Starting with 1.1, keyspace names and column family names must be less than 32 characters long. " + ksname + "/" + cfname + " doesn't respect that restriction. Please rename your keyspace/column families to respect that restriction before updating.");
}
}
return true;
}
use of java.io.IOError in project eiger by wlloyd.
the class MessagingService method shutdown.
/**
* Wait for callbacks and don't allow any more to be created (since they could require writing hints)
*/
public void shutdown() {
logger_.info("Waiting for messaging service to quiesce");
// We may need to schedule hints on the mutation stage, so it's erroneous to shut down the mutation stage first
assert !StageManager.getStage(Stage.MUTATION).isShutdown();
// the important part
callbacks.shutdown();
// attempt to humor tests that try to stop and restart MS
try {
for (SocketThread th : socketThreads) th.close();
} catch (IOException e) {
throw new IOError(e);
}
}
Aggregations