/** * Writes the new layout to ZooKeeper. * * <p> This pushes a layout update to all table users. </p> * * @param update Layout update to push to ZooKeeper. * * @throws java.io.IOException on I/O error. * @throws org.apache.zookeeper.KeeperException on ZooKeeper error. */ private void writeZooKeeper(TableLayoutDesc update) throws IOException, KeeperException { LOG.info("Updating layout for table {} from layout ID {} to layout ID {} in ZooKeeper.", mTableURI, update.getReferenceLayout(), update.getLayoutId()); ZooKeeperUtils.setTableLayout(mZKClient, mTableURI, update.getLayoutId()); }
/** {@inheritDoc} */ @Override public String toString() { return Objects.toStringHelper(CassandraFijiTable.class) .add("id", System.identityHashCode(this)) .add("uri", mTableURI) .add("retain_counter", mRetainCount.get()) .add("layout_id", getLayout().getDesc().getLayoutId()) .add("state", mState.get()) .toString(); }
/** * Writes the new layout to ZooKeeper. * * <p> This pushes a layout update to all table users. </p> * * @param update Layout update to push to ZooKeeper. * * @throws IOException on I/O error. * @throws KeeperException on ZooKeeper error. */ private void writeZooKeeper(TableLayoutDesc update) throws IOException, KeeperException { LOG.info("Updating layout for table {} from layout ID {} to layout ID {} in ZooKeeper.", mTableURI, update.getReferenceLayout(), update.getLayoutId()); ZooKeeperUtils.setTableLayout(mZKClient, mTableURI, update.getLayoutId()); }
/** {@inheritDoc} */ @Override public String toString() { String layoutId = mState.get() == State.OPEN ? mLayoutMonitor.getLayout().getDesc().getLayoutId() : "unknown"; return Objects.toStringHelper(HBaseFijiTable.class) .add("id", System.identityHashCode(this)) .add("uri", mTableURI) .add("retain_counter", mRetainCount.get()) .add("layout_id", layoutId) .add("state", mState.get()) .toString(); }
/** {@inheritDoc} */ @Override public String toString() { return Objects.toStringHelper(HBaseFijiTableReader.class) .add("id", System.identityHashCode(this)) .add("table", mTable.getURI()) .add("layout-version", mReaderLayoutCapsule.getLayout().getDesc().getLayoutId()) .add("state", mState.get()) .toString(); }
/** {@inheritDoc} */ @Override public String toString() { return Objects.toStringHelper(CassandraFijiTableReader.class) .add("id", System.identityHashCode(this)) .add("table", mTable.getURI()) .add("layout-version", mReaderLayoutCapsule.getLayout().getDesc().getLayoutId()) .add("state", mState.get()) .toString(); }
/** {@inheritDoc} */ @Override public String toString() { return Objects.toStringHelper(HBaseFijiTableWriter.class) .add("id", System.identityHashCode(this)) .add("table", mTable.getURI()) .add("layout-version", mWriterLayoutCapsule.getLayout().getDesc().getLayoutId()) .add("state", mState) .toString(); } }
/** * Writes the new table layout to the meta-table. * * @param update Layout update to write to the meta-table. * @throws java.io.IOException on I/O error. */ private void writeMetaTable(TableLayoutDesc update) throws IOException { LOG.info("Updating layout for table {} from layout ID {} to layout ID {} in meta-table.", mTableURI, update.getReferenceLayout(), update.getLayoutId()); final String table = update.getName(); mNewLayout = mFiji.getMetaTable().updateTableLayout(table, update); }
/** * Writes the new table layout to the meta-table. * * @param update Layout update to write to the meta-table. * @throws IOException on I/O error. */ private void writeMetaTable(TableLayoutDesc update) throws IOException { LOG.info("Updating layout for table {} from layout ID {} to layout ID {} in meta-table.", mTableURI, update.getReferenceLayout(), update.getLayoutId()); final String table = update.getName(); mNewLayout = mFiji.getMetaTable().updateTableLayout(table, update); }
this, mTable.getURI(), mReaderLayoutCapsule.getLayout().getDesc().getLayoutId(), layout.getDesc().getLayoutId()); } else { this, mTable.getURI(), layout.getDesc().getLayoutId());
this, mTable.getURI(), mWriterLayoutCapsule.getLayout().getDesc().getLayoutId(), layout.getDesc().getLayoutId()); } else { LOG.debug("Initializing FijiTableWriter: {} for table: {} with table layout version: {}", this, mTable.getURI(), layout.getDesc().getLayoutId());
"Updating table writer layout capsule for table '{}' from layout version {} to {}.", tableURI, mCapsule.getLayout().getDesc().getLayoutId(), layout.getDesc().getLayoutId()); } else { LOG.debug( "Initializing table writer layout capsule for table '{}' with layout version {}.", tableURI, layout.getDesc().getLayoutId());
this, mTable.getURI(), mWriterLayoutCapsule.getLayout().getDesc().getLayoutId(), layout.getDesc().getLayoutId()); } else { LOG.debug("Initializing AtomicFijiPutter: {} for table: {} with table layout version: {}", this, mTable.getURI(), layout.getDesc().getLayoutId());
/** {@inheritDoc} */ @Override public TableLayoutDesc apply(final FijiTableLayout refLayout) { Preconditions.checkNotNull(refLayout); try { final TableLayoutDesc refDesc = refLayout.getDesc(); return new TableLayoutBuilder(refDesc, fiji) .withLayoutId(nextLayoutId(refDesc.getLayoutId())) .withWriter(column, writerSchema) .withWritten(column, writerSchema) .build(); } catch (InvalidLayoutException ile) { LOG.error("Internal error while updating table layout in DEVELOPER mode: {}", ile); throw new InternalFijiError(ile); } catch (IOException ioe) { LOG.error("I/O error while updating table layout in DEVELOPER mode: {}", ioe); throw new FijiIOException(ioe); } } };
this, mTable.getURI(), mCapsule.getLayout().getDesc().getLayoutId(), layout.getDesc().getLayoutId()); } else { LOG.debug( this, mTable.getURI(), layout.getDesc().getLayoutId());
this, mTable.getURI(), mReaderLayoutCapsule.getLayout().getDesc().getLayoutId(), layout.getDesc().getLayoutId()); } else { this, mTable.getURI(), layout.getDesc().getLayoutId());
this, mTable.getURI(), mWriterLayoutCapsule.getLayout().getDesc().getLayoutId(), layout.getDesc().getLayoutId()); } else { LOG.debug( this, mTable.getURI(), layout.getDesc().getLayoutId());
/** * Install the job history table into a Fiji instance. This should be called only * via open, because we might want to update the layout of the job history table. * * @param fiji The Fiji instance to install this table in. * @throws IOException If there is an error. */ private static void install(Fiji fiji) throws IOException { if (!fiji.getTableNames().contains(TABLE_NAME)) { // Try to install the job history table if necessary. fiji.createTable( FijiTableLayout.createFromEffectiveJsonResource(TABLE_LAYOUT_RESOURCE).getDesc()); } // At this point, we either have an existing table or we just installed a new // one. Check if the table is using the old layout, and update it if it is. if (fiji.getMetaTable().getTableLayout(TABLE_NAME).getDesc().getLayoutId() .equals(PREV_TABLE_LAYOUT_VERSION)) { FijiTableLayout ktl = FijiTableLayout .createFromEffectiveJsonResource(TABLE_LAYOUT_V2); fiji.modifyTableLayout(ktl.getDesc()); } // If there are further updates to the job history layout, they should probably be added here. }
mSchemaResolver = new SchemaTableAvroResolver(mSchemaTable); mDescBuilder = TableLayoutDesc.newBuilder(tableLayoutDesc) .setReferenceLayout(tableLayoutDesc.getLayoutId()) .setLayoutId(nextLayoutId(tableLayoutDesc.getLayoutId()));
ZooKeeperUtils.setTableLayout(mZKClient, tableURI, layout.getDesc().getLayoutId());