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

[QTL] Implement LookupExtractorFactory of namespaced lookup #2926

Merged
merged 52 commits into from
May 24, 2016

Conversation

drcrallen
Copy link
Contributor

Migration of #2716 to a repository more people have commit access to.

This patch adds LookupExtractorFactory of namespaced lookup.
With this, NamespacedExtractor can be used with LookupDimensionSpec.
Done as a first step to merge #2524 with QTL.

sirpkt and others added 14 commits March 31, 2016 10:13
… eliminate static configurations for lookup from namespecd lookup extensions

- druid-namespace-lookup and druid-kafka-extraction-namespace are modified
- However, druid-namespace-lookup still has configuration about ON/OFF
  HEAP cache manager selection, which is not namespace wide
  configuration but node wide configuration as multiple namespace shares
  the same cache manager
try {
if (!started.compareAndSet(false, true)) {
LOG.warn("Already started!");
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

return true ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed both cases and tests

import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

@JsonTypeName("namespace")
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we need to call this something that reflects that is is a global cached lookup manager. How about CachedNamespace ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good will change

manager.delete(extractorID);
throw new ISE("Lookup [%s] is deleting", extractorID);
}
} while (!preVersion.equals(postVersion));
Copy link
Contributor

Choose a reason for hiding this comment

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

i am totally lost, why the version will change between two calls in the same function ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

race condition during background update. If the updating task swaps the cache at a very inopportune time.

Copy link
Contributor

Choose a reason for hiding this comment

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

but isn't when you get the read lock this can not happen ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The read lock is only for the entire service shutting down, not for individual namespaces

@fjy
Copy link
Contributor

fjy commented May 20, 2016

👍 but I didn't read the tests very carefully

public boolean start()
{
final Lock writeLock = startStopSync.writeLock();
writeLock.lock();
Copy link
Member

Choose a reason for hiding this comment

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

is there really a benefit to using a read-write lock here? was a simple synchronized block not fast enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want io.druid.query.lookup.NamespaceLookupExtractorFactory#get to get caught up for multiple things calling get

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not benchmark vs synchronize

}

@JsonIgnore
private final AtomicBoolean started = new AtomicBoolean(false);
Copy link
Member

Choose a reason for hiding this comment

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

a simple volatile should be enough here, given that writes are always synchronized on the lock

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like AtomicBoolean and the explicit CAS it has, but it doesn't add much here, so I went ahead and moved to volatile.

@b-slim
Copy link
Contributor

b-slim commented May 22, 2016

@drcrallen can we name the artifact id to something like druid-globalCached-lookups ? like that the second module will be called druid-singleCached-lookups ?

@drcrallen
Copy link
Contributor Author

@b-slim renamed to lookups-cached-global

@b-slim
Copy link
Contributor

b-slim commented May 23, 2016

I am not sure i can see the change or the comment it self

On May 23, 2016, at 10:42 AM, Charles Allen notifications@github.com wrote:

@b-slim https://github.com/b-slim renamed to lookups-cached-global ((my immediate prior comment seems to have vanished)


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #2926 (comment)

@fjy
Copy link
Contributor

fjy commented May 23, 2016

@b-slim I see the change. Hard refresh the webpage?

@b-slim
Copy link
Contributor

b-slim commented May 23, 2016

Yes i do now.

On May 23, 2016, at 3:19 PM, Fangjin Yang notifications@github.com wrote:

@b-slim https://github.com/b-slim I see the change. Hard refresh the webpage?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #2926 (comment)


## Configuration
<div class="note caution">
Static configuration is no longer supported. Only cluster wide configuration is supported
Copy link
Contributor

Choose a reason for hiding this comment

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

@fjy is there a shard file or memo where developers can list what is backward incompatible or removed functionalities like that you don't have to figure out that your self ? any way this need to be announced as BIC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this is too wild of a change, I can copy the old extension over and deprecate it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(probably separate from this PR)

Copy link
Contributor

Choose a reason for hiding this comment

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

I dont think we need to do that as QTL as been labeled experimental and we clearly state we can and will change the API at any time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool sounds good

@b-slim
Copy link
Contributor

b-slim commented May 23, 2016

minor comments but overall 👍

* Also add serde test
@fjy fjy closed this May 24, 2016
@fjy fjy reopened this May 24, 2016
@fjy fjy merged commit 8024b91 into apache:master May 24, 2016
@drcrallen drcrallen deleted the qtl_namespace_lookup_no_kafka branch May 24, 2016 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants