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

[map] containsKey return true even the key is not exist in the map #10923

Closed
jmchen opened this issue Jul 13, 2017 · 5 comments
Closed

[map] containsKey return true even the key is not exist in the map #10923

jmchen opened this issue Jul 13, 2017 · 5 comments

Comments

@jmchen
Copy link

@jmchen jmchen commented Jul 13, 2017

Hazelcast version is 3.8.3
Cluster size is 1
Java version 1.8
Operating system MacOS 10.12.5

Reproduce steps:

  1. Make sure the map doesn't have key "somekey".
  2. Call m.get("somekey"), it will return null.
  3. Call m.containsKey("somekey"), it returns true.
@ahmetmircik
Copy link
Member

@ahmetmircik ahmetmircik commented Jul 13, 2017

Can you please share your configuration?

@jmchen
Copy link
Author

@jmchen jmchen commented Jul 13, 2017

mint-platform-main **** ** 30 true 1 60 true slf4j 180 120 30 30000 0 128M false 0 10000 true 16 30 5701 224.2.2.3 54327 2 32 127.0.0.1 null null us-east-1 null null null 127.0.0.1
 <map name="applicationRegistryMap">
      <in-memory-format>BINARY</in-memory-format>
      <backup-count>2</backup-count>
      <async-backup-count>0</async-backup-count>
      <time-to-live-seconds>0</time-to-live-seconds>
      <max-idle-seconds>0</max-idle-seconds>
      <eviction-policy>NONE</eviction-policy>
      <max-size policy="PER_NODE">2147483647</max-size>
      <eviction-percentage>25</eviction-percentage>
      <min-eviction-check-millis>100</min-eviction-check-millis>
      <read-backup-data>false</read-backup-data>
      <hot-restart enabled="false">
           <fsync>false</fsync>
      </hot-restart>
      <statistics-enabled>true</statistics-enabled>
      <map-store enabled="false">
           <class-name>null</class-name>
           <write-delay-seconds>0</write-delay-seconds>
           <write-batch-size>1</write-batch-size>
      </map-store>
 </map>
 <topic name="default">
      <global-ordering-enabled>false</global-ordering-enabled>
      <multi-threading-enabled>false</multi-threading-enabled>
 </topic>
 <executor-service name="default">
      <pool-size>16</pool-size>
      <queue-capacity>2147483647</queue-capacity>
 </executor-service>
 <partition-group enabled="false" group-type="PER_MEMBER"/>
 <listeners>
      <listener>com.uxpsystems.mint.framework.commons.hazelcast.listener.ClusterMembershipListener</listener>
      <listener>com.uxpsystems.mint.framework.commons.hazelcast.listener.ServerLifecycleListener</listener>
 </listeners>
 <lite-member enabled="false"/>
 <hot-restart-persistence enabled="false">
      <base-dir>/Users/echen/2-app-svr/apache-tomcat-8.5.3/bin/hot-restart</base-dir>
      <parallelism>1</parallelism>
      <validation-timeout-seconds>120</validation-timeout-seconds>
      <data-load-timeout-seconds>900</data-load-timeout-seconds>
 </hot-restart-persistence>
@mmedenjak mmedenjak added this to the 3.9 milestone Jul 13, 2017
@mmedenjak mmedenjak changed the title containsKey return true even the key is not exist in the map [map] containsKey return true even the key is not exist in the map Jul 13, 2017
@ahmetmircik ahmetmircik modified the milestones: 3.8.4, 3.9 Jul 14, 2017
@ahmetmircik
Copy link
Member

@ahmetmircik ahmetmircik commented Jul 14, 2017

@jmchen seems it is not reproducible with the configuration you sent but i think there should also be a near-cache configured?

@ahmetmircik
Copy link
Member

@ahmetmircik ahmetmircik commented Jul 14, 2017

should be closed by #10927

@mishraakashmyself
Copy link

@mishraakashmyself mishraakashmyself commented Mar 30, 2021

Nope. Should now return true if key does not exist.;

Tried following code

Map<String, String> employees = new HashMap<>();

    // keys and values (Name, Department)
    employees.put("John", "HR");
    employees.put("Eric", "IT");
    employees.put("Joe", "LEGAL");

    if (employees.containsKey("No-Key")) {
        System.out.format("Key Exist");
    } else {
        System.out.format("Key Does not Exist");
    }

Output: Key Does not Exist

There is some Hashmap example and solutions are given Here which you may like.

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

Successfully merging a pull request may close this issue.

None yet
4 participants