@Override public HCatEventMessage checkValid() { if (getTable() == null) throw new IllegalStateException("Table name unset."); if (getPartitions() == null) throw new IllegalStateException("Partition-list unset."); return super.checkValid(); } }
@Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ExportCommand( addPartitionMessage.getDB(), addPartitionMessage.getTable(), ptnDesc, srcStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } });
public Iterable<? extends Command> getDstWhCommands() { verifyActionable(); if (addPartitionMessage.getPartitions().isEmpty()){ return Collections.singletonList(new NoopCommand(event.getEventId())); } final String dstDbName = ReplicationUtils.mapIfMapAvailable(addPartitionMessage.getDB(), dbNameMapping); final String dstTableName = ReplicationUtils.mapIfMapAvailable(addPartitionMessage.getTable(), tableNameMapping); return Iterables.transform(addPartitionMessage.getPartitions(), new Function<Map<String, String>, Command>() { @Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ImportCommand( dstDbName, dstTableName, ptnDesc, dstStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), // Note - important to retain the same key as the export addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } }); } }
@Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ImportCommand( dstDbName, dstTableName, ptnDesc, dstStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), // Note - important to retain the same key as the export addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } });
@Override public HCatEventMessage checkValid() { if (getTable() == null) throw new IllegalStateException("Table name unset."); if (getPartitions() == null) throw new IllegalStateException("Partition-list unset."); return super.checkValid(); } }
@Override public HCatEventMessage checkValid() { if (getTable() == null) throw new IllegalStateException("Table name unset."); if (getPartitions() == null) throw new IllegalStateException("Partition-list unset."); return super.checkValid(); } }
@Override public HCatEventMessage checkValid() { if (getTable() == null) throw new IllegalStateException("Table name unset."); if (getPartitions() == null) throw new IllegalStateException("Partition-list unset."); return super.checkValid(); } }
@Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ExportCommand( addPartitionMessage.getDB(), addPartitionMessage.getTable(), ptnDesc, srcStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } });
@Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ExportCommand( addPartitionMessage.getDB(), addPartitionMessage.getTable(), ptnDesc, srcStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } });
@Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ExportCommand( addPartitionMessage.getDB(), addPartitionMessage.getTable(), ptnDesc, srcStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } });
public Iterable<? extends Command> getDstWhCommands() { verifyActionable(); if (addPartitionMessage.getPartitions().isEmpty()){ return Collections.singletonList(new NoopCommand(event.getEventId())); } final String dstDbName = ReplicationUtils.mapIfMapAvailable(addPartitionMessage.getDB(), dbNameMapping); final String dstTableName = ReplicationUtils.mapIfMapAvailable(addPartitionMessage.getTable(), tableNameMapping); return Iterables.transform(addPartitionMessage.getPartitions(), new Function<Map<String, String>, Command>() { @Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ImportCommand( dstDbName, dstTableName, ptnDesc, dstStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), // Note - important to retain the same key as the export addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } }); } }
public Iterable<? extends Command> getDstWhCommands() { verifyActionable(); if (addPartitionMessage.getPartitions().isEmpty()){ return Collections.singletonList(new NoopCommand(event.getEventId())); } final String dstDbName = ReplicationUtils.mapIfMapAvailable(addPartitionMessage.getDB(), dbNameMapping); final String dstTableName = ReplicationUtils.mapIfMapAvailable(addPartitionMessage.getTable(), tableNameMapping); return Iterables.transform(addPartitionMessage.getPartitions(), new Function<Map<String, String>, Command>() { @Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ImportCommand( dstDbName, dstTableName, ptnDesc, dstStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), // Note - important to retain the same key as the export addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } }); } }
public Iterable<? extends Command> getDstWhCommands() { verifyActionable(); if (addPartitionMessage.getPartitions().isEmpty()){ return Collections.singletonList(new NoopCommand(event.getEventId())); } final String dstDbName = ReplicationUtils.mapIfMapAvailable(addPartitionMessage.getDB(), dbNameMapping); final String dstTableName = ReplicationUtils.mapIfMapAvailable(addPartitionMessage.getTable(), tableNameMapping); return Iterables.transform(addPartitionMessage.getPartitions(), new Function<Map<String, String>, Command>() { @Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ImportCommand( dstDbName, dstTableName, ptnDesc, dstStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), // Note - important to retain the same key as the export addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } }); } }
@Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ImportCommand( dstDbName, dstTableName, ptnDesc, dstStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), // Note - important to retain the same key as the export addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } });
@Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ImportCommand( dstDbName, dstTableName, ptnDesc, dstStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), // Note - important to retain the same key as the export addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } });
@Override public Command apply(@Nullable Map<String, String> ptnDesc) { return new ImportCommand( dstDbName, dstTableName, ptnDesc, dstStagingDirProvider.getStagingDirectory( ReplicationUtils.getUniqueKey( getEvent().getEventId(), addPartitionMessage.getDB(), // Note - important to retain the same key as the export addPartitionMessage.getTable(), ptnDesc) ), false, event.getEventId() ); } });
/** * Process JMS message produced by HCat. * * @param msg : to be processed */ @Override public void process(Message msg) { try { HCatEventMessage hcatMsg = MessagingUtils.getMessage(msg); if (hcatMsg.getEventType().equals(HCatEventMessage.EventType.ADD_PARTITION)) { // Parse msg components AddPartitionMessage partMsg = (AddPartitionMessage) hcatMsg; String db = partMsg.getDB(); String table = partMsg.getTable(); LOG.info("Partition available event: db [{0}] table [{1}] partitions [{2}]", db, table, partMsg.getPartitions()); List<Map<String, String>> partitions = partMsg.getPartitions(); for (int i = 0; i < partitions.size(); i++) { pdmService.partitionAvailable(this.server, db, table, partitions.get(i)); } } else { LOG.debug("Ignoring message of event type [{0}] ", hcatMsg.getEventType()); } } catch (Exception e) { LOG.warn("Error processing JMS message", e); } }
/** * Process JMS message produced by HCat. * * @param msg : to be processed */ @Override public void process(Message msg) { try { HCatEventMessage hcatMsg = MessagingUtils.getMessage(msg); if (hcatMsg.getEventType().equals(HCatEventMessage.EventType.ADD_PARTITION)) { // Parse msg components AddPartitionMessage partMsg = (AddPartitionMessage) hcatMsg; String db = partMsg.getDB(); String table = partMsg.getTable(); LOG.info("Partition available event: db [{0}] table [{1}] partitions [{2}]", db, table, partMsg.getPartitions()); List<Map<String, String>> partitions = partMsg.getPartitions(); for (int i = 0; i < partitions.size(); i++) { pdmService.partitionAvailable(this.server, db, table, partitions.get(i)); } } else { LOG.debug("Ignoring message of event type [{0}] ", hcatMsg.getEventType()); } } catch (Exception e) { LOG.warn("Error processing JMS message", e); } }