A Hibernate Issue
by Devan Goodwin
Hey guys, BK found an issue with hibernate, essentially he was
starting Candlepin in tomcat, loading a cert, which creates
entitlement pools each affiliated with an owner. When he then went to
his new API call for owner/{id}/entitlementpool to get the list, it
would come back empty, even though the pools were in the db and
correctly pointing to the owner. Restart tomcat, hit the same URL, and
now the entitlement pools would appear.
The issue was this:
diff --git a/proxy/src/main/java/org/fedoraproject/candlepin/model/SpacewalkCertificateCurator.java
b/proxy/src/main/java/org/fedoraproject/candlepin/model/SpacewalkCertificateCurator.java
index 3d618e8..c24e93f 100644
--- a/proxy/src/main/java/org/fedoraproject/candlepin/model/SpacewalkCertificateCurator.java
+++ b/proxy/src/main/java/org/fedoraproject/candlepin/model/SpacewalkCertificateCurator.java
@@ -134,6 +134,7 @@ public class SpacewalkCertificateCurator {
ep.setStartDate(start);
ep.setEndDate(end);
ep.setCurrentMembers(0);
+ owner.addEntitlementPool(ep);
entitlementPoolCurator.create(ep);
}
I know we've seen this issue before both in CP and back in Spacewalk,
and pretty sure we've had some conversations about it at times too, I
thought the outcome of that was to do the above.
The call to create the entitlement pool does end up calling flush, so
I don't think this is the issue, but Hibernate still keeps the owner
object laying around.
When a new call comes in to our REST API, should this be using a
cached Owner? I kinda thought it would clear the cache on each
request. (if not is that something we could/should do?)
Any other insight or solutions to this problem?
Thanks,
Devan
--
Devan Goodwin <dgoodwin(a)rm-rf.ca>
http://rm-rf.ca
14 years, 2 months
Renamed /entitlementpool to /pool
by Bryan Kearney
I was playing around with the api.. and the fact that /entitlementpool
returned data which had entitlementPool in it was causing issues.
Instead of starting the StdleyCaps debate, I changed the url to be
/pool. I think this will be a slight change to the client api. Adrian..
could you work with the client guys on this? Also... I think the
consumer APi should be changed to be .../pool as well.
-- bk
14 years, 2 months
functional tests
by Jesus M. Rodriguez
I investigated trying to get buildr to generate the .classpath
correctly given we moved
long running tests to src/functionaltest/java. buildr gets the src
directories from the
ones defined by the compile task which defaults to src/main/java and
the test task
which is src/test/java.
buildr has the notion of integration tests as well as unit tests. You
can also include/exclude
based on class name or package.
So we could put all functional tests back in the src/test/java tree under the
org.fedoraproject.candlepin.functional package name (or something unique enough
to allow exclusion)
Then we could add this to the buildfile: http://pastie.org/841381
And change the test to exclude that package.
Ok if we do this how do I use this stuff? quite easily, to run unit tests we do
buildr test
to run integration tests we do, you guessed it
buildr integration
This will do a few things:
1) .classpath will not need to know about src/functionaltest/java,
therefore work again
2) functionaltests will not slow down normal unit test runs
3) we still get the ability to have long integration tests available
and can run them separately.
What does this NOT fix? I still haven't figured out how to get buildr
to use something like target-eclipse for
outputing .classpath instead of target/classes. I think there is a way
it just wasn't obvious.
jesus
14 years, 2 months
Config refactoring proposal
by jesus rodriguez
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
While working on Pinsetter component of Candlepin, I have the need to
configure both Quartz (via org.quartz.* properties) and Pinsetter itself
(i.e. needing a list of task classnames as well as their cron schedules).
I went through the config code to see if I could get a better
understanding of what is going on with the application and wondering
why we had so many "Configuration" classes. So to relieve some of my
confusion I'm proposing the changes listed below. Thoughts?
1) Rename JerseyGuiceConfiguration to CandlepinContextListener -
it will go along way to remove my confusion as this is the basic
entry point into the guice configuration. I understand the lifecycle
of the ContextListener over JerseyGuiceConfiguration which confuses me.
2) Rename CandlepinProductionConfiguration to CandlepinModule -
this is a guice module for candlepin. Again the current name
confuses me.
3) Make Config class injectable into other parts of the application
so that we may get access to configuration data when needed. Plus
there should only be one Config, right now I see two instances where
we created a "new Config()" class.
4) Roll the ConfigFileLoader into the Config class, it's simple enough
and Config basically comes from a file if it exists, so I think
it should live in there.
5) JPAConfiguration seems pretty generic and could be rolled into Config
as well. As part of this make CandlepinModule call
config.getNamespaceProperties("jpa.config") instead of new
Config().jpaConfiguration()
6) Move JPAInitializer into CandlepinModule
7) I'm still working on undestanding CustomizableModules
8) add some utility methods to Config i.e. getString(), getInt() etc
(maybe when I needed them)
jesus
- --
jesus m. rodriguez | jesusr(a)redhat.com
principal software engineer | irc: zeus
red hat systems management | 919.754.4413 (w)
rhce # 805008586930012 | 919.623.0080 (c)
+---------------------------------------------+
| "Those who cannot remember the past |
| are condemned to repeat it." |
| -- George Santayana |
+---------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkuEPEQACgkQvJZ57YntiYOJQwCcDCZQIp14Vp5erBtNYVs/s5P/
k/AAn2RigXO474Q5+zAyluAj+96gvF3t
=uWBs
-----END PGP SIGNATURE-----
14 years, 2 months
Product Content Sets
by Devan Goodwin
We have a need to store some "content set" data on Products for the
certificate service to operate properly, but we're looking to avoid
the introduction of Product -> a new ContentSet object as it feels too
bound to a particular domain. Rather, we're looking to store it as
something more like an attribute on the product as we have today.
Problem is, attributes today are currently just a simple:
"key": "value"
For this use case, we'd be looking to store an attribute more like:
"content_sets": [
{"name": "content1",
"description": "description 1",
"architectures": "x86 x86_64",
"version": "5"},
...
]
I don't think it's logical to try to model this with an actual
database structure, as the attribute values could then be just
strings, hashes, or lists (of strings or hashes), it just starts to
look too crazy.
The only two options I can see are:
1) Store it as a JSON string. All rules and service adapters in this
deployment of candlepin would need to know implicitly that this
attribute maps to a json string, but this is probably fine as those
attributes are all only known to the specific rules/adapters anyhow.
2) Bite the bullet and add a ContentSet object (possibly under another
name) and relate it to the Product. Simpler mapping, but it's adding a
new concept we may not need.
Thoughts? I think I'm leaning towards 1.
Devan
--
Devan Goodwin <dgoodwin(a)rm-rf.ca>
http://rm-rf.ca
14 years, 2 months
Configuration review
by jesus rodriguez
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dmitri,
I have a few comments about the configuration work:
http://bit.ly/9XflrU
CandlpinConfiguration -
* why is it CandlepinConfiguration and not just Configuration? or Config :)
* why do we store the File object in CandlepinConfiguration? as opposed
to storing just the filename, then in loadProperties() create a new
File object there for loading.
* I don't quite understand the configurationWithPrefix method?
* why is there a special JPAConfiguration() class? (I'll respond more
on this when I find the commit)
ConfigurationFileLoader -
* why store the File? could just make loadProperties() take in a file
* loadConfiguration() name seems redundant since it is the
ConfigurationFileLoader(), I think load() would've sufficed.
* any reason we're converting Properties into HashMaps?
So far I don't see how we'll use the CandlepinConfiguration. For instance,
in spacewalk I'd commonly want to do: Config.get().getString("a.b.c.url");
or Config.get().getInt("a.b.timeoutvalue");
Maybe we're not to that point yet.
Thanks
jesus
- --
jesus m. rodriguez | jesusr(a)redhat.com
principal software engineer | irc: zeus
red hat systems management | 919.754.4413 (w)
rhce # 805008586930012 | 919.623.0080 (c)
+---------------------------------------------+
| "Those who cannot remember the past |
| are condemned to repeat it." |
| -- George Santayana |
+---------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkt0hUYACgkQvJZ57YntiYMuOACgzjRfS9206rgCeYI+jSVa1dk/
wVMAoIDxs2YIq8TTETvhj1CdO3ctBatO
=WhXy
-----END PGP SIGNATURE-----
14 years, 2 months
Configuration part 2
by jesus rodriguez
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
http://bit.ly/aclJGQ
http://bit.ly/a6GoDk
CustomizableModules -
* configuration is a really long word :) any opposition
to making the package name config?
* why is this loading a different configuration?
customizable_modules*.conf -
* please change it to use = instead of :
- --
jesus m. rodriguez | jesusr(a)redhat.com
principal software engineer | irc: zeus
red hat systems management | 919.754.4413 (w)
rhce # 805008586930012 | 919.623.0080 (c)
+---------------------------------------------+
| "Those who cannot remember the past |
| are condemned to repeat it." |
| -- George Santayana |
+---------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkt0hzUACgkQvJZ57YntiYOCygCeJk0nYhuR0U6MbSbCbt0/X/r8
FjYAniX6Q4FAhaLkenlmCXucZrm06QPG
=Lq+Y
-----END PGP SIGNATURE-----
14 years, 2 months
Configuration part 3
by jesus rodriguez
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
http://bit.ly/byQ2TC
CandlepinConfiguration -
* Why is there a special JPAConfiguration class?
JPAConfiguration
* see first question above :)
* in parseConfig() instead of looking to see if the key exists,
why not pre-populate the map with all the defaults first, THEN
override the ones the user passes in?
I fear that if we add more 'defaults', we'll have to add yet
another check for each additional one.
Thinking something like:
JPAConfiguration() {
...
defaultConfigurationSettings();
...
}
Then when you call parseConfig() you just have to add what came in.
CandlepinProductionConfiguration -
* I'm stuff fuzzy on why we have this (I know it sets up the "production"
config but feels odd to me still)
persistence.xml -
* AWESOME, I'm glad to see this go.
- --
jesus m. rodriguez | jesusr(a)redhat.com
principal software engineer | irc: zeus
red hat systems management | 919.754.4413 (w)
rhce # 805008586930012 | 919.623.0080 (c)
+---------------------------------------------+
| "Those who cannot remember the past |
| are condemned to repeat it." |
| -- George Santayana |
+---------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkt0iPgACgkQvJZ57YntiYOglACdGi8RTn2PZXG7qhaV5fwuSnMf
gsIAnR/uarBL0HI0WOipkptNxjy4IzLx
=Nslg
-----END PGP SIGNATURE-----
14 years, 2 months