opendj3-server-dev/src/server/org/opends/server/replication/protocol/AddMsg.java
@@ -167,9 +167,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public AddOperation createOperation( InternalClientConnection connection, DN newDN) @@ -190,9 +188,7 @@ // Msg encoding // ============ /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V1() throws UnsupportedEncodingException { @@ -226,9 +222,7 @@ return resultByteArray; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V23() throws UnsupportedEncodingException { @@ -267,9 +261,7 @@ return resultByteArray; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V45(short reqProtocolVersion) throws UnsupportedEncodingException @@ -334,32 +326,11 @@ { builder.add(s); } Attribute attr = builder.toAttribute(); new LDAPAttribute(builder.toAttribute()).write(writer); new LDAPAttribute(attr).write(writer); // Encode the user attributes (AttributeList). for (List<Attribute> list : userAttributes.values()) { for (Attribute a : list) { if (!EntryHistorical.isHistoricalAttribute(a) && !a.isVirtual()) { new LDAPAttribute(a).write(writer); } } } // Encode the operational attributes (AttributeList). for (List<Attribute> list : operationalAttributes.values()) { for (Attribute a : list) { if (!EntryHistorical.isHistoricalAttribute(a)) if (!a.isVirtual()) new LDAPAttribute(a).write(writer); } } // Encode the user and operational attributes (AttributeList). encodeAttributes(userAttributes, writer); encodeAttributes(operationalAttributes, writer); } catch(Exception e) { @@ -370,6 +341,21 @@ return byteBuilder.toByteArray(); } private void encodeAttributes(Map<AttributeType, List<Attribute>> attributes, ASN1Writer writer) throws Exception { for (List<Attribute> list : attributes.values()) { for (Attribute a : list) { if (!a.isVirtual() && !EntryHistorical.isHistoricalAttribute(a)) { new LDAPAttribute(a).write(writer); } } } } private byte[] encodeAttributes( Attribute objectClass, Collection<Attribute> userAttributes, @@ -484,31 +470,22 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public String toString() { if (protocolVersion == ProtocolVersion.REPLICATION_PROTOCOL_V1) if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V1) { return "AddMsg content: " + " protocolVersion: " + protocolVersion + " dn: " + dn + " changeNumber: " + csn + " uniqueId: " + entryUUID + " assuredFlag: " + assuredFlag; } if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2) { return "AddMsg content: " + " protocolVersion: " + protocolVersion + " dn: " + dn + " changeNumber: " + csn + " csn: " + csn + " uniqueId: " + entryUUID + " assuredFlag: " + assuredFlag + " assuredMode: " + assuredMode + " safeDataLevel: " + safeDataLevel; (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2 ? " assuredMode: " + assuredMode + " safeDataLevel: " + safeDataLevel : ""); } return "!!! Unknown version: " + protocolVersion + "!!!"; } @@ -570,9 +547,7 @@ return parentEntryUUID; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int size() { opendj3-server-dev/src/server/org/opends/server/replication/protocol/DeleteMsg.java
@@ -22,7 +22,7 @@ * * * Copyright 2006-2010 Sun Microsystems, Inc. * Portions Copyright 2011-2013 ForgeRock AS * Portions Copyright 2011-2014 ForgeRock AS */ package org.opends.server.replication.protocol; @@ -105,10 +105,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public DeleteOperation createOperation(InternalClientConnection connection, DN newDN) @@ -129,18 +126,14 @@ // Msg encoding // ============ /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V1() throws UnsupportedEncodingException { return encodeHeader_V1(MSG_TYPE_DELETE_V1, 0); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V23() throws UnsupportedEncodingException { @@ -148,9 +141,7 @@ ProtocolVersion.REPLICATION_PROTOCOL_V3); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V45(short reqProtocolVersion) throws UnsupportedEncodingException @@ -187,7 +178,7 @@ pos = addByteArray(byteEntryAttrLen, encodedMsg, pos); pos = addByteArray(encodedEclIncludes, encodedMsg, pos); encodedMsg[pos++] = (isSubtreeDelete ? (byte) 1 : (byte) 0); encodedMsg[pos++] = (byte) (isSubtreeDelete ? 1 : 0); return encodedMsg; } @@ -241,38 +232,27 @@ } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public String toString() { if (protocolVersion == ProtocolVersion.REPLICATION_PROTOCOL_V1) if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V1) { return "DeleteMsg content: " + " protocolVersion: " + protocolVersion + " dn: " + dn + " changeNumber: " + csn + " uniqueId: " + entryUUID + " assuredFlag: " + assuredFlag; } if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2) { return "DeleteMsg content: " + " protocolVersion: " + protocolVersion + " dn: " + dn + " changeNumber: " + csn + " csn: " + csn + " uniqueId: " + entryUUID + " assuredFlag: " + assuredFlag + " assuredMode: " + assuredMode + " safeDataLevel: " + safeDataLevel; (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2 ? " assuredMode: " + assuredMode + " safeDataLevel: " + safeDataLevel : ""); } return "!!! Unknown version: " + protocolVersion + "!!!"; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int size() { opendj3-server-dev/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
@@ -155,9 +155,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public ModifyDNOperation createOperation(InternalClientConnection connection, DN newDN) throws LDAPException, IOException @@ -185,9 +183,7 @@ // Msg Encoding // ============ /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V1() throws UnsupportedEncodingException { @@ -244,10 +240,7 @@ return encodedMsg; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V23() throws UnsupportedEncodingException { @@ -319,9 +312,7 @@ return encodedMsg; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V45(short reqProtocolVersion) throws UnsupportedEncodingException @@ -539,37 +530,25 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public String toString() { if (protocolVersion == ProtocolVersion.REPLICATION_PROTOCOL_V1) if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V1) { return "ModifyDNMsg content: " + " protocolVersion: " + protocolVersion + " dn: " + dn + " changeNumber: " + csn + " uniqueId: " + entryUUID + " assuredFlag: " + assuredFlag + " newRDN: " + newRDN + " newSuperior: " + newSuperior + " deleteOldRdn: " + deleteOldRdn; } if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2) { return "ModifyDNMsg content: " + " protocolVersion: " + protocolVersion + " dn: " + dn + " changeNumber: " + csn + " csn: " + csn + " uniqueId: " + entryUUID + " newRDN: " + newRDN + " newSuperior: " + newSuperior + " deleteOldRdn: " + deleteOldRdn + " assuredFlag: " + assuredFlag + " assuredMode: " + assuredMode + " safeDataLevel: " + safeDataLevel; (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2 ? " assuredMode: " + assuredMode + " safeDataLevel: " + safeDataLevel : ""); } return "!!! Unknown version: " + protocolVersion + "!!!"; } @@ -670,16 +649,12 @@ */ private DN computeNewDN() throws DirectoryException { if (newSuperior == null) if (newSuperior != null) { DN parentDn = getDN().parent(); return parentDn.child(RDN.decode(newRDN)); return DN.valueOf(newRDN + "," + newSuperior); } else { String newStringDN = newRDN + "," + newSuperior; return DN.valueOf(newStringDN); } final DN parentDn = getDN().parent(); return parentDn.child(RDN.decode(newRDN)); } /** @@ -750,9 +725,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int size() { opendj3-server-dev/src/server/org/opends/server/replication/protocol/ModifyMsg.java
@@ -122,9 +122,7 @@ return msg; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public ModifyOperation createOperation(InternalClientConnection connection, DN newDN) throws LDAPException, IOException, DataFormatException @@ -143,43 +141,29 @@ return mod; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public String toString() { if (protocolVersion == ProtocolVersion.REPLICATION_PROTOCOL_V1) if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V1) { return "ModifyMsg content: " + " protocolVersion: " + protocolVersion + " dn: " + dn + " changeNumber: " + csn + " uniqueId: " + entryUUID + " assuredFlag: " + assuredFlag; } if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2) { return "ModifyMsg content: " + " protocolVersion: " + protocolVersion + " dn: " + dn + " changeNumber: " + csn + " csn: " + csn + " uniqueId: " + entryUUID + " assuredFlag: " + assuredFlag + " assuredMode: " + assuredMode + " safeDataLevel: " + safeDataLevel + " size: " + encodedMods.length; (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2 ? " assuredMode: " + assuredMode + " safeDataLevel: " + safeDataLevel + " size: " + encodedMods.length : ""); /* Do not append mods, they can be too long */ } return "!!! Unknown version: " + protocolVersion + "!!!"; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int size() { @@ -193,9 +177,7 @@ // Msg Encoding // ============ /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V1() throws UnsupportedEncodingException { @@ -210,9 +192,7 @@ return encodedMsg; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V23() throws UnsupportedEncodingException { @@ -229,9 +209,7 @@ return encodedMsg; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V45(short reqProtocolVersion) throws UnsupportedEncodingException opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ChangeNumberIndexer.java
@@ -202,9 +202,9 @@ } final CSN csn = updateMsg.getCSN(); lastAliveCSNs.update(baseDN, csn); // only keep the oldest CSN that will be the new cursor's starting point newCursors.putIfAbsent(Pair.of(baseDN, csn.getServerId()), csn); lastAliveCSNs.update(baseDN, csn); tryNotify(baseDN); } @@ -235,8 +235,8 @@ */ public void replicaOffline(DN baseDN, CSN offlineCSN) { lastAliveCSNs.update(baseDN, offlineCSN); replicasOffline.update(baseDN, offlineCSN); lastAliveCSNs.update(baseDN, offlineCSN); tryNotify(baseDN); }