@Override public void after(long lsn) { pointable.setLong(lsn); try { index.getCurrentMemoryComponent().getMetadata().put(ComponentUtils.MARKER_LSN_KEY, pointable); } catch (HyracksDataException e) { throw new IllegalStateException(e); } }
private long lsnFromImmutableMemoryComponents() { List<ILSMMemoryComponent> memComponents = index.getMemoryComponents(); int numOtherMemComponents = memComponents.size() - 1; int next = index.getCurrentMemoryComponentIndex(); long lsn = ComponentUtils.NOT_FOUND; for (int i = 0; i < numOtherMemComponents; i++) { next = next - 1; if (next < 0) { next = memComponents.size() - 1; } ILSMMemoryComponent c = index.getMemoryComponents().get(next); if (c.isReadable()) { try { lsn = ComponentUtils.getLong(c.getMetadata(), ComponentUtils.MARKER_LSN_KEY, ComponentUtils.NOT_FOUND, buffer); } catch (HyracksDataException e) { // Should never happen since this is a memory component throw new IllegalStateException(e); } if (lsn != ComponentUtils.NOT_FOUND) { return lsn; } } } return lsn; }
/** * Put LSM metadata state into the index's current memory component. * * @param index, * the LSM index. * @param key, * the key for the metadata state. * @param pointable, * the value for the metadata state. * @throws HyracksDataException */ public static void put(ILSMIndex index, IValueReference key, IPointable pointable) throws HyracksDataException { // write the opTracker to ensure the component layout don't change synchronized (index.getOperationTracker()) { index.getCurrentMemoryComponent().getMetadata().put(key, pointable); } }
private long getLsn() { long lsn; try { lsn = ComponentUtils.getLong(index.getCurrentMemoryComponent().getMetadata(), ComponentUtils.MARKER_LSN_KEY, ComponentUtils.NOT_FOUND, buffer); } catch (HyracksDataException e) { // Should never happen since this is a memory component throw new IllegalStateException(e); } if (lsn == ComponentUtils.NOT_FOUND) { synchronized (index.getOperationTracker()) { // look for it in previous memory component if exists lsn = lsnFromImmutableMemoryComponents(); if (lsn == ComponentUtils.NOT_FOUND) { // look for it in disk component lsn = lsnFromDiskComponents(); } } } return lsn; }
c.getMetadata().get(key, value); if (value.getLength() != 0) {
ILSMMemoryComponent cmc = index.getCurrentMemoryComponent(); if (cmc.isReadable()) { index.getCurrentMemoryComponent().getMetadata().get(key, value);