• Keine Ergebnisse gefunden

Testing properties of weakly consistent programs with Repliss

N/A
N/A
Protected

Academic year: 2022

Aktie "Testing properties of weakly consistent programs with Repliss"

Copied!
34
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Testing properties of weakly consistent programs with Repliss

Peter Zeller April 2017

TU Kaiserslautern, AG Softech

1

(2)

Repliss

Replissis a tool for developing correct applications on top of weakly consistent databases.

(Replicated information systems with strong guarantees)

• Specification of safety properties

• Automated and manual verification

• Automated testingNEW!

(3)

Repliss

Replissis a tool for developing correct applications on top of weakly consistent databases.

(Replicated information systems with strong guarantees)

• Specification of safety properties

• Automated and manual verification

• Automated testing

NEW!

2

(4)

Repliss

Replissis a tool for developing correct applications on top of weakly consistent databases.

(Replicated information systems with strong guarantees)

• Specification of safety properties

• Automated and manual verification

• Automated testingNEW!

(5)

Setting

DBR1 DBR2 DBR3

Application Clients

stateless

3

(6)

Setting

DBR1 DBR2 DBR3

Application Clients

stateless

(7)

Repliss Workflow

1. Write Code, define database schema 2. Specify functional properties

3. Add stronger invariants for verification 4. Run automated verification tool

5. When failed:

Adapt 1/2/3 or use manual verification (Isabelle)

4

(8)

Repliss Workflow

1. Write Code, define database schema

2. Specify functional propertiesAutomated Tests!

3. Add stronger invariants for verificationAutomated Tests!

4. Run automated verification tool 5. When failed:

Adapt 1/2/3 or use manual verification (Isabelle)

* no additional input required

(9)

Repliss Demo

4

(10)

Execution model

• Clients can invoke API arbitrarily

• Invocations executed concurrently

• No concurrency inside invocation

• Replicas exchange updates asynchronously

(11)

Execution model

Required for testing:

• Reproducible executions (→deterministic)

Idea: Capture all nondeterministic choices in a trace

6

(12)

Execution model

Required for testing:

• Reproducible executions (→deterministic) Idea: Capture all nondeterministic choices in a trace

(13)

Trace Example

i1 invoc(updateMail, [user1, ”ab@c.de”]) i1 beginAtomic(tx4, [tx1, tx2])

i2 invoc(removeUser, [user1]) i2 beginAtomic(tx5, [tx1, tx3]) i1 invCheck

i2 return i1 return

7

(14)

Trace Example

i1 invoc(updateMail, [user1, ”ab@c.de”]) i1 beginAtomic(tx4, [tx1, tx2])

i2 invoc(removeUser, [user1]) i2 beginAtomic(tx5, [tx1, tx3]) i1 invCheck

i2 return i1 return Invoke API

(15)

Trace Example

i1 invoc(updateMail, [user1, ”ab@c.de”]) i1 beginAtomic(tx4, [tx1, tx2])

i2 invoc(removeUser, [user1]) i2 beginAtomic(tx5, [tx1, tx3]) i1 invCheck

i2 return i1 return

Start Transaction (includes pulled transactions)

7

(16)

Trace Example

i1 invoc(updateMail, [user1, ”ab@c.de”]) i1 beginAtomic(tx4, [tx1, tx2])

i2 invoc(removeUser, [user1]) i2 beginAtomic(tx5, [tx1, tx3]) i1 invCheck

i2 return i1 return

Check invariants in context of invocation

(17)

Trace Example

i1 invoc(updateMail, [user1, ”ab@c.de”]) i1 beginAtomic(tx4, [tx1, tx2])

i2 invoc(removeUser, [user1]) i2 beginAtomic(tx5, [tx1, tx3]) i1 invCheck

i2 return i1 return

Return from API invocation

7

(18)

Actions

• Client invokes API procedure

• Start transaction

• Return

• Invariant check

• Node crash

• Generate unique id

• Local steps (local computations, database operations, commits)

• Not recorded in trace

• Not interfering with other invocations

• Directly executed until next decision-point

(19)

Actions

• Client invokes API procedure

• Start transaction

• Return

• Invariant check

• Node crash

• Generate unique id

• Local steps (local computations, database operations, commits)

• Not recorded in trace

• Not interfering with other invocations

• Directly executed until next decision-point

8

(20)

Executing database operations

Result of operation depends only on update-history visible at local replica.

