dev@glassfish.java.net

RE: [Ask and Discussion]Any confused phenomenon about the nodedir and node during the operation in creating the instance

From: lvsongping <lvsongping_at_cn.fujitsu.com>
Date: Tue, 16 Jul 2013 11:02:27 +0800

Joe:



    Thanks a lot about your patient reply. The two bugs you have mentioned
are quietly similar to my problem but not cover my problem, I think we can
created an issue related to this phenomenon.



    IMHO, After compared the solutions you have list, I would rather to
select the second one, it would be nice to copy in the default values
explicitly when a node is initialized, which means we should update the
nodedir during the first time to create the local instance if the related
nodedir hasn’t been initialized



Thanks a lot!



Regards

Jeremy



From: Joe Di Pol [mailto:joe.dipol_at_oracle.com]
Sent: Tuesday, July 16, 2013 8:47 AM
To: dev_at_glassfish.java.net; lvsongping_at_cn.fujitsu.com
Subject: Re: [Ask and Discussion]Any confused phenomenon about the nodedir
and node during the operation in creating the instance



Jeremy,

The node support in GlassFish works pretty well if you stay on the well
trodden path, but if you probe corner cases you can expose some issues as
you have seen.

Yes, node names need to be unique and you can't change a node attribute
(once set) with create-local-instance. But you can initialize an attribute
that has not been set. This is to support the "config node" use case: create
an empty config node, then run create-local-instance later to populate the
values in the config node.

The problem is the "config" node support does not differentiate between a
missing attribute (in domain.xml) meaning "use the default" and meaning "let
it be initialized by create-local-instance". I think that's what resulted in
the problems you saw with node-dir.

I would consider this a bug. The code should either be using special syntax
to differentiate between these two cases, or maybe explicitly copy in the
default values when a node is initialized.

I didn't find any bugs that exactly cover the problem you saw, but there are
a couple somewhat related to it:

 <https://java.net/jira/browse/GLASSFISH-14887>
https://java.net/jira/browse/GLASSFISH-14887
 <https://java.net/jira/browse/GLASSFISH-13894>
https://java.net/jira/browse/GLASSFISH-13894

Joe


On 7/15/13 1:14 AM, lvsongping wrote:

Hi, Jennifer Chou, Joe Di Pol:

Cc: Dev list:



   Recently, when I did some investigation about the admin component, I feel
a little confused about the current syntax related to the --nodedir and
--node option. I wonder if any of you can explain whether the phenomenon I
have come up with is the right syntax or the bug need to be resolved!



[Original Syntax]

IMHO, I think the node name should be unique and each node name must match
to an unique nodedir that can’t be updated during the operation to create
local instance. Here’s the command steps to reproduced the current syntax:

1) asadmin create-node-config -nodehost localhost --nodedir
c:\cygwin\home\jeremy\glassfish4\glassfish\my_nodes localhost-domain1

remote failure: Configuration not added. A Node instance with a
"localhost-domai

n1" name already exists in the configuration

Command create-node-config failed.

(From the above phenomenon, the node must be unique)



2) asadmin create-local-instance --nodedir
c:\cygwin\home\jeremy\glassfish4\glassfish\other_nodes --node my_nodes ins1

remote failure: Attribute mismatch for node 'my_nodes': the value for the
'noded

ir' attribute from the command
(c:/cygwin/home/jeremy/glassfish4/glassfish/other

_nodes) does not match the value in the DAS configuration
(c:/cygwin/home/jeremy

/glassfish4/glassfish/my_nodes)

Command create-local-instance failed.

(From the above phenomenon, I think each node name must match an unique
nodedir that can’t be updated during the operation to create local
instance)





[My Question]

I have come up with another situation different from the above one, Here’s
my detailed steps to reproduce the problem:

1) asadmin start-domain

Command create-local-instance executed successfully.



2) asadmin create-local-instance ins1

Command create-local-instance executed successfully.

(<1> After the operation, the node name without specified will use the
default value “localhost-domain1” which located in the default nodedir
defined in the asenv.conf or asenv.bat file ---- the default value of
AS_DEF_NODES_PATH is "../nodes".

<2> there’s still no definition about nodedir related to the
localhost-domian1 in the domain.xml after the command executed.

<node node-host="localhost" name="localhost-domain1" type="CONFIG"
install-dir="${com.sun.aas.productRoot}"></node>



IMHO, I think the nodedir should be set into the domain.xml during the first
time to create the local instance)



3) asadmin create-local-instance --nodedir
c:\cygwin\home\jeremy\glassfish4\glassfish\my_nodes1 ins2

Command create-local-instance executed successfully.

(IMHO, I think the ins2 shouldn’t be created )

(<1> After the operation, the node name without specified will use the
default value “localhost-domain1” which use the nodedir as the command
line descriped ----
“c:\cygwin\home\jeremy\glassfish4\glassfish\my_nodes1”.

<2> there’s still no definition about nodedir related to the
localhost-domian1 in the domain.xml after the command executed.

<node node-host="localhost" name="localhost-domain1" type="CONFIG"
install-dir="${com.sun.aas.productRoot}"></node>



IMHO, I think the ins2 can’t be created as the node name doesn’t match to
the nodedir)





4) asadmin create-local-instance --nodedir
c:\cygwin\home\jeremy\glassfish4\glassfish\my_nodes2 ins3

Command create-local-instance executed successfully.

(My option here is same to the step 3) )



5) asadmin create-node-config --nodehost localhost my_node

Command create-node-config executed successfully.



6) asadmin create-local-instance --node my_node ins4

Command create-local-instance executed successfully.

(<1> After the operation, the node name will be specified as my_node which
located in the nodedir defined in the asenv.conf or asenv.bat file ---- the
default value of AS_DEF_NODES_PATH is "../nodes".

<2> there’s still no definition about nodedir related to the
localhost-domian1 in the domain.xml after the command executed.

<node node-host="localhost" name="localhost-domain1" type="CONFIG"
install-dir="${com.sun.aas.productRoot}"></node>



IMHO, I think the nodedir shouldn’t be set into the domain.xml during the
first time to create the local instance in this node)





7) asadmin create-local-instance --nodedir
c:\cygwin\home\jeremy\glassfish4\glassfish\my_nodes3 --node my_node ins5

Command create-local-instance executed successfully.

(<1> After the operation, the node name will be specified as my_node use the
nodedir as the command line descriped ----
“c:\cygwin\home\jeremy\glassfish4\glassfish\my_nodes3”.

<2> there’s still no definition about nodedir related to the
localhost-domian1 in the domain.xml after the command executed.

<node node-host="localhost" node-dir="
c:\cygwin\home\jeremy\glassfish4\glassfish\my_nodes3"
name="localhost-domain1" type="CONFIG"
install-dir="${com.sun.aas.productRoot}"></node>



IMHO, I think the ins5 can’t be created as the node name doesn’t match to
the nodedir)





8) asadmin create-local-instance --nodedir
c:\cygwin\home\jeremy\glassfish4\glassfish\my_nodes4 --node my_node ins6

remote failure: Attribute mismatch for node 'my_node': the value for the
'nodedi r' attribute from the command
(c:/cygwin/home/jeremy/glassfish4/glassfish/my_nod

es4) does not match the value in the DAS configuration
(c:/cygwin/home/jeremy/gl

assfish4/glassfish/my_nodes3)

Command create-local-instance failed.







[Conclusion]

All in all, if it is an issue, I think the nodedir in the domain.xml should
be updated during the first to create the local instance.

However, If it is the right syntax as the glassfish admin team designed, I
wonder if anyone can list the main reason about this designment.





Thanks very much!



regards

Jeremy Lv

--------------------------------------------------

Lv Songping

Software Division II

    Development Department I

Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)

ADDR.: No.6 Wenzhu Road, Software Avenue,

        Nanjing, 210012, China

TEL : +86+25-86630566-8307

COINS: 7998-8307

FAX : +86+25-83317685

MAIL : <mailto:lvsongping_at_cn.fujitsu.com> lvsongping_at_cn.fujitsu.com