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

list<string> values not accessible #2478

Closed
andrii0lomakin opened this issue Jun 13, 2014 · 10 comments
Closed

list<string> values not accessible #2478

andrii0lomakin opened this issue Jun 13, 2014 · 10 comments
Assignees
Milestone

Comments

@andrii0lomakin
Copy link
Member

Hi

I am using Orient 1.7.2 with Blueprints 2.5.0. When I call

vertex.setProperty(key, value);

where value is a List, the data goes missing. I cannot retrieve it again.

More generally, some users, that certain vertexes are missing from the db. We're still busy investigating...

Here is our setProperty function:

@OverRide
public void setProperty(String key, Object value) {
if (key!=null && value!=null) {
int attempt = 0;
while(attempt<Database.MAX_ATTEMPTS) {
try {
vertex.setProperty(key, value);
((OrientVertex)vertex).getRecord().save();
((TransactionalGraph) database.getGraph()).commit();
break;
} catch(ONeedRetryException e) {
attempt++;
((OrientVertex)vertex).getRecord().reload();
if (attempt==Database.MAX_ATTEMPTS) {
logger.debug("cant save property to vertex and commit to db: "+e.getMessage());
}
}
}
}
}

@OverRide
public Object getProperty(String key) {
return vertex.getProperty(key);
}

@andrii0lomakin andrii0lomakin self-assigned this Jun 13, 2014
@andrii0lomakin andrii0lomakin added this to the 1.7.4 milestone Jun 13, 2014
@andrii0lomakin
Copy link
Member Author

Hi,
I have created small test

@Test
    public void testSetListProperty() {
        OrientGraph g = new OrientGraph("plocal:target/databases/test-db", "admin", "admin");

        if (g.getVertexType("PS") == null) {
            g.createVertexType("PS");
        }


        Vertex v = g.addVertex("class:PS");
        g.commit();

        List<String> listProperty = new ArrayList<String>();
        listProperty.add("s1");
        listProperty.add("s2");

        v.setProperty("lp", listProperty);

        g.commit();

        List<String> result = v.getProperty("lp");
        Assert.assertEquals(2, result.size());
        Assert.assertTrue(result.contains("s1"));
        Assert.assertTrue(result.contains("s2"));
        g.shutdown();

    }

it passes without problems could you modify this test in way which reflects your issue ?

@andrii0lomakin
Copy link
Member Author

I have put couple of reloads

@Test
  public void testSetListProperty() {
    OrientGraph g = new OrientGraph("plocal:target/databases/test-db", "admin", "admin");

    if (g.getVertexType("PS") == null) {
      g.createVertexType("PS");
    }

    Vertex v = g.addVertex("class:PS");
    g.commit();

    List<String> listProperty = new ArrayList<String>();
    listProperty.add("s1");
    listProperty.add("s2");

    ((OrientVertex) v).getRecord().reload();
    v.setProperty("lp", listProperty);
    g.commit();

        ((OrientVertex) v).getRecord().reload();

    List<String> result = v.getProperty("lp");
    Assert.assertEquals(2, result.size());
    Assert.assertTrue(result.contains("s1"));
    Assert.assertTrue(result.contains("s2"));
    g.shutdown();

  }
}

everything is fine.

@valenpo
Copy link

valenpo commented Jun 16, 2014

Andrey, hi
I suppose it is happens due to cache of DB

1st request
{"@type":"d","@Rid":"#12:0","@Version":22,"@Class":"v_user","USER_NAME":"admin","EMAIL":[],"in_user":"#26:0"}

2nd and 3d
{"@type":"d","@Rid":"#12:0","@Version":22,"@Class":"v_user","USER_NAME":"admin","EMAIL":[],"in_user":"#26:0"}
{"@type":"d","@Rid":"#12:0","@Version":22,"@Class":"v_user","USER_NAME":"admin","EMAIL":[],"in_user":"#26:0"}

4th
{"@type":"d","@Rid":"#12:0","@Version":21,"@Class":"v_user","USER_NAME":"admin","EMAIL":[],"in_user":"#26:0","out_tags":"#27:3"}

As you see on 4th request we getting earliest record.

Vertex are getting via code
{code}
Vertex getVertex() {
((OrientVertex)vertex).getRecord().reload();
System.out.println(((OrientVertex)vertex).getRecord().toJSON());
return vertex;
}
{code}

Database init

OGlobalConfiguration.CACHE_LEVEL1_ENABLED.setValue(false);
OGlobalConfiguration.DB_USE_DISTRIBUTED_VERSION.setValue(false);
OGlobalConfiguration.NON_TX_RECORD_UPDATE_SYNCH.setValue(true); //Executes a synch against the file-system at every record operation. This slows down records updates but guarantee reliability on unreliable drives
OGlobalConfiguration.TX_LOG_SYNCH.setValue(true); //Executes a synch against the file-system for each log entry. This slows down transactions but guarantee transaction reliability on non-reliable drives
graph = new OrientGraph(location);

Regards,
Valentin

@andrii0lomakin
Copy link
Member Author

Hi Valentin,
I see.
But I have a question for you, you use embedded database, do not you ?

@valenpo
Copy link

valenpo commented Jun 16, 2014

Yes, we are using plocal engine embedded database.

After restart server, all records become to normal latest version state.

Hi Valentin,
I see.
But I have a question for you, you use embedded database, do not you ?


Reply to this email directly or view it on GitHub.

Regards,
Valentin Popov

@andrii0lomakin
Copy link
Member Author

Good, could you try following:

OGlobalConfiguration.CACHE_LEVEL2_ENABLED.setValue(false);
That is the only parameter (from listed above) which you should set.

It should fix your issue.

@valenpo
Copy link

valenpo commented Jun 16, 2014

Andrey, thank you very much.

Looks like those settings solve the problem.

Does disabling cache significantly reduce performance?

Good, could you try following:

OGlobalConfiguration.CACHE_LEVEL2_ENABLED.setValue(false);
That is the only parameter (from listed above) which you should set.

It should fix your issue.


Reply to this email directly or view it on GitHub.

Regards,
Valentin Popov

@andrii0lomakin
Copy link
Member Author

It depends, but we have direct memory cache instead of heap cache, so not so much.
Usually you should rely on direct memory cache because it is very sophisticated.
I am closing issue.

@lvca
Copy link
Member

lvca commented Jun 16, 2014

@valenpo can you also try to realod the record by using:

((OrientVertex)vertex).getRecord().reload(null, true);

In this way you ignore cache on reloading.

@valenpo
Copy link

valenpo commented Jun 16, 2014

Luca, thanks I just follow Andrey recommendation and it fix the issue.

@valenpo can you also try to realod the record by using:

((OrientVertex)vertex).getRecord().reload(null, true);

In this way you ignore cache on reloading.


Reply to this email directly or view it on GitHub.

Regards,
Valentin Popov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants