@Override
	protected boolean repack(boolean isAutoChange, boolean notify) {
		lock.acquire();
		try {
			checkDeleted();

			int oldLength = unionLength;
			boolean storeAlignment = (unionAlignment <= 0); // lazy upgrade for v5 adapter
			int oldAlignment = getComputedAlignment(false);

			unionLength = 0;
			for (DataTypeComponent dtc : components) {
				// TODO: compute alignment in this loop
				int length = dtc.getLength();
				if (isPackingEnabled() && dtc.isBitFieldComponent()) {
					// revise length to reflect compiler bitfield allocation rules
					length = getBitFieldAllocation((BitFieldDataType) dtc.getDataType());
				}
				unionLength = Math.max(length, unionLength);
			}

			computedAlignment = -1; // force recompute of unionAlignment
			unionAlignment = -1;
			unionAlignment = getComputedAlignment(false);

			if (isPackingEnabled()) {
				unionLength = DataOrganizationImpl.getAlignedOffset(unionAlignment, unionLength);
			}

			boolean changed = (oldLength != unionLength) || (oldAlignment != unionAlignment);

			if (changed || storeAlignment) {
				record.setIntValue(CompositeDBAdapter.COMPOSITE_LENGTH_COL, unionLength);
				record.setIntValue(CompositeDBAdapter.COMPOSITE_ALIGNMENT_COL, unionAlignment);
				try {
					compositeAdapter.updateRecord(record, changed && !isAutoChange);
				}
				catch (IOException e) {
					dataMgr.dbError(e);
				}
			}

			if (changed & notify) {
				if (oldLength != unionLength) {
					notifySizeChanged(isAutoChange);
				}
				else if (oldAlignment != unionAlignment) {
					notifyAlignmentChanged(isAutoChange);
				}
				else {
					dataMgr.dataTypeChanged(this, isAutoChange);
				}
			}
			return changed;
		}
		finally {
			lock.release();
		}
	}
Perform union member repack.
Perform lazy update of stored alignment introduced with v5 adapter.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/UnionDB.java