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

Enhanced DistributedObjectAdmin to compare for inconsistencies between instances #426

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from

Conversation

jskupsik
Copy link
Contributor

No description provided.

# Conflicts:
#	grails-app/controllers/io/xh/hoist/admin/cluster/DistributedObjectAdminController.groovy
@@ -91,6 +91,8 @@ class ClusterConfig {
Config createConfig() {
def ret = new Config()

System.out.println("ClusterConfig [INFO] | ${multiInstanceEnabled ? 'Multi-instance is enabled - instances will attempt to cluster.' : 'Multi-instance is disabled - instances will avoid clustering.'}")
Copy link
Member

Choose a reason for hiding this comment

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

I think trying to mimic the log output is confusing --- can we just log this later in cluster service, when our logging is setup?

}
}

void clearObjects(List<String> names) {
Copy link
Member

@lbwexler lbwexler Dec 24, 2024

Choose a reason for hiding this comment

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

Lets call this clearHibernateCaches and be specific! Could potentially combine with method below, or rename method below clearAllHibernateCaches

} catch (Exception e) {
def msg = 'Error extracting admin stats'
logError(msg, e)
error = "$msg | $e.message"
Copy link
Member

Choose a reason for hiding this comment

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

would prefer curly braces on $e.message.

def resourceObjs = svcs.collectMany { _, svc ->
[
// Services themselves
getInfo(obj: svc, name: svc.class.getName(), type: 'Service'),
Copy link
Member

Choose a reason for hiding this comment

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

think we could clarify with two methods that each just take a single object, and do type switching as needed -- e.g. getHoistInfo(Object obj) and getHzInfo(DistributedObject obj) -- symmetry!

@@ -185,8 +185,10 @@ class ClusterService extends BaseService implements ApplicationListener<Applicat
def clazz
try {
clazz = Class.forName(Utils.appPackage + '.ClusterConfig')
System.out.println("ClusterService [INFO] | Found custom ClusterConfig at ${Utils.appPackage + '.ClusterConfig'}")
Copy link
Member

Choose a reason for hiding this comment

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

again, let's just print out the cluster config package path when logging is available? We have a reference to an instance of the class and can easily print out its full canonical name.

}

@Access(['HOIST_ADMIN'])
def clearObjects() {
Copy link
Member

Choose a reason for hiding this comment

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

see below re: naming of these two endpoints to be more specific.

]
}

List getComparisonFields() {
if (!replicate) return null
Copy link
Member

Choose a reason for hiding this comment

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

super class returned empty list. maybe better to use ternary and return super.getComparisonFields()

@@ -30,6 +30,8 @@ class CachedValueEntry<T> implements KryoSerializable, LogSupport {
this.uuid = UUID.randomUUID()
}

static final UNINITIALIZED_CACHE_VALUE_ENTRY = new CachedValueEntry()
Copy link
Member

Choose a reason for hiding this comment

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

not sure why this change was made, but it worries me that if you ever tried to serialize one of these, I think it would fail with the null loggerName. If we do need this, singleton, I might suggest a different name, and also using the main constructor.

import static io.xh.hoist.util.Utils.getClusterService

class DistributedObjectInfo implements JSONFormat {
// Absolute name of the object, make sure to use `svc.hzName(name)` on relative-named objects
Copy link
Member

Choose a reason for hiding this comment

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

I find these interleaved comments make it difficult to read the fairly straightforward property name

if (a === b) return

if (!a.isMatching(b)) {
if (!breaks[name]) breaks[name] = []
Copy link
Member

Choose a reason for hiding this comment

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

withDefault on line 34 makes this a bit cleaner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants