qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ernie Allen" <eal...@redhat.com>
Subject Re: Review Request 14151: Preserve the pre 0.22 behavior of qpidd when data-dir is not defined in an environment variable.
Date Fri, 20 Sep 2013 19:00:20 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/14151/
-----------------------------------------------------------

(Updated Sept. 20, 2013, 7 p.m.)


Review request for qpid, Chug Rolke, Gordon Sim, and Ted Ross.


Repository: qpid


Description (updated)
-------

New solution suggested by Gordon Sim:
--------------------------------------------------
- Don't use an environment variable in the init.d script
- Instead, add a getDefaultDataDir() to Broker::Options that contains all the logic. This
function checks the $HOME directory and doesn't append the .qpidd to the default dataDir if
home is /var/lib/qpidd.


Old description:
--------------------------------------------------
Before 0.22, when the broker was started from the init.d script, the default data-dir of /var/lib/qpidd
was hard-coded in the init.d script.

After https://bugzilla.redhat.com/show_bug.cgi?id=990972, the default data-dir is NOT hard-coded
in the init.d script. This allows the data-dir to be picked up from /etc/qpid/qpidd.conf.
However, the side-effect of that change is that when qpidd is started as a service and no
data-dir is supplied, the data-dir is constructed to be /var/lib/qpidd/.qpidd. This is a change
in behavior.

Proposed solution:
- Modify the init.d script to set an environment variable: QPID_FROM_INITD.
- If that environment variable exists don't append .qpidd to the data-dir.

Other attempted solutions:
1. Use the ppid to determine if qpidd was started as a service from the init.d script. If
the ppid is 1 then we were started by the init process as a service. This didn't work because
the ppid wasn't 1. It was a normal process id. I suspect this is because the init process
isn't the direct parent of qpidd.

2. Inspect /var/run/qpidd.pid and compare it's contents to our pid. This didn't work because
/var/run/qpidd.pid was empty at the time it was inspected. After qpidd starts /var/run/qpidd.pid
contains the correct pid, but during startup it is empty.

3. Pass a new command line switch that indicates qpidd was started from the init.d file. This
would work but has the problem of having to hide the new command line switch from the usage
text and passing it to the proper constructor. This is much more involved than the environment
variable.

 


Diffs
-----

  /trunk/qpid/cpp/src/qpid/broker/Broker.h 1523729 
  /trunk/qpid/cpp/src/qpid/broker/Broker.cpp 1523729 
  /trunk/qpid/cpp/src/qpid/broker/posix/BrokerDefaults.cpp 1523729 
  /trunk/qpid/cpp/src/qpid/broker/windows/BrokerDefaults.cpp 1523729 

Diff: https://reviews.apache.org/r/14151/diff/


Testing
-------

Verified that:
When started from the command line without specifying a data-dir, the store files should be
under $HOME/.qpidd 
When started from the command line with a data-dir, the store files should be directly under
the specified data-dir.
When started from the init.d script without specifying a data-dir, the store files should
be under $HOME (/var/lib/qpidd)
When started from the init.d script with a data-dir (from sysconfig), the store files should
be directly under data-dir.

When started from the command line, the data-dir can be specified using
- the command line switch --data-dir
- the environment variable QPID_DATA_DIR
- the config file entry data-dir=

When starting from the init.d script, the data-dir can be specified by
- exporting the QPID_DATA_DIR environment variable in /etc/sysconfig/qpidd
- using the config file entiry data-dir=


Thanks,

Ernie Allen


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message