Search in sources :

Example 1 with ReadOnlyLogMetadata

use of io.pravega.segmentstore.storage.ReadOnlyLogMetadata in project pravega by pravega.

the class DebugBookKeeperLogWrapper method forceMetadataOverWrite.

/**
 * Allows to overwrite the metadata of a BookkeeperLog. CAUTION: This is a destructive operation and should be
 * used wisely for administration purposes (e.g., repair a damaged BookkeeperLog).
 *
 * @param metadata New metadata to set in the original BookkeeperLog metadata path.
 * @throws DurableDataLogException in case there is a problem managing metadata from Zookeeper.
 */
@Override
public void forceMetadataOverWrite(ReadOnlyLogMetadata metadata) throws DurableDataLogException {
    try {
        byte[] serializedMetadata = LogMetadata.SERIALIZER.serialize((LogMetadata) metadata).getCopy();
        this.log.getZkClient().setData().forPath(this.log.getLogNodePath(), serializedMetadata);
    } catch (Exception e) {
        throw new DurableDataLogException("Problem overwriting Bookkeeper Log metadata.", e);
    }
}
Also used : DurableDataLogException(io.pravega.segmentstore.storage.DurableDataLogException) ReadOnlyLogMetadata(io.pravega.segmentstore.storage.ReadOnlyLogMetadata) DataLogInitializationException(io.pravega.segmentstore.storage.DataLogInitializationException) DurableDataLogException(io.pravega.segmentstore.storage.DurableDataLogException)

Aggregations

DataLogInitializationException (io.pravega.segmentstore.storage.DataLogInitializationException)1 DurableDataLogException (io.pravega.segmentstore.storage.DurableDataLogException)1 ReadOnlyLogMetadata (io.pravega.segmentstore.storage.ReadOnlyLogMetadata)1