Executing an operation updates history:

• Arguments and result of operation are recorded

• Originating transaction and invocation are recorded

• New operation happens causally after currently visible events

• New operation is added to set of local visible events

(21)

Starting Transactions (pulling updates)

visible calls

10

(22)

Starting Transactions (pulling updates)

Pulled transaction visible calls

(23)

Starting Transactions (pulling updates)

with causal dependencies visible calls

10

(24)

Starting Transactions (pulling updates)

visible calls

(25)

Eliminating Nondeterminism

Nondeterministic steps:

• Choosing pulled transactions at start of transaction

• API invocations

• Order of interleaving

All recorded in trace.

11

(26)

Eliminating Nondeterminism

Nondeterministic steps:

• Choosing pulled transactions at start of transaction

• API invocations

• Order of interleaving All recorded in trace.

(27)

Test Driver

Test driver generates random actions based on the current state.

Goal Solution

high contention Limit number of objects

Increase likelihood of concurrent database operations

Avoid linear history

Snapshot calculation:

- Find candidates (transactions not visible yet)

- Pick up to two transactions to pull

- Prefer transactions with fewer causal dependencies

12

(28)

Test Driver

Test driver generates random actions based on the current state.

Goal Solution

high contention Limit number of objects

Increase likelihood of concurrent database operations

Avoid linear history

Snapshot calculation:

- Find candidates (transactions not visible yet)

- Pick up to two transactions to pull

- Prefer transactions with fewer causal dependencies

(29)

Shrinking Counter Examples

When invariant violation is found:

• Try to remove action from trace

• Adapt trace (e.g. remove dependent actions)

• Repeat if still failing, otherwise try next action

Important: Stability

• Execution semantic based on traces ensures that removing actions has little effect on other actions

• beginAtomicaction includes set of all causal dependencies

Example: 19 invocations, reduced to 4 invocations

13

(30)

Shrinking Counter Examples

When invariant violation is found:

• Try to remove action from trace

• Adapt trace (e.g. remove dependent actions)

• Repeat if still failing, otherwise try next action Important: Stability

• Execution semantic based on traces ensures that removing actions has little effect on other actions

• beginAtomicaction includes set of all causal dependencies

Example: 19 invocations, reduced to 4 invocations

(31)

Shrinking Counter Examples

When invariant violation is found:

• Try to remove action from trace

• Adapt trace (e.g. remove dependent actions)

• Repeat if still failing, otherwise try next action Important: Stability

• Execution semantic based on traces ensures that removing actions has little effect on other actions

• beginAtomicaction includes set of all causal dependencies

Example: 19 invocations, reduced to 4 invocations

13

(32)

Future Work

Performance

(2 seconds for executing 100 actions, 6 seconds for 200 action)

• Main problem: Evaluating logical formulas E.g.: CRDT query specification:

(exists c1: callId, f: userRecordField, v:

String ::

c1 is visible

&& c1.op == mapWrite(u, f, v)

&& (forall c2: callId :: (c2 is visible &&

c2.op == mapDelete(u)) ==> c2 happened before c1))

• Try to use smarter algorithm for evaluation

(e.g. SMT solver) 14

(33)

Future Work

Tighter integration with verification

• Use verification errors to guide tests

real counter examples for verification errors

15

(34)

Questions?

Referenzen

ÄHNLICHE DOKUMENTE

However, developing semantic differencing operators in this way constitutes a major challenge, as one has to develop translations of models into a semantic domain, comparison

We contribute to the further exploration of the bound- ary between decidability and undecidability for Golog, showing that for our new classes of action theories in the

We have extended the decidability results obtained in (Claßen, Liebenberg, and Lakemeyer 2013) and (Baader and Zarrieß 2013) to a larger fragment of local-effect action theories, to

To make a transition from one configuration to another, we pick an applicable guarded action from the head of the program expression, and then transform the model and the

To make a transition from one configuration to another, we pick an applicable guarded action from the head of the program expression, and then transform the model and the

In particular, we (1) use C 2 as base logic, the two variable fragment of first-order logic with counting quantifiers, which subsumes both ALC and the two-variable Situation

The solution to the state default problem for the more general class of action domains considered in this paper is now essentially the solution of [2], updated with our new versions

«базовой» меры λ; при ограничениях (1)–(3) это не имело значения при компактификации. В этой связи в данной работе исследуется «полярный» случай: