Skip to content
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

Account for potential gaps in hydrants in sink initialization, hydrant swapping (e.g. h0, h1, h4) #1747

Merged
merged 1 commit into from
Sep 18, 2015

Conversation

jon-wei
Copy link
Contributor

@jon-wei jon-wei commented Sep 17, 2015

Fixes issues with sink hydrant handling when loading a persisted sink directory with missing hydrants, e.g. persisted sink directory, with hydrants 1 and 3 missing:

$ pwd
.../test-datasource/1970-01-01T00:00:00.000Z_1970-12-31T00:00:00.000Z
$ ls
0 2 4


private void testPersistHydrantGapsHelper(final Object commitMetadata) throws Exception
{
final MutableBoolean committed = new MutableBoolean(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be an AtomicBoolean? The run() of the committer happens in a different thread.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other test should probably be changed too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gianm changed the MutableBooleans to AtomicBooleans

@@ -744,6 +744,10 @@ public int compare(File o1, File o2)
)
);
}
if (hydrants.isEmpty()) {
// Probably encountered a corrupt sink directory if no hydrants were loaded, skip sink creation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we log a warning in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xvrl Added a warning log for persisted sinks with no hydrants

@xvrl
Copy link
Member

xvrl commented Sep 18, 2015

@jon-wei can you describe the scenario in which you see the hydrants going missing?

@gianm
Copy link
Contributor

gianm commented Sep 18, 2015

👍

@jon-wei
Copy link
Contributor Author

jon-wei commented Sep 18, 2015

@xvrl I ran into an issue where a segment had no hydrants at all, and the empty sink that got created caused an exception later on. This could be due to a corrupted segment that didn't get cleaned up completely because I restarted my druid processes during development.

The hydrant gap handling was to address a potential issue that @gianm mentioned to me, when there are multiple hydrants being persisted in parallel and don't necessarily complete their persist in order.

@@ -744,6 +744,11 @@ public int compare(File o1, File o2)
)
);
}
if (hydrants.isEmpty()) {
// Probably encountered a corrupt sink directory
log.warn("Found persisted sink with no hydrants at %s, skipping sink creation.", sinkDir.getAbsolutePath());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we instead say. Found persisted segment directory with no intermediate segments present

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fjy adjusted warning message

@fjy
Copy link
Contributor

fjy commented Sep 18, 2015

👍 will merge after travis

fjy added a commit that referenced this pull request Sep 18, 2015
Account for potential gaps in hydrants in sink initialization, hydrant swapping (e.g. h0, h1, h4)
@fjy fjy merged commit 6605a60 into apache:master Sep 18, 2015
@jon-wei jon-wei deleted the realtime_corrupt_sink_fix branch September 22, 2015 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants