@Override public void afterOperation(ILSMIOOperation operation) throws HyracksDataException { if (operation.getStatus() == LSMIOOperationStatus.FAILURE) { return; } if (operation.getIOOpertionType() == LSMIOOperationType.LOAD) { Map<String, Object> map = operation.getParameters(); putComponentIdIntoMetadata(operation.getNewComponent(), (LSMComponentId) map.get(KEY_FLUSHED_COMPONENT_ID)); } else if (operation.getIOOpertionType() == LSMIOOperationType.FLUSH) { Map<String, Object> map = operation.getParameters(); putLSNIntoMetadata(operation.getNewComponent(), (Long) map.get(KEY_FLUSH_LOG_LSN)); putComponentIdIntoMetadata(operation.getNewComponent(), ((FlushOperation) operation).getFlushingComponent().getId()); } else if (operation.getIOOpertionType() == LSMIOOperationType.MERGE) { List<ILSMDiskComponent> mergedComponents = operation.getAccessor().getOpContext().getComponentsToBeMerged(); putLSNIntoMetadata(operation.getNewComponent(), mergedComponents); putComponentIdIntoMetadata(operation.getNewComponent(), mergedComponents); LongPointable markerLsn = LongPointable.FACTORY.createPointable(ComponentUtils.getLong(mergedComponents.get(0).getMetadata(), ComponentUtils.MARKER_LSN_KEY, ComponentUtils.NOT_FOUND, buffer)); operation.getNewComponent().getMetadata().put(ComponentUtils.MARKER_LSN_KEY, markerLsn); } }
frame.setPage(page); frame.init(); LongPointable longPointable = (LongPointable) LongPointable.FACTORY.createPointable(); frame.get(testKey, longPointable); Assert.assertNull(longPointable.getByteArray());
private void putLSNIntoMetadata(ILSMDiskComponent newComponent, long lsn) throws HyracksDataException { newComponent.getMetadata().put(KEY_METADATA_FLUSH_LOG_LSN, LongPointable.FACTORY.createPointable(lsn)); }
public static void persist(ILSMComponentId id, IComponentMetadata metadata) throws HyracksDataException { LSMComponentId componentId = (LSMComponentId) id; metadata.put(COMPONENT_ID_MIN_KEY, LongPointable.FACTORY.createPointable(componentId.getMinId())); metadata.put(COMPONENT_ID_MAX_KEY, LongPointable.FACTORY.createPointable(componentId.getMaxId())); }