| | |
| | | import org.opends.server.replication.server.changelog.je.ReplicationDB.*; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | |
| | | private CSN firstChange; |
| | | private CSN lastChange; |
| | | private int serverId; |
| | | private String baseDn; |
| | | private DN baseDN; |
| | | private DbMonitorProvider dbMonitor = new DbMonitorProvider(); |
| | | private DirectoryThread thread; |
| | | private final Object flushLock = new Object(); |
| | |
| | | * Creates a new dbHandler associated to a given LDAP server. |
| | | * |
| | | * @param id Identifier of the DB. |
| | | * @param baseDn the baseDn for which this DB was created. |
| | | * @param baseDN the baseDN for which this DB was created. |
| | | * @param replicationServer The ReplicationServer that creates this dbHandler. |
| | | * @param dbenv the Database Env to use to create the ReplicationServer DB. |
| | | * server for this domain. |
| | | * @param queueSize The queueSize to use when creating the dbHandler. |
| | | * @throws ChangelogException If a database problem happened |
| | | */ |
| | | public DbHandler( |
| | | int id, String baseDn, ReplicationServer replicationServer, |
| | | ReplicationDbEnv dbenv, int queueSize) |
| | | throws ChangelogException |
| | | public DbHandler(int id, DN baseDN, ReplicationServer replicationServer, |
| | | ReplicationDbEnv dbenv, int queueSize) throws ChangelogException |
| | | { |
| | | this.replicationServer = replicationServer; |
| | | serverId = id; |
| | | this.baseDn = baseDn; |
| | | this.baseDN = baseDN; |
| | | trimAge = replicationServer.getTrimAge(); |
| | | queueMaxSize = queueSize; |
| | | queueLowmark = queueSize / 5; |
| | |
| | | queueMaxBytes = 200 * queueMaxSize; |
| | | queueLowmarkBytes = 200 * queueLowmark; |
| | | queueHimarkBytes = 200 * queueLowmark; |
| | | db = new ReplicationDB(id, baseDn, replicationServer, dbenv); |
| | | db = new ReplicationDB(id, baseDN, replicationServer, dbenv); |
| | | firstChange = db.readFirstChange(); |
| | | lastChange = db.readLastChange(); |
| | | thread = new DirectoryThread(this, "Replication server RS(" |
| | | + replicationServer.getServerId() |
| | | + ") changelog checkpointer for Replica DS(" + id |
| | | + ") for domain \"" + baseDn + "\""); |
| | | + ") for domain \"" + baseDN + "\""); |
| | | thread.start(); |
| | | |
| | | DirectoryServer.deregisterMonitorProvider(dbMonitor); |
| | |
| | | List<Attribute> attributes = new ArrayList<Attribute>(); |
| | | attributes.add(Attributes.create("replicationServer-database", |
| | | String.valueOf(serverId))); |
| | | attributes.add(Attributes.create("domain-name", baseDn)); |
| | | attributes.add(Attributes.create("domain-name", |
| | | baseDN.toNormalizedString())); |
| | | if (firstChange != null) |
| | | { |
| | | attributes.add(Attributes.create("first-change", encode(firstChange))); |
| | |
| | | public String getMonitorInstanceName() |
| | | { |
| | | ReplicationServerDomain domain = replicationServer |
| | | .getReplicationServerDomain(baseDn); |
| | | .getReplicationServerDomain(baseDN); |
| | | return "Changelog for DS(" + serverId + "),cn=" |
| | | + domain.getMonitorInstanceName(); |
| | | } |
| | |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return baseDn + " " + serverId + " " + firstChange + " " + lastChange; |
| | | return baseDN + " " + serverId + " " + firstChange + " " + lastChange; |
| | | } |
| | | |
| | | /** |