[ 
https://issues.apache.org/jira/browse/GEODE-5256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16554834#comment-16554834
 ] 

ASF subversion and git services commented on GEODE-5256:
--------------------------------------------------------

Commit 667fbb4176c2f9bf8e399809b1c46f744486c3cd in geode's branch 
refs/heads/develop from Juan José Ramos
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=667fbb4 ]

GEODE-5256: Parameters Precedence in Start Server (#2013)

* GEODE-5256: Parameters Precedence in Start Server

Configuration options set as part of the `start server` command now
take precedence over those configured in the `cache.xml` file, the
`cluster-configuration-service` and defaults.

- Rebased against latest develop branch.
- Removed unused `throws` clauses from tests.
- Renamed `ServerLauncherIntegrationTest` to
  `ServerLauncherBuilderIntegrationTest`.
- Added tests for `ServerLauncher` and `CacheCreation`.
- Added acceptance tests for `gfsh start server` command.
- Fixed `ServerLauncher.parseArguments` method, it was wrongly calling
  `setMaxConnections` for other unrelated parameters (maxMessageCount,
  messageTimeToLive and sockerBufferSize).
- The `ServerLauncher` class now sets all the relevent startup
  parameters during initialization within the static `parameters` field
  on `CacheServerLauncher` class. The `CacheCreation` class, in turn,
  reconfigures the `Server` attributes using
  `CacheServerLauncher.parameters` before starting the `AcceptorImpl`.

* GEODE-5256: Changes requested by reviewers

- Rebased against latest develop branch.
- Replaced `Wait` references for `Awaitility` in related tests.
- Class `CacheServerLauncher.Parameters` is now a top level class.
- Added `@Deprecated` annotation and docs for `CacheServerLauncher`.
- `StartServerCommandAcceptanceTest` now uses `FileUtils` instead of
  manually opening and reading the log file.


> GFSH Start Server Command Parameters Overridden by Default Values
> -----------------------------------------------------------------
>
>                 Key: GEODE-5256
>                 URL: https://issues.apache.org/jira/browse/GEODE-5256
>             Project: Geode
>          Issue Type: Bug
>          Components: gfsh
>            Reporter: Juan José Ramos Cassella
>            Assignee: Juan José Ramos Cassella
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: workspace.zip
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Hello team,
> The order on which we apply the cache configuration vs the startup parameters 
> when starting servers through {{gfs}} seems to be wrong.
>  No matter whether the cache is configured through a local {{cache.xml}} or 
> the cluster configuration service, internally we end up parsing the 
> configuration using {{CacheXmlParser}} and {{CacheCreation}} classes. The 
> class {{CacheCreation}} creates a server through {{CacheServerCreation}} and 
> this one extends {{AbstractCacheServer}}, which has some default values 
> configured, overriding the values set by the startup parameters.
>  I've been able to reproduce this for the {{max-connections}} configuration 
> property specifically but right now a bunch of parameters are completely 
> ignored if a {{cache.xml}} file is specified or if the 
> {{cluster-configuration-service}} is enabled, no matter if the actual 
> parameter is specifically configured or not, the default values are always 
> used. In fact, the only parameters that seem to override the {{cache.xml}} / 
> {{cluster-configuration}} are {{serverPort}}, {{serverBindAddress}} and 
> {{disableDefaultServer}}, they are communicated between the 
> {{ServerLauncher}} and {{CacheCreation}} classes through public static fields 
> in the {{CacheServerLauncher}} class.
>  As an example, after adding some extra logging on the 
> {{setMaxConnections()}} method, below is the output shown when starting the 
> server:
> {noformat}
> ######## gfsh start server --name=server1 --server-port=40401 
> --locators=localhost[10101] --max-connections=1033
> [info 2018/05/25 13:55:20.752 IST server1 <main> tid=0x1] Initialization of 
> region PdxTypes completed
> [XXXXX]: CacheServerImpl.setMaxConnections() is changing maxConnections from 
> 800 to 1033.
> java.lang.Throwable
>       at 
> org.apache.geode.internal.cache.CacheServerImpl.setMaxConnections(CacheServerImpl.java:209)
>       at 
> org.apache.geode.distributed.ServerLauncher.startCacheServer(ServerLauncher.java:956)
>       at 
> org.apache.geode.distributed.ServerLauncher.start(ServerLauncher.java:781)
>       at 
> org.apache.geode.distributed.ServerLauncher.run(ServerLauncher.java:692)
>       at 
> org.apache.geode.distributed.ServerLauncher.main(ServerLauncher.java:225)
> [info 2018/05/25 13:55:20.825 IST server1 <main> tid=0x1] CacheServer 
> Configuration:   port=40401 max-connections=1033 max-threads=0 
> notify-by-subscription=true socket-buffer-size=32768 
> maximum-time-between-pings=60000 maximum-message-count=230000 
> message-time-to-live=180 eviction-policy=none capacity=1 overflow directory=. 
> groups=[] loadProbe=ConnectionCountProbe loadPollInterval=5000 tcpNoDelay=true
> ######## gfsh -e start server --name=server1 --server-port=40401 
> --locators=localhost[10101] --max-connections=1033 
> --cache-xml-file=$CURRENT_DIRECTORY/server-cache.xml
> [info 2018/05/25 13:56:19.593 IST server1 <main> tid=0x1] Initialization of 
> region PdxTypes completed
> [XXXXX]: CacheServerImpl.setMaxConnections() is changing maxConnections from 
> 800 to 800.
> java.lang.Throwable
>       at 
> org.apache.geode.internal.cache.CacheServerImpl.setMaxConnections(CacheServerImpl.java:209)
>       at 
> org.apache.geode.internal.cache.CacheServerImpl.configureFrom(CacheServerImpl.java:304)
>       at 
> org.apache.geode.internal.cache.xmlcache.CacheCreation.startCacheServers(CacheCreation.java:688)
>       at 
> org.apache.geode.internal.cache.xmlcache.CacheCreation.create(CacheCreation.java:581)
>       at 
> org.apache.geode.internal.cache.xmlcache.CacheXmlParser.create(CacheXmlParser.java:337)
>       at 
> org.apache.geode.internal.cache.GemFireCacheImpl.loadCacheXml(GemFireCacheImpl.java:4307)
>       at 
> org.apache.geode.internal.cache.GemFireCacheImpl.initializeDeclarativeCache(GemFireCacheImpl.java:1434)
>       at 
> org.apache.geode.internal.cache.GemFireCacheImpl.initialize(GemFireCacheImpl.java:1226)
>       at 
> org.apache.geode.internal.cache.GemFireCacheImpl.basicCreate(GemFireCacheImpl.java:792)
>       at 
> org.apache.geode.internal.cache.GemFireCacheImpl.create(GemFireCacheImpl.java:778)
>       at org.apache.geode.cache.CacheFactory.create(CacheFactory.java:177)
>       at org.apache.geode.cache.CacheFactory.create(CacheFactory.java:224)
>       at 
> org.apache.geode.distributed.internal.DefaultServerLauncherCacheProvider.createCache(DefaultServerLauncherCacheProvider.java:52)
>       at 
> org.apache.geode.distributed.ServerLauncher.createCache(ServerLauncher.java:844)
>       at 
> org.apache.geode.distributed.ServerLauncher.start(ServerLauncher.java:762)
>       at 
> org.apache.geode.distributed.ServerLauncher.run(ServerLauncher.java:692)
>       at 
> org.apache.geode.distributed.ServerLauncher.main(ServerLauncher.java:225)
> [info 2018/05/25 13:56:19.929 IST server1 <main> tid=0x1] CacheServer 
> Configuration:   port=40401 max-connections=800 max-threads=0 
> notify-by-subscription=true socket-buffer-size=32768 
> maximum-time-between-pings=60000 maximum-message-count=230000 
> message-time-to-live=180 eviction-policy=none capacity=1 overflow directory=. 
> groups=[] loadProbe=ConnectionCountProbe loadPollInterval=5000 tcpNoDelay=true
> {noformat}
> A reproducible scenario is attached to the JIRA.
>  Cheers.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to