You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ja...@apache.org on 2017/01/27 06:58:40 UTC
[1/6] geode git commit: GEODE-2353 Verify no clear-text passwords in
documentation [Forced Update!]
Repository: geode
Updated Branches:
refs/heads/feature/GEODE-2367 0669f4f97 -> 072413fe2 (forced update)
GEODE-2353 Verify no clear-text passwords in documentation
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/7a248556
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/7a248556
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/7a248556
Branch: refs/heads/feature/GEODE-2367
Commit: 7a2485565b512724ca920552f44af3d6ccff5492
Parents: 6619a3d
Author: Dave Barnes <db...@pivotal.io>
Authored: Wed Jan 25 17:30:05 2017 -0800
Committer: Dave Barnes <db...@pivotal.io>
Committed: Wed Jan 25 17:30:05 2017 -0800
----------------------------------------------------------------------
geode-docs/tools_modules/gfsh/command-pages/connect.html.md.erb | 2 +-
geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/7a248556/geode-docs/tools_modules/gfsh/command-pages/connect.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/tools_modules/gfsh/command-pages/connect.html.md.erb b/geode-docs/tools_modules/gfsh/command-pages/connect.html.md.erb
index ecdbc36..c83d2ff 100644
--- a/geode-docs/tools_modules/gfsh/command-pages/connect.html.md.erb
+++ b/geode-docs/tools_modules/gfsh/command-pages/connect.html.md.erb
@@ -91,7 +91,7 @@ When specified, if the <code>--password</code> option is not also specified,
<td><span class="keyword parmname">\-\-password</span></td>
<td>The password portion of the credential to use in authentication
when connecting to the jmx-manager.
-Note that this is a clear text password that may be visible to others.</td>
+</td>
<td>�</td>
</tr>
<tr class="odd">
http://git-wip-us.apache.org/repos/asf/geode/blob/7a248556/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
index 30ef7c5..086627c 100644
--- a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
+++ b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
@@ -776,7 +776,6 @@ then <code>gfsh</code> will prompt for the password.
<td><span class="keyword parmname">\-\-password</span></td>
<td>The password portion of the credential to use in authenticating to
the cluster.
-Note that this is a clear text password that may be visible to others.
</td>
<td></td>
</tr>
[4/6] geode git commit: GEODE-1930: fix exception messages in
DUnitLauncher
Posted by ja...@apache.org.
GEODE-1930: fix exception messages in DUnitLauncher
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/ca9cfd41
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/ca9cfd41
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/ca9cfd41
Branch: refs/heads/feature/GEODE-2367
Commit: ca9cfd4132631c4d47710f1af8768f4755f0143b
Parents: 9ff51ea
Author: Kirk Lund <kl...@apache.org>
Authored: Wed Jan 25 15:52:15 2017 -0800
Committer: Kirk Lund <kl...@apache.org>
Committed: Thu Jan 26 12:20:40 2017 -0800
----------------------------------------------------------------------
.../apache/geode/test/dunit/standalone/DUnitLauncher.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/ca9cfd41/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java
index 92a7c46..b35270e 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java
@@ -141,7 +141,7 @@ public class DUnitLauncher {
try {
launch();
} catch (Exception e) {
- throw new RuntimeException("Unable to launch dunit VMS", e);
+ throw new RuntimeException("Unable to launch dunit VMs", e);
}
}
@@ -217,7 +217,7 @@ public class DUnitLauncher {
// wait for the VM to start up
if (!processManager.waitForVMs(STARTUP_TIMEOUT)) {
- throw new RuntimeException("VMs did not start up within 30 seconds");
+ throw new RuntimeException(STARTUP_TIMEOUT_MESSAGE);
}
locatorPort = startLocator(registry);
@@ -231,7 +231,7 @@ public class DUnitLauncher {
// wait for the VMS to start up
if (!processManager.waitForVMs(STARTUP_TIMEOUT)) {
- throw new RuntimeException("VMs did not start up within 30 seconds");
+ throw new RuntimeException(STARTUP_TIMEOUT_MESSAGE);
}
// populate the Host class with our stubs. The tests use this host class
@@ -437,7 +437,7 @@ public class DUnitLauncher {
try {
if (!processManager.waitForVMs(STARTUP_TIMEOUT)) {
- throw new RuntimeException("VMs did not start up with 30 seconds");
+ throw new RuntimeException(STARTUP_TIMEOUT_MESSAGE);
}
RemoteDUnitVMIF remote =
(RemoteDUnitVMIF) registry.lookup(VM.getVMName(VersionManager.CURRENT_VERSION, pid));
[5/6] geode git commit: GEODE-2282: Provide ability to sort field
while creating pdxType for jSON document (Need to document system property)
This closes #366
Posted by ja...@apache.org.
GEODE-2282: Provide ability to sort field while creating pdxType for jSON document (Need to document system property)
This closes #366
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/0a1f7624
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/0a1f7624
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/0a1f7624
Branch: refs/heads/feature/GEODE-2367
Commit: 0a1f7624892c2b9e831f5fa710162bff385be83a
Parents: ca9cfd4
Author: Dave Barnes <db...@pivotal.io>
Authored: Thu Jan 26 14:43:36 2017 -0800
Committer: Dave Barnes <db...@pivotal.io>
Committed: Thu Jan 26 15:44:58 2017 -0800
----------------------------------------------------------------------
.../jsonformatter_pdxinstances.html.md.erb | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/0a1f7624/geode-docs/developing/data_serialization/jsonformatter_pdxinstances.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/developing/data_serialization/jsonformatter_pdxinstances.html.md.erb b/geode-docs/developing/data_serialization/jsonformatter_pdxinstances.html.md.erb
index d5397ed..b2abfb6 100644
--- a/geode-docs/developing/data_serialization/jsonformatter_pdxinstances.html.md.erb
+++ b/geode-docs/developing/data_serialization/jsonformatter_pdxinstances.html.md.erb
@@ -21,7 +21,7 @@ limitations under the License.
The `JSONFormatter` API allows you to put JSON formatted documents into regions and retrieve them later by storing the documents internally as PdxInstances.
-Geode now supports the use of JSON formatted documents natively. When you add a JSON document to a Geode cache, you call the JSONFormatter APIs to transform them into the PDX format (as a `PdxInstance`), which enables Geode to understand the JSON document at a field level.
+Geode supports the use of JSON formatted documents natively. When you add a JSON document to a Geode cache, you call the JSONFormatter APIs to transform them into the PDX format (as a `PdxInstance`), which enables Geode to understand the JSON document at a field level.
In terms of querying and indexing, because the documents are stored internally as PDX, applications can index on any field contained inside the JSON document including any nested field (within JSON objects or JSON arrays.) Any queries run on these stored documents will return PdxInstances as results. To update a JSON document stored in Geode , you can execute a function on the PdxInstance.
@@ -44,3 +44,14 @@ After executing a Geode query or calling `region.get`, you can use the following
- `toJSONByteArray`. Reads a PdxInstance and returns a JSON byte array.
For more information on using the JSONFormatter, see the Java API documentation for `org.apache.geode.pdx.JSONFormatter`.
+
+# Sorting Behavior of Serialized JSON Fields
+
+By default, Geode serialization creates a unique pdx typeID for each unique JSON document, even if the
+only difference between the JSON documents is the order in which their fields are specified.
+
+If you prefer that JSON documents which differ only in the order in which their fields are specified
+map to the same typeID, set the property `gemfire.pdx.mapper.sort-json-field-names` to `true`. This
+tells the system to sort the JSON fields prior to serialization, allowing the system to identify
+matching entries, and helps reduce the number of pdx typeIDs that are generated by the serialization
+mechanism.
[2/6] geode git commit: GEODE-2300 Document default names for start
locator/server This closes #362
Posted by ja...@apache.org.
GEODE-2300 Document default names for start locator/server
This closes #362
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/61160bf8
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/61160bf8
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/61160bf8
Branch: refs/heads/feature/GEODE-2367
Commit: 61160bf8aeeb86816bb1919887f6ba01bb2b5ad0
Parents: ad3e35e
Author: Dave Barnes <db...@pivotal.io>
Authored: Wed Jan 25 16:55:27 2017 -0800
Committer: Dave Barnes <db...@pivotal.io>
Committed: Thu Jan 26 11:09:41 2017 -0800
----------------------------------------------------------------------
.../15_minute_quickstart_gfsh.html.md.erb | 4 ++++
.../gfsh/command-pages/start.html.md.erb | 14 +++++++-------
.../tools_modules/gfsh/command_scripting.html.md.erb | 2 +-
.../gfsh/getting_started_gfsh.html.md.erb | 3 ++-
.../tools_modules/gfsh/tour_of_gfsh.html.md.erb | 15 +++++++++++++--
.../client_server_example_configurations.html.md.erb | 2 +-
6 files changed, 28 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/61160bf8/geode-docs/getting_started/15_minute_quickstart_gfsh.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/getting_started/15_minute_quickstart_gfsh.html.md.erb b/geode-docs/getting_started/15_minute_quickstart_gfsh.html.md.erb
index 227fc76..894b998 100644
--- a/geode-docs/getting_started/15_minute_quickstart_gfsh.html.md.erb
+++ b/geode-docs/getting_started/15_minute_quickstart_gfsh.html.md.erb
@@ -69,6 +69,8 @@ The *locator* is a Geode process that tells new, connecting members where runnin
Cluster configuration service is up and running.
```
+If you run `start locator` from gfsh without specifying the member name, gfsh will automatically pick a random member name. This is useful for automation.
+
## <a id="topic_FE3F28ED18E145F787431EC87B676A76__section_02C79BFFB5334E78A5856AE1EB1F1F84" class="no-quick-link"></a>Step 3: Start Pulse
Start up the browser-based Pulse monitoring tool. Pulse is a Web Application that provides a graphical dashboard for monitoring vital, real-time health and performance of Geode clusters, members, and regions. See [Geode Pulse](../tools_modules/pulse/chapter_overview.html).
@@ -96,6 +98,8 @@ gfsh>start server --name=server1 --server-port=40411
This commands starts a cache server named "server1" on the specified port of 40411.
+If you run `start server` from gfsh without specifying the member name, gfsh will automatically pick a random member name. This is useful for automation.
+
Observe the changes (new member and server) in Pulse. Try expanding the distributed system icon to see the locator and cache server graphically.
## <a id="topic_FE3F28ED18E145F787431EC87B676A76__section_3EA12E44B8394C6A9302DF4D14888AF4" class="no-quick-link"></a>Step 5: Create a replicated, persistent region
http://git-wip-us.apache.org/repos/asf/geode/blob/61160bf8/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
index 30ef7c5..eb1d5df 100644
--- a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
+++ b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
@@ -164,7 +164,7 @@ JConsole automatically connects to a running JMX Manager node if one is availabl
Note that you must have a JDK installed (not just a JRE) and the correct PATH and JAVA\_HOME environment variables set.
-See [Browsing Geode MBeans through JConsole](../../../managing/management/mbeans_jconsole.html) for an example of using JConsole with the GeodeGeode management and monitoring system.
+See [Browsing Geode MBeans through JConsole](../../../managing/management/mbeans_jconsole.html) for an example of using JConsole with the Geode management and monitoring system.
**Availability:** Online or offline.
@@ -297,7 +297,7 @@ start locator --name=value [--bind-address=value] [--force(=value)] [--group=val
<tbody>
<tr class="odd">
<td><span class="keyword parmname">\-\-name</span></td>
-<td><em>Required.</em> Name to be used for this GeodeGeode locator service.</td>
+<td>Name to be used for this Geode locator service. If not specified, gfsh generates a random name.</td>
<td>�</td>
</tr>
<tr class="even">
@@ -322,7 +322,7 @@ start locator --name=value [--bind-address=value] [--force(=value)] [--group=val
</tr>
<tr class="even">
<td><span class="keyword parmname">\-\-locators</span></td>
-<td>List of locators used by this locator to join the appropriate GeodeGeode cluster.</td>
+<td>List of locators used by this locator to join the appropriate Geode cluster.</td>
<td>�</td>
</tr>
<tr class="odd">
@@ -332,7 +332,7 @@ start locator --name=value [--bind-address=value] [--force(=value)] [--group=val
</tr>
<tr class="even">
<td><span class="keyword parmname">\-\-mcast-address </span></td>
-<td>IP address or hostname used to bind the UPD socket for multi-cast networking so the locator can locate other members in the GeodeGeode cluster. If mcast-port is zero, then mcast-address is ignored.</td>
+<td>IP address or hostname used to bind the UPD socket for multi-cast networking so the locator can locate other members in the Geode cluster. If mcast-port is zero, then mcast-address is ignored.</td>
<td>�</td>
</tr>
<tr class="odd">
@@ -364,7 +364,7 @@ start locator --name=value [--bind-address=value] [--force(=value)] [--group=val
<td><span class="keyword parmname">\-\-initial-heap</span></td>
<td>Size has the same format as the <code class="ph codeph">-Xmx</code>/<code class="ph codeph">-Xms</code> JVM options.
<div class="note note">
-<b>Note:</b> If you use the <code class="ph codeph">-J-Xms</code> and <code class="ph codeph">-J-Xmx</code> JVM properties instead of <code class="ph codeph">-initial-heap</code> and <code class="ph codeph">-max-heap</code>, then GeodeGeode does not use default JVM resource management properties. If you use the JVM properties, you must then specify all properties manually for eviction, garbage collection, heap percentage, and so forth.
+<b>Note:</b> If you use the <code class="ph codeph">-J-Xms</code> and <code class="ph codeph">-J-Xmx</code> JVM properties instead of <code class="ph codeph">-initial-heap</code> and <code class="ph codeph">-max-heap</code>, then Geode does not use default JVM resource management properties. If you use the JVM properties, you must then specify all properties manually for eviction, garbage collection, heap percentage, and so forth.
</div></td>
<td>�</td>
</tr>
@@ -372,7 +372,7 @@ start locator --name=value [--bind-address=value] [--force(=value)] [--group=val
<td><span class="keyword parmname">\-\-max-heap</span></td>
<td>Size has the same format as the <code class="ph codeph">-Xmx</code>/<code class="ph codeph">-Xms</code> JVM options
<div class="note note">
-<b>Note:</b> If you use the <code class="ph codeph">-J-Xms</code> and <code class="ph codeph">-J-Xmx</code> JVM properties instead of <code class="ph codeph">-initial-heap</code> and <code class="ph codeph">-max-heap</code>, then GeodeGeode does not use default JVM resource management properties. If you use the JVM properties, you must then specify all properties manually for eviction, garbage collection, heap percentage, and so forth.
+<b>Note:</b> If you use the <code class="ph codeph">-J-Xms</code> and <code class="ph codeph">-J-Xmx</code> JVM properties instead of <code class="ph codeph">-initial-heap</code> and <code class="ph codeph">-max-heap</code>, then Geode does not use default JVM resource management properties. If you use the JVM properties, you must then specify all properties manually for eviction, garbage collection, heap percentage, and so forth.
</div></td>
<td>�</td>
</tr>
@@ -523,7 +523,7 @@ start server --name=value [--assign-buckets(=value)] [--bind-address=value]
<tbody>
<tr class="odd">
<td><span class="keyword parmname">\-\-name</span></td>
-<td><em>Required.</em> Member name for this Geode Cache Server service.</td>
+<td>Member name for this Geode Cache Server service. If not specified, gfsh generates a random name.</td>
<td>�</td>
</tr>
<tr class="even">
http://git-wip-us.apache.org/repos/asf/geode/blob/61160bf8/geode-docs/tools_modules/gfsh/command_scripting.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/tools_modules/gfsh/command_scripting.html.md.erb b/geode-docs/tools_modules/gfsh/command_scripting.html.md.erb
index 391d67f..c4f524f 100644
--- a/geode-docs/tools_modules/gfsh/command_scripting.html.md.erb
+++ b/geode-docs/tools_modules/gfsh/command_scripting.html.md.erb
@@ -34,4 +34,4 @@ When you run a gfsh script, interactive parameters are ignored. You can also set
Your command history file can be helpful when you write a gfsh script. A history of commands that have been executed successfully is logged in the `.gfsh.history` file in the home directory of the user running gfsh. You can also export a history file with the `history --file=your_file_name` command.
-
+When a user runs `start server` or `start locator` from gfsh without specifying the member name, gfsh will automatically pick a random member name. This is useful for automation.
http://git-wip-us.apache.org/repos/asf/geode/blob/61160bf8/geode-docs/tools_modules/gfsh/getting_started_gfsh.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/tools_modules/gfsh/getting_started_gfsh.html.md.erb b/geode-docs/tools_modules/gfsh/getting_started_gfsh.html.md.erb
index 9609971..3a2b8f9 100644
--- a/geode-docs/tools_modules/gfsh/getting_started_gfsh.html.md.erb
+++ b/geode-docs/tools_modules/gfsh/getting_started_gfsh.html.md.erb
@@ -117,7 +117,8 @@ start data-browser start jconsole start jvisualvm
start locator start pulse start server
```
-Hitting tab after `start locator` will populate the required `--name` parameter after the command.
+Hitting tab after `start locator` will populate the `--name` parameter after the command.
+(If you do not specify a member name, gfsh will automatically pick a random name. This is useful for automation.)
**Access command history with the Up arrow.**
http://git-wip-us.apache.org/repos/asf/geode/blob/61160bf8/geode-docs/tools_modules/gfsh/tour_of_gfsh.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/tools_modules/gfsh/tour_of_gfsh.html.md.erb b/geode-docs/tools_modules/gfsh/tour_of_gfsh.html.md.erb
index ca21d39..4120641 100644
--- a/geode-docs/tools_modules/gfsh/tour_of_gfsh.html.md.erb
+++ b/geode-docs/tools_modules/gfsh/tour_of_gfsh.html.md.erb
@@ -71,7 +71,12 @@ Successfully connected to: [host=ubuntu.local, port=1099]
Cluster configuration service is up and running.
```
-In your file system, examine the folder location where you executed `gfsh`. Notice that the `start locator` command has automatically created a working directory (using the name of the locator), and within that working directory, it has created a log file, a status file, and a .pid (containing the locator's process ID) for this locator.
+If you run `start locator` from gfsh without specifying the member name, gfsh will automatically pick a random member name. This is useful for automation.
+
+In your file system, examine the folder location where you executed `gfsh`. Notice that the `start
+locator` command has automatically created a working directory (using the name of the locator), and
+within that working directory, it has created a log file, a status file, and a .pid (containing the
+locator's process ID) for this locator.
In addition, because no other JMX Manager exists yet, notice that `gfsh` has automatically started an embedded JMX Manager on port 1099 within the locator and has connected you to that JMX Manager.
@@ -178,7 +183,13 @@ JVM Arguments: -Dgemfire.locators=localhost[10334] -Dgemfire.use-cluster-configu
Class-Path: /home/username/Pivotal_GemFire_810_b50582_Linux/lib/gemfire.jar:/home/username/Pivotal_GemFire_810_b50582_Linux/lib/server-dependencies.jar
```
-In your file system, examine the folder location where you executed `gfsh`. Notice that just like the `start locator` command, the `start server` command has automatically created a working directory (named after the server), and within that working directory, it has created a log file and a .pid (containing the server's process ID) for this cache server. In addition, it has also written log files.
+If you run `start server` from gfsh without specifying the member name, gfsh will automatically pick a random member name. This is useful for automation.
+
+In your file system, examine the folder location where you executed `gfsh`. Notice that just like
+the `start locator` command, the `start server` command has automatically created a working
+directory (named after the server), and within that working directory, it has created a log file and
+a .pid (containing the server's process ID) for this cache server. In addition, it has also written
+log files.
**Step 7: List members.** Use the `list members` command to view the current members of the Apache Geode distributed system you have just created.
http://git-wip-us.apache.org/repos/asf/geode/blob/61160bf8/geode-docs/topologies_and_comm/cs_configuration/client_server_example_configurations.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/topologies_and_comm/cs_configuration/client_server_example_configurations.html.md.erb b/geode-docs/topologies_and_comm/cs_configuration/client_server_example_configurations.html.md.erb
index 3b30c46..eeafbe5 100644
--- a/geode-docs/topologies_and_comm/cs_configuration/client_server_example_configurations.html.md.erb
+++ b/geode-docs/topologies_and_comm/cs_configuration/client_server_example_configurations.html.md.erb
@@ -42,7 +42,7 @@ Or directly from a command line:
prompt# gfsh start locator --name=locator_name --port=41111
```
-Specify a name for the locator that you wish to start on the localhost.
+Specify a name for the locator that you wish to start on the localhost. If you do not specify the member name, gfsh will automatically pick a random name. This is useful for automation.
The server\u2019s `cache.xml` declares a `cache-server` element, which identifies the JVM as a server in the distributed system.
[6/6] geode git commit: GEODE-2367: Lucene indexes do not handle ha
scenarios
Posted by ja...@apache.org.
GEODE-2367: Lucene indexes do not handle ha scenarios
* Added afterSecondary callback to partition listener to allow cleaning up
of the index repo when the bucket losses primary
* Added lock prior to creating the bucket indexes to prevent multiple index
writers from being available at a time
* Changed single point of lucene index creation, no longer creating on the fly
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/072413fe
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/072413fe
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/072413fe
Branch: refs/heads/feature/GEODE-2367
Commit: 072413fe2cb86ddf5093548d7c847b43c0775811
Parents: 0a1f762
Author: Jason Huynh <hu...@gmail.com>
Authored: Wed Jan 25 17:12:23 2017 -0800
Committer: Jason Huynh <hu...@gmail.com>
Committed: Thu Jan 26 22:57:26 2017 -0800
----------------------------------------------------------------------
.../cache/partition/PartitionListener.java | 11 +++++
.../geode/internal/cache/BucketAdvisor.java | 15 ++++++-
.../AbstractPartitionedRepositoryManager.java | 37 +++++++++-------
.../lucene/internal/IndexRepositoryFactory.java | 44 ++++++++++++++++----
.../lucene/internal/LuceneEventListener.java | 4 +-
.../internal/LucenePrimaryBucketListener.java | 16 ++++++-
.../cache/lucene/internal/LuceneQueryImpl.java | 36 +++++++++++-----
.../internal/RawIndexRepositoryFactory.java | 3 +-
.../internal/RawLuceneRepositoryManager.java | 19 +++++++++
.../internal/distributed/LuceneFunction.java | 5 ++-
.../repository/IndexRepositoryImpl.java | 37 +++++++++++++---
.../PartitionedRepositoryManagerJUnitTest.java | 12 +++++-
.../RawLuceneRepositoryManagerJUnitTest.java | 6 ++-
.../DistributedScoringJUnitTest.java | 2 +-
.../distributed/LuceneFunctionJUnitTest.java | 27 ++++++------
.../IndexRepositoryImplJUnitTest.java | 4 +-
16 files changed, 217 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionListener.java b/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionListener.java
index a534e50..deb319f 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionListener.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionListener.java
@@ -71,6 +71,16 @@ public interface PartitionListener {
public void afterPrimary(int bucketId);
/**
+ * Callback invoked when any bucket in a partitioned region stops being primary
+ *
+ * @param bucketId id of the bucket which stopped being primary
+ * @since Geode 1.1
+ */
+ default public void afterSecondary(int bucketId) {
+
+ }
+
+ /**
* Callback invoked when a partition region is created
*
* @param region handle of the region which is created
@@ -99,4 +109,5 @@ public interface PartitionListener {
* @since GemFire 6.6.1
*/
public void afterBucketCreated(int bucketId, Iterable<?> keys);
+
}
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
index 7b79bfb..8b8705a 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
@@ -46,7 +46,6 @@ import org.apache.logging.log4j.Logger;
import java.io.*;
import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
@@ -953,6 +952,7 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
}
} finally {
if (lostPrimary) {
+ invokeAfterSecondaryInPartitionListeners();
Bucket br = this.regionAdvisor.getBucket(getBucket().getId());
if (br != null && br instanceof BucketRegion) {
((BucketRegion) br).beforeReleasingPrimaryLockDuringDemotion();
@@ -1283,6 +1283,19 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
}
}
+ private void invokeAfterSecondaryInPartitionListeners() {
+ PartitionListener[] listeners = this.pRegion.getPartitionListeners();
+ if (listeners == null || listeners.length == 0) {
+ return;
+ }
+ for (int i = 0; i < listeners.length; i++) {
+ PartitionListener listener = listeners[i];
+ if (listener != null) {
+ listener.afterSecondary(getBucket().getId());
+ }
+ }
+ }
+
/**
* Lazily gets the lock for acquiring primary lock. Caller must handle null. If DLS, Cache, or
* DistributedSystem are shutting down then null will be returned. If DLS does not yet exist and
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/AbstractPartitionedRepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/AbstractPartitionedRepositoryManager.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/AbstractPartitionedRepositoryManager.java
index aa29e1b..9e055f0 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/AbstractPartitionedRepositoryManager.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/AbstractPartitionedRepositoryManager.java
@@ -18,7 +18,10 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
+import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.cache.Region;
@@ -91,16 +94,8 @@ public abstract class AbstractPartitionedRepositoryManager implements Repository
LuceneSerializer serializer, LuceneIndexImpl index, PartitionedRegion userRegion)
throws IOException;
- /**
- * Return the repository for a given user bucket
- */
- protected IndexRepository getRepository(Integer bucketId) throws BucketNotFoundException {
- IndexRepository repo = indexRepositories.get(bucketId);
- if (repo != null && !repo.isClosed()) {
- return repo;
- }
-
- repo = indexRepositories.compute(bucketId, (key, oldRepository) -> {
+ protected IndexRepository createRepository(Integer bucketId) throws BucketNotFoundException {
+ IndexRepository repo = indexRepositories.compute(bucketId, (key, oldRepository) -> {
if (oldRepository != null && !oldRepository.isClosed()) {
return oldRepository;
}
@@ -115,12 +110,26 @@ public abstract class AbstractPartitionedRepositoryManager implements Repository
}
});
+ return repo;
+ }
- if (repo == null) {
- throw new BucketNotFoundException(
- "Colocated index buckets not found for bucket id " + bucketId);
+ /**
+ * Return the repository for a given user bucket
+ */
+ protected IndexRepository getRepository(Integer bucketId) throws BucketNotFoundException {
+ IndexRepository repo = indexRepositories.get(bucketId);
+ if (repo != null && !repo.isClosed()) {
+ return repo;
}
- return repo;
+ throw new BucketNotFoundException(
+ "Colocated index buckets not found for bucket id " + bucketId);
+ }
+
+ protected void cleanRepository(Integer bucketId) throws BucketNotFoundException {
+ IndexRepository repo = indexRepositories.remove(bucketId);
+ if (repo != null) {
+ repo.cleanup();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
index c73d64a..5be17e3 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
@@ -20,15 +20,24 @@ import org.apache.geode.cache.lucene.internal.directory.RegionDirectory;
import org.apache.geode.cache.lucene.internal.repository.IndexRepository;
import org.apache.geode.cache.lucene.internal.repository.IndexRepositoryImpl;
import org.apache.geode.cache.lucene.internal.repository.serializer.LuceneSerializer;
+import org.apache.geode.cache.partition.PartitionRegionHelper;
+import org.apache.geode.distributed.DistributedLockService;
import org.apache.geode.internal.cache.BucketNotFoundException;
import org.apache.geode.internal.cache.BucketRegion;
import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.PartitionedRegionHelper;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.logging.log4j.Logger;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
+import org.jgroups.blocks.locking.LockService;
public class IndexRepositoryFactory {
+ private static final Logger logger = LogService.getLogger();
+ public static final String FILE_REGION_LOCK_FOR_BUCKET_ID = "FileRegionLockForBucketId:";
+
public IndexRepositoryFactory() {}
public IndexRepository createIndexRepository(final Integer bucketId, LuceneSerializer serializer,
@@ -38,16 +47,37 @@ public class IndexRepositoryFactory {
BucketRegion fileBucket = getMatchingBucket(indexForPR.getFileRegion(), bucketId);
BucketRegion chunkBucket = getMatchingBucket(indexForPR.getChunkRegion(), bucketId);
BucketRegion dataBucket = getMatchingBucket(userRegion, bucketId);
+ boolean success = false;
if (fileBucket == null || chunkBucket == null) {
return null;
}
- RegionDirectory dir =
- new RegionDirectory(fileBucket, chunkBucket, indexForPR.getFileSystemStats());
- IndexWriterConfig config = new IndexWriterConfig(indexForPR.getAnalyzer());
- IndexWriter writer = new IndexWriter(dir, config);
- repo = new IndexRepositoryImpl(fileBucket, writer, serializer, indexForPR.getIndexStats(),
- dataBucket);
- return repo;
+ if (!fileBucket.getBucketAdvisor().isPrimary()) {
+ throw new IOException("Not creating the index because we are not the primary");
+ }
+ DistributedLockService lockService =
+ DistributedLockService.getServiceNamed(PartitionedRegionHelper.PARTITION_LOCK_SERVICE_NAME);
+ String lockName = FILE_REGION_LOCK_FOR_BUCKET_ID + fileBucket.getFullPath() + bucketId;
+ if (lockService != null) {
+ // lockService will be null for testing at this point
+ lockService.lock(lockName, -1, -1);
+ }
+ try {
+ RegionDirectory dir =
+ new RegionDirectory(fileBucket, chunkBucket, indexForPR.getFileSystemStats());
+ IndexWriterConfig config = new IndexWriterConfig(indexForPR.getAnalyzer());
+ IndexWriter writer = new IndexWriter(dir, config);
+ repo = new IndexRepositoryImpl(fileBucket, writer, serializer, indexForPR.getIndexStats(),
+ dataBucket, lockService, lockName);
+ success = true;
+ return repo;
+ } finally {
+ if (!success) {
+ if (lockService != null) {
+ lockService.unlock(lockName);
+ }
+ }
+ }
+
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
index f2c7c8f..44453e4 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
@@ -21,7 +21,7 @@ import java.util.List;
import java.util.Set;
import org.apache.logging.log4j.Logger;
-
+import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.cache.Operation;
import org.apache.geode.cache.Region;
@@ -91,7 +91,7 @@ public class LuceneEventListener implements AsyncEventListener {
} catch (BucketNotFoundException | RegionDestroyedException | PrimaryBucketException e) {
logger.debug("Bucket not found while saving to lucene index: " + e.getMessage());
return false;
- } catch (IOException e) {
+ } catch (IOException | CacheClosedException e) {
logger.error("Unable to save to lucene index", e);
return false;
} finally {
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LucenePrimaryBucketListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LucenePrimaryBucketListener.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LucenePrimaryBucketListener.java
index d17b5f2..87cce3e 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LucenePrimaryBucketListener.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LucenePrimaryBucketListener.java
@@ -37,7 +37,7 @@ public class LucenePrimaryBucketListener extends PartitionListenerAdapter {
public void afterPrimary(int bucketId) {
dm.getWaitingThreadPool().execute(() -> {
try {
- lucenePartitionRepositoryManager.getRepository(bucketId);
+ lucenePartitionRepositoryManager.createRepository(bucketId);
} catch (BucketNotFoundException e) {
logger.warn(
"Index repository could not be created when index chunk region bucket became primary. "
@@ -46,4 +46,18 @@ public class LucenePrimaryBucketListener extends PartitionListenerAdapter {
}
});
}
+
+ public void afterBucketRemoved(int bucketId, Iterable<?> keys) {
+ afterSecondary(bucketId);
+ }
+
+ public void afterSecondary(int bucketId) {
+ dm.getWaitingThreadPool().execute(() -> {
+ try {
+ lucenePartitionRepositoryManager.cleanRepository(bucketId);
+ } catch (Exception e) {
+ logger.warn("Exception while cleaning up Lucene Index Repository", e);
+ }
+ });
+ }
}
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
index 77333d4..b4111cb 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
@@ -38,8 +38,14 @@ import org.apache.geode.cache.lucene.internal.distributed.TopEntries;
import org.apache.geode.cache.lucene.internal.distributed.TopEntriesCollector;
import org.apache.geode.cache.lucene.internal.distributed.TopEntriesCollectorManager;
import org.apache.geode.cache.lucene.internal.distributed.TopEntriesFunctionCollector;
+import org.apache.geode.internal.cache.BucketNotFoundException;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.logging.log4j.Logger;
public class LuceneQueryImpl<K, V> implements LuceneQuery<K, V> {
+ Logger logger = LogService.getLogger();
+ private final static int MAX_TRIES = 100;
+
private int limit = LuceneQueryFactory.DEFAULT_LIMIT;
private int pageSize = LuceneQueryFactory.DEFAULT_PAGESIZE;
private String indexName;
@@ -101,19 +107,27 @@ public class LuceneQueryImpl<K, V> implements LuceneQuery<K, V> {
new LuceneFunctionContext<>(query, indexName, manager, limit);
TopEntriesFunctionCollector collector = new TopEntriesFunctionCollector(context);
- ResultCollector<TopEntriesCollector, TopEntries<K>> rc =
- (ResultCollector<TopEntriesCollector, TopEntries<K>>) onRegion().withArgs(context)
- .withCollector(collector).execute(LuceneFunction.ID);
+
// TODO provide a timeout to the user?
- TopEntries<K> entries;
- try {
- entries = rc.getResult();
- } catch (FunctionException e) {
- if (e.getCause() instanceof LuceneQueryException) {
- throw new LuceneQueryException(e);
- } else {
- throw e;
+ TopEntries<K> entries = null;
+ int numTries = 0;
+ while (entries == null && numTries++ < MAX_TRIES) {
+ try {
+ ResultCollector<TopEntriesCollector, TopEntries<K>> rc =
+ (ResultCollector<TopEntriesCollector, TopEntries<K>>) onRegion().withArgs(context)
+ .withCollector(collector).execute(LuceneFunction.ID);
+ entries = rc.getResult();
+ } catch (FunctionException e) {
+ if (e.getCause() instanceof LuceneQueryException) {
+ throw new LuceneQueryException(e);
+ } else if (e.getCause() instanceof BucketNotFoundException) {
+ logger.debug("Retrying due to index on bucket not found:" + e);
+ // throw e;
+ } else {
+ e.printStackTrace();
+ throw e;
+ }
}
}
return entries;
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawIndexRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawIndexRepositoryFactory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawIndexRepositoryFactory.java
index 2afccf9..2f61913 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawIndexRepositoryFactory.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawIndexRepositoryFactory.java
@@ -53,7 +53,8 @@ public class RawIndexRepositoryFactory extends IndexRepositoryFactory {
}
IndexWriterConfig config = new IndexWriterConfig(indexForRaw.getAnalyzer());
IndexWriter writer = new IndexWriter(dir, config);
+
return new IndexRepositoryImpl(null, writer, serializer, indexForRaw.getIndexStats(),
- dataBucket);
+ dataBucket, null, "");
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
index 64f2e56..b503692 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
@@ -16,6 +16,7 @@ package org.apache.geode.cache.lucene.internal;
import java.io.IOException;
+import org.apache.geode.cache.Region;
import org.apache.geode.cache.lucene.internal.repository.IndexRepository;
import org.apache.geode.cache.lucene.internal.repository.serializer.LuceneSerializer;
import org.apache.geode.internal.cache.BucketNotFoundException;
@@ -35,6 +36,24 @@ public class RawLuceneRepositoryManager extends AbstractPartitionedRepositoryMan
}
@Override
+ protected IndexRepository getRepository(Integer bucketId) throws BucketNotFoundException {
+ IndexRepository repo = indexRepositories.get(bucketId);
+ if (repo != null && !repo.isClosed()) {
+ return repo;
+ }
+
+ try {
+ repo = createOneIndexRepository(bucketId, this.serializer, this.index, this.userRegion);
+ return repo;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ throw new BucketNotFoundException(
+ "Colocated index buckets not found for bucket id " + bucketId);
+ }
+
+ @Override
public IndexRepository createOneIndexRepository(Integer bucketId, LuceneSerializer serializer,
LuceneIndexImpl index, PartitionedRegion userRegion) throws IOException {
return indexRepositoryFactory.createIndexRepository(bucketId, serializer, index, userRegion);
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunction.java
index ec94469..5271a2f 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunction.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunction.java
@@ -98,8 +98,11 @@ public class LuceneFunction extends FunctionAdapter implements InternalEntity {
TopEntriesCollector mergedResult = null;
try {
long start = stats.startQuery();
+ Collection<IndexRepository> repositories = null;
+
try {
- Collection<IndexRepository> repositories = repoManager.getRepositories(ctx);
+ repositories = repoManager.getRepositories(ctx);
+
for (IndexRepository repo : repositories) {
IndexResultCollector collector = manager.newCollector(repo.toString());
if (logger.isDebugEnabled()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
index 4e86eb5..f1ee987 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
@@ -19,8 +19,10 @@ import org.apache.geode.cache.Region;
import org.apache.geode.cache.lucene.internal.LuceneIndexStats;
import org.apache.geode.cache.lucene.internal.repository.serializer.LuceneSerializer;
import org.apache.geode.cache.lucene.internal.repository.serializer.SerializerUtil;
+import org.apache.geode.distributed.DistributedLockService;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.cache.BucketRegion;
+import org.apache.geode.internal.cache.DistributedRegion;
import org.apache.geode.internal.logging.LogService;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.document.Document;
@@ -28,6 +30,7 @@ import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.*;
import org.apache.lucene.store.AlreadyClosedException;
+import org.apache.geode.distributed.LockNotHeldException;
import java.io.IOException;
import java.util.function.IntSupplier;
@@ -48,11 +51,21 @@ public class IndexRepositoryImpl implements IndexRepository {
private Region<?, ?> userRegion;
private LuceneIndexStats stats;
private DocumentCountSupplier documentCountSupplier;
+ private DistributedLockService lockService;
+ private String lockName;
private static final Logger logger = LogService.getLogger();
- public IndexRepositoryImpl(Region<?, ?> region, IndexWriter writer, LuceneSerializer serializer,
+ // For test purposes
+ IndexRepositoryImpl(Region<?, ?> region, IndexWriter writer, LuceneSerializer serializer,
LuceneIndexStats stats, Region<?, ?> userRegion) throws IOException {
+ this(region, writer, serializer, stats, userRegion,
+ ((DistributedRegion) region).getLockService(), "NoLockFile");
+ }
+
+ public IndexRepositoryImpl(Region<?, ?> region, IndexWriter writer, LuceneSerializer serializer,
+ LuceneIndexStats stats, Region<?, ?> userRegion, DistributedLockService lockService,
+ String lockName) throws IOException {
this.region = region;
this.userRegion = userRegion;
this.writer = writer;
@@ -61,6 +74,8 @@ public class IndexRepositoryImpl implements IndexRepository {
this.stats = stats;
documentCountSupplier = new DocumentCountSupplier();
stats.addDocumentsSupplier(documentCountSupplier);
+ this.lockService = lockService;
+ this.lockName = lockName;
}
@Override
@@ -148,16 +163,26 @@ public class IndexRepositoryImpl implements IndexRepository {
@Override
public boolean isClosed() {
- return userRegion.isDestroyed();
+ return userRegion.isDestroyed() || !writer.isOpen();
}
@Override
public void cleanup() {
- stats.removeDocumentsSupplier(documentCountSupplier);
try {
- writer.close();
- } catch (IOException e) {
- logger.warn("Unable to clean up index repository", e);
+ stats.removeDocumentsSupplier(documentCountSupplier);
+ try {
+ writer.close();
+ } catch (IOException e) {
+ logger.warn("Unable to clean up index repository", e);
+ }
+ } finally {
+ try {
+ if (lockService != null) {
+ lockService.unlock(lockName);
+ }
+ } catch (LockNotHeldException e) {
+ logger.debug("Tried to unlock file region lock(" + lockName + ") that we did not hold", e);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
index 960d794..1c47e89 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
@@ -27,6 +27,9 @@ import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
+import org.apache.geode.distributed.DistributedLockService;
+import org.apache.geode.internal.cache.BucketAdvisor;
+import org.apache.geode.internal.cache.partitioned.Bucket;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.index.IndexWriter;
import org.junit.Before;
@@ -228,7 +231,7 @@ public class PartitionedRepositoryManagerJUnitTest {
assertEquals(serializer, repo0.getSerializer());
}
- protected BucketRegion setUpMockBucket(int id) {
+ protected BucketRegion setUpMockBucket(int id) throws BucketNotFoundException {
BucketRegion mockBucket = Mockito.mock(BucketRegion.class);
BucketRegion fileBucket = Mockito.mock(BucketRegion.class);
// Allowing the fileBucket to behave like a map so that the IndexWriter operations don't fail
@@ -245,6 +248,13 @@ public class PartitionedRepositoryManagerJUnitTest {
fileBuckets.put(id, fileBucket);
chunkBuckets.put(id, chunkBucket);
dataBuckets.put(id, mockBucket);
+
+ BucketAdvisor mockBucketAdvisor = Mockito.mock(BucketAdvisor.class);
+ DistributedLockService lockService = Mockito.mock(DistributedLockService.class);
+ when(fileBucket.getLockService()).thenReturn(lockService);
+ when(fileBucket.getBucketAdvisor()).thenReturn(mockBucketAdvisor);
+ when(mockBucketAdvisor.isPrimary()).thenReturn(true);
+ repoManager.createRepository(mockBucket.getId());
return mockBucket;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManagerJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManagerJUnitTest.java
index 9201180..a9fb52b 100755
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManagerJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManagerJUnitTest.java
@@ -19,6 +19,8 @@ import static org.mockito.Mockito.when;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
+import org.apache.geode.distributed.DistributedLockService;
+import org.apache.geode.internal.cache.BucketAdvisor;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.store.Directory;
@@ -73,7 +75,7 @@ public class RawLuceneRepositoryManagerJUnitTest extends PartitionedRepositoryMa
}
@Override
- protected BucketRegion setUpMockBucket(int id) {
+ protected BucketRegion setUpMockBucket(int id) throws BucketNotFoundException {
BucketRegion mockBucket = Mockito.mock(BucketRegion.class);
when(mockBucket.getId()).thenReturn(id);
when(userRegion.getBucketRegion(eq(id), eq(null))).thenReturn(mockBucket);
@@ -81,6 +83,8 @@ public class RawLuceneRepositoryManagerJUnitTest extends PartitionedRepositoryMa
when(userRegion.getBucketRegion(eq(id + 113), eq(null))).thenReturn(mockBucket);
when(userDataStore.getLocalBucketById(eq(id + 113))).thenReturn(mockBucket);
dataBuckets.put(id, mockBucket);
+
+ repoManager.createRepository(mockBucket.getId());
return mockBucket;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/DistributedScoringJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/DistributedScoringJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/DistributedScoringJUnitTest.java
index 225f6ac..6062904 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/DistributedScoringJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/DistributedScoringJUnitTest.java
@@ -139,7 +139,7 @@ public class DistributedScoringJUnitTest {
IndexWriterConfig config = new IndexWriterConfig(analyzer);
IndexWriter writer = new IndexWriter(dir, config);
- return new IndexRepositoryImpl(region, writer, mapper, indexStats, null);
+ return new IndexRepositoryImpl(region, writer, mapper, indexStats, null, null, "");
}
private static class TestType {
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunctionJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunctionJUnitTest.java
index 71172f0..fe05248 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunctionJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunctionJUnitTest.java
@@ -209,19 +209,20 @@ public class LuceneFunctionJUnitTest {
function.execute(mockContext);
}
- @Test(expected = FunctionException.class)
- public void testBucketNotFound() throws Exception {
- when(mockContext.getDataSet()).thenReturn(mockRegion);
- when(mockContext.getArguments()).thenReturn(searchArgs);
- when(mockContext.<TopEntriesCollector>getResultSender()).thenReturn(mockResultSender);
- when(mockRepoManager.getRepositories(eq(mockContext)))
- .thenThrow(new BucketNotFoundException(""));
- LuceneFunction function = new LuceneFunction();
-
- function.execute(mockContext);
-
- verify(mockResultSender).sendException(any(BucketNotFoundException.class));
- }
+ // Disabled currently as we are retrying the function if a bucket is not found
+ // @Test(expected = FunctionException.class)
+ // public void testBucketNotFound() throws Exception {
+ // when(mockContext.getDataSet()).thenReturn(mockRegion);
+ // when(mockContext.getArguments()).thenReturn(searchArgs);
+ // when(mockContext.<TopEntriesCollector>getResultSender()).thenReturn(mockResultSender);
+ // when(mockRepoManager.getRepositories(eq(mockContext)))
+ // .thenThrow(new BucketNotFoundException(""));
+ // LuceneFunction function = new LuceneFunction();
+ //
+ // function.execute(mockContext);
+ //
+ // verify(mockResultSender).sendException(any(BucketNotFoundException.class));
+ // }
@Test(expected = FunctionException.class)
public void testReduceError() throws Exception {
http://git-wip-us.apache.org/repos/asf/geode/blob/072413fe/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java
index 7426fa5..42cc2bc 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java
@@ -27,6 +27,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.IntSupplier;
+import org.apache.geode.distributed.DistributedLockService;
import org.apache.geode.internal.cache.BucketAdvisor;
import org.apache.geode.internal.cache.BucketRegion;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
@@ -85,7 +86,8 @@ public class IndexRepositoryImplJUnitTest {
Mockito.when(((BucketRegion) userRegion).getBucketAdvisor().isPrimary()).thenReturn(true);
stats = Mockito.mock(LuceneIndexStats.class);
Mockito.when(userRegion.isDestroyed()).thenReturn(false);
- repo = new IndexRepositoryImpl(region, writer, mapper, stats, userRegion);
+ repo = new IndexRepositoryImpl(region, writer, mapper, stats, userRegion,
+ mock(DistributedLockService.class), "lockName");
}
@Test
[3/6] geode git commit: Merge branch 'feature/GEODE-2353' into develop
Posted by ja...@apache.org.
Merge branch 'feature/GEODE-2353' into develop
GEODE-2353: Verify no clear-text passwords in documentation. This closes #364.
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/9ff51ea5
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/9ff51ea5
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/9ff51ea5
Branch: refs/heads/feature/GEODE-2367
Commit: 9ff51ea59c7ffc5aa4e2e218cc4f4987f9dfd453
Parents: 61160bf 7a24855
Author: Dave Barnes <db...@pivotal.io>
Authored: Thu Jan 26 11:15:35 2017 -0800
Committer: Dave Barnes <db...@pivotal.io>
Committed: Thu Jan 26 11:17:32 2017 -0800
----------------------------------------------------------------------
geode-docs/tools_modules/gfsh/command-pages/connect.html.md.erb | 2 +-
geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/9ff51ea5/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
----------------------------------------------------------------------