[QTL] Implement LookupExtractorFactory of namespaced lookup#2926
[QTL] Implement LookupExtractorFactory of namespaced lookup#2926fjy merged 52 commits intoapache:masterfrom
Conversation
… 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
…amx/druid into metamx-namespaceLookupMovetoLookups
Merge master lookups
| try { | ||
| if (!started.compareAndSet(false, true)) { | ||
| LOG.warn("Already started!"); | ||
| return false; |
There was a problem hiding this comment.
fixed both cases and tests
| import java.util.concurrent.locks.ReadWriteLock; | ||
| import java.util.concurrent.locks.ReentrantReadWriteLock; | ||
|
|
||
| @JsonTypeName("namespace") |
There was a problem hiding this comment.
i think we need to call this something that reflects that is is a global cached lookup manager. How about CachedNamespace ?
There was a problem hiding this comment.
sounds good will change
| manager.delete(extractorID); | ||
| throw new ISE("Lookup [%s] is deleting", extractorID); | ||
| } | ||
| } while (!preVersion.equals(postVersion)); |
There was a problem hiding this comment.
i am totally lost, why the version will change between two calls in the same function ?
There was a problem hiding this comment.
race condition during background update. If the updating task swaps the cache at a very inopportune time.
There was a problem hiding this comment.
but isn't when you get the read lock this can not happen ?
There was a problem hiding this comment.
The read lock is only for the entire service shutting down, not for individual namespaces
|
👍 but I didn't read the tests very carefully |
| public boolean start() | ||
| { | ||
| final Lock writeLock = startStopSync.writeLock(); | ||
| writeLock.lock(); |
There was a problem hiding this comment.
is there really a benefit to using a read-write lock here? was a simple synchronized block not fast enough?
There was a problem hiding this comment.
I didn't want io.druid.query.lookup.NamespaceLookupExtractorFactory#get to get caught up for multiple things calling get
There was a problem hiding this comment.
I did not benchmark vs synchronize
| } | ||
|
|
||
| @JsonIgnore | ||
| private final AtomicBoolean started = new AtomicBoolean(false); |
There was a problem hiding this comment.
a simple volatile should be enough here, given that writes are always synchronized on the lock
There was a problem hiding this comment.
I like AtomicBoolean and the explicit CAS it has, but it doesn't add much here, so I went ahead and moved to volatile.
|
@drcrallen can we name the artifact id to something like |
|
@b-slim renamed to |
|
I am not sure i can see the change or the comment it self
|
|
@b-slim I see the change. Hard refresh the webpage? |
|
Yes i do now.
|
|
|
||
| ## Configuration | ||
| <div class="note caution"> | ||
| Static configuration is no longer supported. Only cluster wide configuration is supported |
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
If this is too wild of a change, I can copy the old extension over and deprecate it.
There was a problem hiding this comment.
(probably separate from this PR)
There was a problem hiding this comment.
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.
|
minor comments but overall 👍 |
* Also add serde test
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.