{
// Bootstrapping bootstrap Producer not yet supported !!
String msg = "Bootstrap Producer starting from non-online consumption mode for sources :"
+ sourceNames + ", Ckpt :" + cp;
LOG.error(msg);
throw new BootstrapDBException(msg);
}
else
{
String msg = null;
if (((cp.getWindowScn() > scn) && (scn > -1))
|| ((cp.getWindowScn() < scn) && (scn > -1)))
{
if (((cp.getWindowScn() > scn) && (scn > -1)))
LOG.warn("Non-Empty checkpint. Bootstrap Producer is at SCN:"
+ scn
+ ", while checkpoint is :"
+ cp
+ ", Could result in gap in event consumption. Repairing ckpt !!");
else
LOG.info("Non-Empty checkpoint. Bootstrap Producer is at SCN:"
+ scn + ", while checkpoint is :" + cp
+ ", Copying producer Scn to checkpoint !!");
cp.setWindowScn(scn);
cp.setWindowOffset(-1);
try
{
provider.removeCheckpoint(sourceNames);
provider.storeCheckpoint(sourceNames, cp);
// Check if persisted properly
cp = provider.loadCheckpoint(sourceNames);
if ((null == cp)
|| (cp.getWindowScn() != scn)
|| (cp.getWindowOffset() != -1)
|| (cp.getConsumptionMode() != DbusClientMode.ONLINE_CONSUMPTION))
{
msg = "Unable to repair and store the new checkpoint (" + cp
+ ") to make it same as producer SCN (" + scn + ") !!";
LOG.fatal(msg);
throw new BootstrapDBException(msg);
}
} catch (IOException ex)
{
msg = "Unable to repair and store the new checkpoint (" + cp
+ ") to make it same as producer SCN (" + scn + ") !!";
LOG.fatal(msg, ex);
throw new BootstrapDBException(msg);
}
}
}
}
else
{
/**
* Currently since bootstrapping is not available, a null ckpt would
* result in flexible checkpoint and could result in gap !!
*/
if (scn > -1)
{
String msg = "Empty checkpoint. Bootstrap Producer SCN is at SCN:"
+ scn
+ ", while checkpoint is null !! Could result in gap in event consumption. Repairing ckpt !!";
LOG.warn(msg);
cp = new Checkpoint();
cp.setWindowScn(scn);
cp.setWindowOffset(-1);
cp.setConsumptionMode(DbusClientMode.ONLINE_CONSUMPTION);
try
{
provider.removeCheckpoint(sourceNames);
provider.storeCheckpoint(sourceNames, cp);
// Check if persisted properly
cp = provider.loadCheckpoint(sourceNames);
if ((null == cp)
|| (cp.getWindowScn() != scn)
|| (cp.getWindowOffset() != -1)
|| (cp.getConsumptionMode() != DbusClientMode.ONLINE_CONSUMPTION))
{
LOG.fatal("Unable to repair and store the checkpoint (" + cp
+ ") to make it same as producer SCN (" + scn + ") !!");
throw new BootstrapDBException(msg);
}
} catch (IOException ex)
{
msg = "Unable to repair and store the checkpoint (" + cp
+ ") to make it same as producer SCN (" + scn + ") !!";
LOG.fatal(msg, ex);
throw new BootstrapDBException(msg);
}
}
}
}
LOG.info("Validating bootstrap DB checkpoints done successfully!!");