question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Save() operation doesn't seem to be synchronous [DATACOUCH-589]

See original GitHub issue

murdos opened DATACOUCH-589 and commented

Using a non reactive repository, the following code in an integration test randomly fail, which make me think that then entity is not always saved when the save() method returns:

// Initialize the database
userRepository.save(user);
int databaseSizeBeforeCreate = userRepository.findAll().size();

assumeThat(databaseSizeBeforeCreate).isEqualTo(1); // assumption randomly fail with databaseSizeBeforeCreate being equal to 0

Affects: 4.1 M2 (2020.0.0)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
mikereichecommented, Feb 1, 2021

The getDefaultConsistency() method is gone from the AbstractCouchbaseConfiguration. I don’t know why. It could be added back, or we could introduce a Class-level @ScanConsistency annotation.

1reaction
mraiblecommented, Jan 31, 2021

@mikereiche I’m trying to pick up where @murdos left off and upgrade JHipster’s Couchbase support to work with Spring Boot 2.4.2. You can see my in-progress PR here.

I feel like I’m overriding methods all over and added the following everywhere.

@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)

However, I only really need this for tests, so it seems kinda weird.

Is there a mechanism in Spring Data Couchbase to make things strongly consistent like previous versions had? I’d only like it for tests so we can add/retrieve data successfully.

From https://stackoverflow.com/q/54897120/65681:

@TestConfiguration
@Slf4j
@Order(0)
public class TestCouchbaseConfig extends AbstractCouchbaseConfiguration {

    ...

    @Override
    protected Consistency getDefaultConsistency() {
        return Consistency.STRONGLY_CONSISTENT; //READ_YOUR_OWN_WRITES|UPDATE_AFTER ... etc;
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make the save function in Parse work in synchronous ...
Now output: TypeError: myGroup.save(...).then is not a function but the group object gets added in the Parse I don't know why?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found