-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[QTL][Lookup] lookup module with the snapshot utility #2517
Conversation
|
||
|Property|Description|Default| | ||
|--------|-----------|-------| | ||
|`druid.lookup.snapshotWorkingDir`| Working path used to store snapshot of current lookup configuration, leaving this property null will disable snapshot/bootstrap utility|null| |
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.
I wonder if this should be required instead of optional.
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.
thought about it but felt like ppls might chose to not use it. i can set it as mandatory if you feel that we can not use Lookup without this snapshot utility , which in MO not true.
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.
It's possible to use segments without the local segment cache as well, but we force that because it allows the node to be restarted in the exact same state it was in before it went down. This should be the same.
Actually, though, I think it would make sense to maybe make it default to the segmentCache directory + "/lookups" or something like that.
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.
@cheddar but thought broker doesn't have segment cache property ?
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.
Good call. Yes, it does not...
@drcrallen can you please take a look at this. |
|
||
boolean isAdded = (null == lookupMap.putIfAbsent(lookupName, lookupExtractorFactory)); | ||
if (isAdded && lookupSnapshotTaker != null) { | ||
lookupSnapshotTaker.takeSnapshot(getAllAsList()); |
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 works. But, why re-write all of them instead of just appending the new one?
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.
we don't expect this will change very frequently and size will be limited so i think let's keep it this way
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.
Does this need to have a snapshot every put instead of just on stop()?
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.
yes every put you have new changes, like that you make sure if the process crash we have a recent snapshot.
I left some comments that I could be taken or could be not taken. I think it's fine as is and am ready to 👍 as is if none of the feedback is taken. |
FYI there is an issue here hinted at in #1576 If a node is down when a DROP request propagates across the cluster, the coordinator has no idea if the Lookups a node contains when it comes back up are custom added or still present from the failed DROP (since the node was down) |
ef75638
to
177d6f1
Compare
@drcrallen can you please take look at this one it is sort of easy to pull in. |
@@ -27,6 +27,7 @@ | |||
import com.google.common.base.Preconditions; | |||
import com.google.inject.name.Named; | |||
import com.metamx.common.StringUtils; | |||
import io.druid.query.lookup.LookupExtractor; |
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.
not used?
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.
oh nvmnd, package refactor
@After | ||
public void tearDown() | ||
{ | ||
temporaryFolder.delete(); |
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.
Not needed
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.
ok
General comments:
|
Talked to @cheddar about that and we think that the best way to go is to avoid the static path since it will introduce the case where after restart the old config is out of synch. But as you said it is basically the same thing. |
Sure Will do |
177d6f1
to
0239bed
Compare
@drcrallen thanks for the review, i have addressed all the comments, please take a look. |
LOGGER.debug("Removed lookup [%s]", lookupName); | ||
if (!isClosed() && lookupSnapshotTaker != null) { | ||
// if it is closed the final snapshot will be taken at stop() method | ||
lookupSnapshotTaker.takeSnapshot(getAllAsList()); |
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.
Sometimes this is protected by the start/stop lock and sometimes it is not. It seems that it should probably be protected here. It is possible to pass isClosed
, but have stop
remove elements between isClosed
and getAllAsList
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.
i am not sure i get this. For all the put and remove i am asserting that is started and the block is synchronized around lock.
synchronized (lock) {
assertStarted();
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.
put has the code you mention, remove does not
@drcrallen anything is blocking this ? |
0239bed
to
877096f
Compare
@drcrallen thanks i have added lock |
8e01b45
to
4915f4c
Compare
@drcrallen This is squashed and addressed all the comments, can we get this in, it is blocking me please. |
public class LookupSnapshotTaker | ||
{ | ||
private static final Logger LOGGER = new Logger(LookupSnapshotTaker.class); | ||
private static final String PERSIST_FILE_NAME = "lookupSnapshot.data"; |
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.
suggest .json
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.
done
Minor comments, but for #2517 (comment) can the module be moved into the list of modules per CLIXXX ? |
@drcrallen done. |
if (lookupSnapshotTaker != null) { | ||
final List<LookupBean> lookupBeanList = lookupSnapshotTaker.pullExistingSnapshot(); | ||
for (LookupBean lookupBean : lookupBeanList | ||
) { |
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.
formatting looks weird here
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.
fixed
Overall code is in a very good spot. Minor syntactical comments that I'll leave to the author's discretion, but please squash, and I'm 👍 after squash and travis passes. |
I'll reconcile this with #2517 as soon as it is merged. |
d7466fc
to
0c86b29
Compare
[QTL][Lookup] lookup module with the snapshot utility
Reconciled. I had to move the Module into druid-server |
This PR