}
if(scn == TokenState.ERRORSCN)
{
LOG.error("Unable to find scn for the given dbUpdate");
throw new DatabusException("Unable to find scn for the given dbUpdate, terminating the parser");
}
//check if the current columns state has seen any missing elements, if it has, then print the current scn associated with the dbupdate for debugging purpose
if(stateMachine.columnsState.isSeenMissingFields())
{
LOG.error("There were missing fields seen in Columns section and the corresponding scn is : " + stateMachine.tokensState.getScn());
}
Boolean isReplicated = false;
if(stateMachine.getReplicationBitConfig().getSourceType() == ReplicationBitSetterStaticConfig.SourceType.COLUMN)
isReplicated = stateMachine.columnsState.isReplicated();
else if(stateMachine.getReplicationBitConfig().getSourceType() == ReplicationBitSetterStaticConfig.SourceType.TOKEN)
isReplicated = stateMachine.tokensState.isReplicated();
else if(stateMachine.getReplicationBitConfig().getSourceType() == ReplicationBitSetterStaticConfig.SourceType.NONE)
isReplicated = false;
else
throw new DatabusException("Unknown source type specified in replicationBitConfig, expected COLUMN or TOKEN or NONE");
DBUpdateImage eventImage = new DBUpdateImage(stateMachine.columnsState.getKeyPairs(),
stateMachine.tokensState.getScn(),
stateMachine.columnsState.getGenericRecord(),
stateMachine.columnsState.getCurrentSchema(),
_opType,
isReplicated);
Integer sourceId = stateMachine.getTableToSourceId().get(_currentTable);
if(sourceId == null)
{
LOG.error("The table " + _currentTable + " does not have a sourceId, the current dbUpdate cannot be processed.");
onError(stateMachine, xmlStreamReader);
return;
}
if(getHashSet(sourceId) == null)
{
LOG.error("The hashset is empty, cannot proceed without a valid hashset");
throw new DatabusException("Error while creating hashset for storing dbUpdates");
}
//The equals method of the hashset is overridden to compare only the key, thereby ensuring the latest update on the key
if(getHashSet(sourceId) != null && getHashSet(sourceId).contains(eventImage))
getHashSet(sourceId).remove(eventImage);