[ 
https://issues.apache.org/jira/browse/FLUME-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479406#comment-13479406
 ] 

Brock Noland commented on FLUME-1658:
-------------------------------------

One way to solve this would be to generate a hash, say SHA-1, with a salt, and 
store that in the log file meta data. That way we could detect if the key we 
are trying to use to decrypt is the same key used to encrypt.
                
> FileChannel file channel prints bad error message if encryption key has 
> changed
> -------------------------------------------------------------------------------
>
>                 Key: FLUME-1658
>                 URL: https://issues.apache.org/jira/browse/FLUME-1658
>             Project: Flume
>          Issue Type: Improvement
>            Reporter: Brock Noland
>
> Currently we store a "key alias" which identifies the key used to encrypt a 
> file. However, if a user accidentally regenerates a key with the same key 
> alias, the error message is quite bad, since we have no way to detect if the 
> key has changed.
> {code}
> java.io.IOException: Unable to read next Transaction from log file 
> /private/tmp/flume/data1-1/log-1 at offset 0 
> at 
> org.apache.flume.channel.file.LogFile$SequentialReader.next(LogFile.java:456) 
> at 
> org.apache.flume.channel.file.ReplayHandler.replayLog(ReplayHandler.java:245) 
> at org.apache.flume.channel.file.Log.replay(Log.java:356) 
> at org.apache.flume.channel.file.FileChannel.start(FileChannel.java:258) 
> at 
> org.apache.flume.lifecycle.LifecycleSupervisor$MonitorRunnable.run(LifecycleSupervisor.java:236)
>  
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) 
> at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) 
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) 
> at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>  
> at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
>  
> at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
>  
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>  
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>  
> ... 1 more 
> Caused by: com.google.protobuf.InvalidProtocolBufferException: Protocol 
> message tag had invalid wire type. 
> at 
> com.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:78)
>  
> at 
> com.google.protobuf.UnknownFieldSet$Builder.mergeFieldFrom(UnknownFieldSet.java:498)
>  
> at 
> com.google.protobuf.GeneratedMessage$Builder.parseUnknownField(GeneratedMessage.java:438)
>  
> at 
> org.apache.flume.channel.file.proto.ProtosFactory$TransactionEventHeader$Builder.mergeFrom(ProtosFactory.java:2880)
>  
> at 
> org.apache.flume.channel.file.proto.ProtosFactory$TransactionEventHeader$Builder.mergeFrom(ProtosFactory.java:2732)
>  
> at 
> com.google.protobuf.AbstractMessageLite$Builder.mergeFrom(AbstractMessageLite.java:212)
>  
> at 
> com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:746)
>  
> at 
> com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:238)
>  
> at 
> com.google.protobuf.AbstractMessageLite$Builder.mergeDelimitedFrom(AbstractMessageLite.java:282)
>  
> at 
> com.google.protobuf.AbstractMessage$Builder.mergeDelimitedFrom(AbstractMessage.java:760)
>  
> at 
> com.google.protobuf.AbstractMessageLite$Builder.mergeDelimitedFrom(AbstractMessageLite.java:288)
>  
> at 
> com.google.protobuf.AbstractMessage$Builder.mergeDelimitedFrom(AbstractMessage.java:752)
>  
> at 
> org.apache.flume.channel.file.proto.ProtosFactory$TransactionEventHeader.parseDelimitedFrom(ProtosFactory.java:2689)
>  
> at 
> org.apache.flume.channel.file.TransactionEventRecord.fromByteArray(TransactionEventRecord.java:193)
>  
> at 
> org.apache.flume.channel.file.LogFileV3$SequentialReader.doNext(LogFileV3.java:327)
>  
> at 
> org.apache.flume.channel.file.LogFile$SequentialReader.next(LogFile.java:452) 
> ... 13 more
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to