-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix handling for suspend/resume case for PeriodFromFirst #88
Conversation
b92c57b
to
25d94e5
Compare
|
||
override def empty: () => Future[Done] = () => Future.successful(Done) | ||
|
||
/** Override this method to define how to backup a `ByteString` to a `DataSource` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doc isn't doing anything useful since its already documented in BackupClientInterface
and its also a test we are dealing with.
25d94e5
to
e89782d
Compare
@@ -55,36 +56,61 @@ trait BackupClientInterface[T <: KafkaClientInterface] { | |||
override val context: kafkaClientInterface.CursorContext | |||
) extends ByteStringElement | |||
|
|||
case class PreviousState(state: State, previousKey: String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These data structures have to be placed within BackupClientInterface
because they reference State
which is an abstract type member of the class itself
e89782d
to
53f82d3
Compare
53f82d3
to
4514490
Compare
@mdedetrich just curious what would happen if for some reason multiple instances of the backup happen to run concurrently (deployment error let say), could / do we detect that? |
Thanks for the approval, I also just added a commit that moves |
About this change - What it does
This PR fixes the suspend/resume handling for the
FirstFromPeriod
case. As documented for theBackup
configuration section inTimeConfiguration
, when usingFirstFromPeriod
if you kill a backup and then resume it, it will create a new object regardless of what the current configuredduration
is as long as at least one chunk has been persisted into S3.The current behavior of Guardian does not do this, the PR fixes this.
In addition the PR also renames some tests so its much more clear what is actually being tested
Why this way
The intention of this PR is to keep the interface for
BackupClientInterface
as simple as possible so that implementations ofBackupClientInterface
(i.e. S3'sBackupClient
) are trivial, simple and easy to understand even at a cost of internals ofBackupClientInterface
being more complicated.Here is a brief documentation of the public changes to the
BackupClientInterface
*
backupToStorageTerminateSink
: This newly added method is responsible for terminating an already existing backup which is needed forFirstFromPeriod
to function as documented. The definedSink
is basically the same asbackupToStorageSink
however it doesn't have to deal with a Kafka context (since its not writing any Kafka messages) and it will always be resuming from a currently unfinished backup*
getCurrentUploadState
: This method has been updated so that it returns the necessary information to implement this PR. It not only returns the state for the current key (if it exists) but it also returns the state for the last previous key before the current one (namedpreviousKey
) along with the key itself.BackupClientInterface
have been greatly improved.Additional changes
CurrentState
has been renamed toState
to avoid confusion since we are dealing with both current previous states.TBD