Usage of static fields throughout Hibernate Core
by Vlad Mihalcea
Hi,
While reviewing this PR:
https://github.com/hibernate/hibernate-orm/pull/1198/files
I realized that we have some static fields which might cause some problems
when we deploy two or more SessionFactories in the same container (e.g.
Spring).
The fix suggests that we should use synchronised, as indicated by Sonar,
but I think we should avoid the static fields altogether.
Every instance variable must be confined to an object that's confined to
the same SessionFactory root object.
Without static fields, we can make sure that nothing escapes a given
SessionFactory.
Let me know what you think.
Vlad
9 years, 10 months
Community newsletter contribution
by Vlad Mihalcea
Hi,
I wanted to ask everyone to let me know if you'd like to include any
resource in the Community newsletter.
If you stumble on a blog post, forum or StackOverflow question, that you
happened to like and was worth sharing, you can send it to me, and I'll
include it in the next edition.
Thanks,
Vlad
9 years, 10 months
"Service" in Hibernate Search: history, lessons learned and rewrite
by Sanne Grinovero
The "Service" and "ServiceManager" concepts in Hibernate Search have a
specific meaning which is often misunderstood and/or abused, causing
trouble.
They also changed over time: victim of two major refactorings which
evolved the purpose and stretching its intent
So I'll change the definition again :-)
But hopefully clarifying it, so here is a draft of the rules which I
plan to both implement and document carefully on the javadoc, with
some comments to highlight what is changing:
# A service type is identified by a Class: a Service interface
Nothing new here. Yet: worth stressing that this implies that only one
implementation will be around.
# There can only be ONE IMPLEMENTATION of a service type used by the
whole Hibernate Search instance
In other words: it was not a good idea to have the
LuceneWorkSerializer to be modelled as a Service, back when we
supposedly could use a different serialization strategy for a
different index.
Yet it is a good idea nowadays to have LuceneWorkSerializer extend
Service, as we dropped that level of flexibility. This implies that
there's a single type of serializer (at most) and it's totally fine to
expose this as:
SearchIntegrator#getLuceneWorkSerializer()
[this method doesn't exist yet, but I'm thinking of adding it for our
convenience and the following other points]
P.S. we're only maintaining - and bundling - a single Serializer
implementation so it's no surprise that we can handle only one.. yet
this implies people wanting to override it have to either hack our
bootstrap or physically remove our implementation.
# A Service implementation can be provided by having it injected at
bootstrap (i.e.
org.hibernate.search.cfg.spi.SearchConfiguration.getProvidedServices()
)
Not a new rule either: repeating for clarity. We call these "provided" services.
# If a service isn't "provided", then we attempt to create one using
java.util.ServiceLoader
Currently this expects a single implementation to be available:
there's no way to pick which one if there are multiple implementations
on the classpath.
I think we'll need to be able to pass a "hint" or similar to the
requestService to allow expression of preferences, handle shortnames,
etc.. a proposal for that will follow when there will be need: at this
point it's important to clarify the limitation, as this expresses what
a Service is not able to model today.
Currently implementations are looked up "on demand". I plan to allow
"pre-initialize" services as it removes some trouble; these components
could have convenience getters, not least to remove the concurrency
overhead.
Remember that since there's only one implementation for a given type
around, there's no reason to not do this: the intent of the Service
contract is to allow people to inject a customized implementation.
# If a Service implementation also implements Startable, or Stoppable,
we'll invoke the respective methods once at start and/or at stop of
the Search instance - unless they are provided in which case they are
ignored.
The current javadoc suggests that it's illegal for a provided
implementation to also implement Startable and/or Stoppable; I don't
remember why that was, but today it seems unfitting: people might want
to extend one of our implementations, or reuse some of the
implementations normally auto-started but reuse them "by instance" by
providing them to multiple Search instances to save memory (we
actually have a need for this for Index Affinity in Infinispan).
The important concept which will survive, is that we don't start or
stop stuff which is provided as that's clearly responsibility of
another component.
# All non-provided Services will be stopped once, and only once as
final step when the SearchIntegrator is stopped.
This is a significant difference with today's code: we expect the
Service consumers to "open / close", hopefully in a finally block, to
the point that Gunnar enhanced it to at least allow AutoClose
semantics.
Yet, I don't want runtime code to open and close these frequently as
it has been a bottleneck in the past.
It also led to the creations of issues like HSEARCH-1589 : we might
start/stop the same service frequently, and need to improve with
reference counters.
I suspect that historically the reasoning was to make sure that the
order of teardown would follow the inverse order of bootstrap as
components would cleanup after themselves, but having clarified that
Service instances are unique globally, should also imply that their
state doesn't depend on other Services. So the teardown order doesn't
matter anymore.. we'll start one for each, but only close it at
shutdown.
# Hierarchy?
We've talked about global components so far. It's clear that the
IndexManager has a central role in the overall architecture, as we
tend to allow per-index customisations. Or per-family customisations,
as suggested in my previous email.
An example which affects Service:
The "JestClient client" [the Service we use to connect to
Elasticsearch] could be considered a good fit for being a "Service" as
this allows people to override the client implementation and/or inject
a pre-configured instance.. yet it's not a good fit if we want to
allow people to connect to different hosts for different indexes.
I don't plan to implement the hierarchical ServiceManager right now,
but proposing it already so that we can agree on the above cleanups in
contract, with the perspective that there are cleaner solutions also
for the scoped use case.
Implementing these changes resolves or obsoletes at least 10 JIRA
issues in one shot..
Thanks,
Sanne
9 years, 10 months
Re: [hibernate-dev] GSoC 2016: Congratulations, your proposal with JBoss Community has been accepted!
by Mincong Huang
Hi everybody,
Thanks for accepting my application of GSoC !! Really excited to having
chance to work the hibernate team. I'm so happy to see this email. It's
just
like a dream, can't believe it is true !! Thanks for choosing me. I'll try
my
best to accomplish this mission !! Happy coding and good night :-)
Cheers,
Mincong
On Fri, Apr 22, 2016 at 9:25 PM, Google Summer of Code <
summerofcode-noreply(a)google.com> wrote:
> [image: Google Summer of Code]
>
> Hi mincongh,
>
> Welcome to GSoC 2016!
>
> Your proposal Hibernate Search: JSR 352 batch job for re-indexing entities
> <https://summerofcode.withgoogle.com/dashboard/student/proposal/5244068401...>
> has been accepted!
>
> We look forward to seeing the great things you will accomplish this summer
> with JBoss Community.
>
> This email contains important information about your participation in GSoC
> this year. Please read it carefully.
>
> Over the next month you will take part in the Community Bonding period
> with your organization. This period is for you to become familiar with the
> organization's code base, version control and other infrastructure. You
> will be getting to know the community and its practices, as well as working
> with your mentor on milestones for the summer.
>
> Complete all of these steps as soon as you can:
>
> 1. Read the Accepted Student Information
> <https://developers.google.com/open-source/gsoc/help/accepted-students>
> 2. Upload <https://summerofcode.withgoogle.com/dashboard/> your tax
> form *before May 16, 2016 at 19:00 UTC*
> 3. Read the Student Payment Information
> <https://developers.google.com/open-source/gsoc/help/payoneer>
> 4. Set up your Payoneer account before May 16, 2016 at 19:00 UTC
> 5. Verify your shipping address, promotional materials, and t-shirt
> information on your profile
> <https://summerofcode.withgoogle.com/dashboard/profile/>.
>
> If you have questions about anything in this email, please email the
> Google GSoC support team at gsoc-support(a)google.com. Don’t email the
> student list with tax or payment issues.
>
> Have a great summer!
>
> Google Open Source Programs team
>
> This email was sent to mincong.h(a)gmail.com.
>
> You are receiving this email because of your participation in Google
> Summer of Code 2016.
> https://summerofcode.withgoogle.com
>
> To leave the program and stop receiving all emails, you can go to your
> profile <https://summerofcode.withgoogle.com/dashboard/profile/> and
> request deletion of your program profile.
>
> For any questions, please contact gsoc-support(a)google.com. Replies to
> this message go to an unmonitored mailbox.
>
> © 2016 Google Inc., 1600 Amphitheatre Parkway, Mountain View, CA 94043,
> USA
>
9 years, 10 months
[HSEARCH] Usage of ShardIdentifierProvider
by Gunnar Morling
Hi,
As IndexShardingStrategy is deprecated, I thought I'd use
ShardIdentifierProvider and friends in new code I write. It's not clear to
me though, how it's meant to be used.
Some questions:
* Is it correct that EntityIndexBinding#getShardIdentifierProvider()
returns null is sharding is not used for this entity? I suppose in that
case I simply can use EntityIndexBinding.getIndexManagers()[0]?
* What's the envisioned way to get the IM for a given shard once I know the
shard id? I found IndexManagerHolder.getOrCreateIndexManager(), but this
expects a *DynamicSharding*EntityIndexBinding, so how would it work for
non-dynamic sharding?
It's tough to see how the pieces are meant to fit together, now that
IndexShardingStrategy and ShardIdentifierProvider are there. I hope we can
get rid of the former soon, simplifying the code a bit?
Thanks,
--Gunnar
9 years, 10 months
HipChat history is limited
by Gunnar Morling
Hey all,
I was looking for a discussion I had with Emmanuel a few month ago on
HipChat. But navigating back in time, I could not go before Feb 1st because
I hit "You've reached the end of your viewable chat history. Switch to
HipChat Plus for unlimited access".
Does anyone know whether we can get free HipChat Plus licenses as an OSS
project? If not, I personally see no other way than going back to IRC
completely.
Not sure whether that only affects 1:1 chats (I could go back farther in
the history of project rooms), but having access to only less than three
months of history is a deal breaker for me.
Thanks,
--Gunnar
9 years, 10 months
[HSEARCH] Scope of the first version with ES support
by Gunnar Morling
Hey,
I'd like to achieve clarity and agreement on the scope of HSEARCH 5.6, the
first release with support for the Elasticsearch indexing backend.
I suggest we limit ourselves to the essential things making the backend
actually usable and release it as a "technology preview" as of 5.6.0.Final.
Everything not needed for that goal I'd move to subsequent releases (5.7,
6.0), the motivation being that we should not kill the vibe and deliver
something real soon.
Some candidates for moving over I see:
* "Define analyzers via the REST API (HSEARCH-2219
<https://hibernate.atlassian.net/browse/HSEARCH-2219>)": Users can create
the needed analyzers themselves
* "Consider using the fields feature of Elasticsearch for properties mapped
on several fields" (HSEARCH-2215
<https://hibernate.atlassian.net/browse/HSEARCH-2215>): Seems scheduled as
a "reminder" only anways?
* "Use the Elasticsearch Scroll API when fetching large result sets" (
HSEARCH-2128 <https://hibernate.atlassian.net/browse/HSEARCH-2128>): Seems
not strictly needed
* "Map the optimize() operation to Elasticsearch 'force merge' requests" (
HSEARCH-2092 <https://hibernate.atlassian.net/browse/HSEARCH-2092>): Manual
requests possible as a work-around
* Likely some others
Things we *should* do are most mapping-related issues, documentation and
apparent perf issues (massing indexing, avoid too frequent refreshing).
The public interest in the subject seemed good, so I'd prefer if we can
ship a "Final" version soon in MVP-style. As it seems, a "final" tech
preview is less scary to people than an Alpha/Beta. Let's hone the bits it
in subsequent releases, rather than working on the first Final for a long
time.
Any thoughts?
--Gunnar
9 years, 10 months