opends/src/server/org/opends/server/replication/protocol/AddMsg.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; @@ -166,9 +166,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public AddOperation createOperation( InternalClientConnection connection, DN newDN) @@ -189,9 +187,7 @@ // Msg encoding // ============ /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V1() throws UnsupportedEncodingException { @@ -225,9 +221,7 @@ return resultByteArray; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V23() throws UnsupportedEncodingException { @@ -266,9 +260,7 @@ return resultByteArray; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V45(short reqProtocolVersion) throws UnsupportedEncodingException @@ -334,31 +326,11 @@ builder.add(AttributeValues.create(ByteString.valueOf(s), ByteString.valueOf(toLowerCase(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)) if (!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) { @@ -369,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, @@ -483,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 +548,7 @@ return parentEntryUUID; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int size() { opends/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() { opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.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; @@ -154,9 +154,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public ModifyDNOperation createOperation(InternalClientConnection connection, DN newDN) throws LDAPException, ASN1Exception @@ -184,9 +182,7 @@ // Msg Encoding // ============ /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V1() throws UnsupportedEncodingException { @@ -243,10 +239,7 @@ return encodedMsg; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V23() throws UnsupportedEncodingException { @@ -318,9 +311,7 @@ return encodedMsg; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V45(short reqProtocolVersion) throws UnsupportedEncodingException @@ -538,37 +529,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 + "!!!"; } @@ -669,16 +648,12 @@ */ private DN computeNewDN() throws DirectoryException { if (newSuperior == null) if (newSuperior != null) { DN parentDn = getDN().getParent(); return parentDn.concat(RDN.decode(newRDN)); return DN.decode(newRDN + "," + newSuperior); } else { String newStringDN = newRDN + "," + newSuperior; return DN.decode(newStringDN); } final DN parentDN = getDN().getParent(); return parentDN.concat(RDN.decode(newRDN)); } /** @@ -749,9 +724,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int size() { opends/src/server/org/opends/server/replication/protocol/ModifyMsg.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; @@ -121,9 +121,7 @@ return msg; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public ModifyOperation createOperation(InternalClientConnection connection, DN newDN) throws LDAPException, ASN1Exception, DataFormatException @@ -142,43 +140,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() { @@ -192,9 +176,7 @@ // Msg Encoding // ============ /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V1() throws UnsupportedEncodingException { @@ -209,9 +191,7 @@ return encodedMsg; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V23() throws UnsupportedEncodingException { @@ -228,9 +208,7 @@ return encodedMsg; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public byte[] getBytes_V45(short reqProtocolVersion) throws UnsupportedEncodingException opends/src/server/org/opends/server/replication/server/changelog/je/ChangeNumberIndexer.java
@@ -204,9 +204,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); } @@ -237,8 +237,8 @@ */ public void replicaOffline(DN baseDN, CSN offlineCSN) { lastAliveCSNs.update(baseDN, offlineCSN); replicasOffline.update(baseDN, offlineCSN); lastAliveCSNs.update(baseDN, offlineCSN); tryNotify(baseDN); }