/** * Restores all SchemaTable entries from the metadata backup. * * @param backup the deserialized backup of the metadata. * @param fiji the connected Fiji instance. * @throws IOException if there is an error communicating with HBase. */ public void restoreSchemas(MetadataBackup backup, Fiji fiji) throws IOException { // Restore all Schema table entries in the file. final FijiSchemaTable schemaTable = fiji.getSchemaTable(); LOG.info("Restoring schema table entries..."); schemaTable.fromBackup(backup.getSchemaTable()); LOG.info("Restored " + backup.getSchemaTable().getEntries().size() + " entries."); }
/** * Restores all SystemTable entries from the backup. * * @param backup the deserialized backup of the metadata. * @param fiji the connected Fiji instance. * @throws IOException if there is an error communicating with HBase. */ public void restoreSystemVars(MetadataBackup backup, Fiji fiji) throws IOException { // Restore all System table entries from the file. final FijiSystemTable systemTable = fiji.getSystemTable(); LOG.info("Restoring system table entries..."); systemTable.fromBackup(backup.getSystemTable()); LOG.info(String.format("Restored %d entries.", backup.getSystemTable().getEntries().size())); } }
throw new IOException("Output file '" + outputFile + "' already exists. Won't overwrite."); final MetadataBackup backup = MetadataBackup.newBuilder() .setLayoutVersion(fiji.getSystemTable().getDataVersion().toString()) .setSystemTable(fiji.getSystemTable().toBackup()) new DataFileWriter<MetadataBackup>(datumWriter); try { fileWriter.create(backup.getSchema(), file); fileWriter.append(backup); } finally {
/** * Restores all tables from the metadata backup into the running Fiji instance. * * @param backup the deserialized backup of the metadata. * @param fiji the connected Fiji instance. * @throws java.io.IOException if there is an error communicating with HBase. */ public void restoreTables(MetadataBackup backup, CassandraFiji fiji) throws IOException { final CassandraAdmin admin = fiji.getCassandraAdmin(); final FijiMetaTable metaTable = fiji.getMetaTable(); CassandraMetaTable.uninstall(admin, fiji.getURI()); CassandraMetaTable.install(admin, fiji.getURI()); final Map<String, TableBackup> tables = backup.getMetaTable().getTables(); for (Map.Entry<String, TableBackup> layoutEntry : tables.entrySet()) { final String tableName = layoutEntry.getKey(); LOG.debug("Found table backup entry for " + tableName); final TableBackup tableBackup = layoutEntry.getValue(); restoreTable(tableName, tableBackup, metaTable, fiji); } }
LOG.debug("Metadata backup data version: " + backup.getLayoutVersion()); LOG.debug("Current data version: " + curDataVersion); if (!curDataVersion.equals(ProtocolVersion.parse(backup.getLayoutVersion()))) { throw new IOException(String.format( "Cannot restore: backup layout version '%s' does not match Fiji instance version '%s'.", backup.getLayoutVersion(), curDataVersion));
throw new IOException("Output file '" + outputFile + "' already exists. Won't overwrite."); final MetadataBackup backup = MetadataBackup.newBuilder() .setLayoutVersion(fiji.getSystemTable().getDataVersion().toString()) .setSystemTable(fiji.getSystemTable().toBackup()) new DataFileWriter<MetadataBackup>(datumWriter); try { fileWriter.create(backup.getSchema(), file); fileWriter.append(backup); } finally {
/** * Restores all tables from the metadata backup into the running Fiji instance. * * @param backup the deserialized backup of the metadata. * @param fiji the connected Fiji instance. * @throws IOException if there is an error communicating with HBase. */ public void restoreTables(MetadataBackup backup, Fiji fiji) throws IOException { final HBaseFactory hbaseFactory = HBaseFactory.Provider.get(); final HBaseAdmin hbaseAdmin = hbaseFactory.getHBaseAdminFactory(fiji.getURI()).create(fiji.getConf()); final FijiMetaTable metaTable = fiji.getMetaTable(); try { HBaseMetaTable.uninstall(hbaseAdmin, fiji.getURI()); HBaseMetaTable.install(hbaseAdmin, fiji.getURI()); final Map<String, TableBackup> tables = backup.getMetaTable().getTables(); for (Map.Entry<String, TableBackup> layoutEntry : tables.entrySet()) { final String tableName = layoutEntry.getKey(); LOG.debug("Found table backup entry for " + tableName); final TableBackup tableBackup = layoutEntry.getValue(); restoreTable(tableName, tableBackup, metaTable, fiji); } } finally { ResourceUtils.closeOrLog(hbaseAdmin); } }
/** * Restores all SchemaTable entries from the metadata backup. * * @param backup the deserialized backup of the metadata. * @param fiji the connected Fiji instance. * @throws java.io.IOException if there is an error communicating with HBase. */ public void restoreSchemas(MetadataBackup backup, Fiji fiji) throws IOException { // Restore all Schema table entries in the file. final FijiSchemaTable schemaTable = fiji.getSchemaTable(); LOG.info("Restoring schema table entries..."); schemaTable.fromBackup(backup.getSchemaTable()); LOG.info("Restored " + backup.getSchemaTable().getEntries().size() + " entries."); }
/** * Restores all SystemTable entries from the backup. * * @param backup the deserialized backup of the metadata. * @param fiji the connected Fiji instance. * @throws java.io.IOException if there is an error communicating with HBase. */ public void restoreSystemVars(MetadataBackup backup, Fiji fiji) throws IOException { // Restore all System table entries from the file. final FijiSystemTable systemTable = fiji.getSystemTable(); LOG.info("Restoring system table entries..."); systemTable.fromBackup(backup.getSystemTable()); LOG.info(String.format("Restored %d entries.", backup.getSystemTable().getEntries().size())); } }