Reading Ingestion-Spanner: Google’s Globally-Distributed Database

【信息科学与工程学】计算机科学与自动化 第二百三十三篇 凤凰架构01 编号类型领域系统软件/硬件或系统集成方案及系统架构模块子模块函数名称/算法名称算法的数学分析及计算机体系架构及数据结构与算法详细设计及参数列表及数值范围设计关联知识1共识算法分布式基石状态机复制架构:Proposer/Acceptor/Learner 多节点角色模型,基于操作转移(Operation Transfer)分布式共识PaxosPaxos 协议(Prepare/Promise/Accept/Accepted 两阶段)数学基础:多数派(Quorum)投票,基于鸽巢原理保证 W+R>N 时读写集合必有 阅读详情

0. Essence

(1) Spannerserver’s stack(2.1Spannerserver Software Stack): consists of file system(Colossus),storing data structure(tablet),replica(paxos state machine),concurrency control(lock table),distributed transactions(transaction manager).
在这里插入图片描述
(2) Data Model(2.3 Data Model): introduce INTERLEAVE IN ,ON DELETE CASCADE to achive the interleaving of tables to form directories is significant because it allows clients to describe the locality relationships that exist between multiple tables.

在这里插入图片描述

(3)TrueTime(3 TrueTime): The underlying time references used by TrueTime are GPS and atomic clocks.TrueTime explicitly represents time as a TTinterval, which is an interval with bounded time uncertainty.在这里插入图片描述
(4) Leader Leases(4.1.1 Paxos Leader Leases): prove the leader leases and disjoint from other leaders:

在这里插入图片描述
(5) RW transactions’ monotonicy invarient,external-consistency invariant,two phase-blocking
(4.1.2 Assigning Timestamps to RWTransactions,Read-Write Transactions).
在这里插入图片描述
(6) t(safe),t(Paxos,safe),t(TM,safe)(4.1.3 Serving Reads at a Timestamp):
Every replica tracks a value called safe time t safe which is the maximum timestamp at which a replica is up-to-date.

(7) s(read)'s single group(LastTS()) or multiple group(TT.now.latest)
(4.1.4 Assigning Timestamps to RO Transactions,4.2.2 Read-Only Transactions)

1. Introduction

Highest level of abstraction

It is a database that shards data across many sets of Paxos state machines in datacenters spread all over the world.

Spanner’s main focus
Managing cross-datacenter replicated data.Spanner automatically reshards data across machines as the amount of data or the number of servers changes, and it automatically migrates data across machines (even across datacenters) to balance load and in response to failures.

Spanner’s focus of distributed-systems infrastructure

Spanner has evolved from a Bigtable-like versioned key-value store into a temporal multi-version database;
Data is stored in schematized semi-relational tables;
Data is versioned, and each version is automatically timestamped with its commit time; old versions of data are subject to configurable garbage-collection policies; and applications can read data at old timestamps;
Spanner supports general-purpose transactions, and provides a SQL-based query language.

Spanner’s focus of globally-distributed database’s features

(1) First, the replication configurations for data can be dynamically controlled at a fine grain by applications. Applications can specify constraints to control which datacenters contain which data, how far data is from its users (to control read latency), how far replicas are from each other (to control write latency), and how many replicas are maintained (to control durability, availability, and read performance). Data can also be dynamically and transparently moved between datacenters by the system to balance resource usage across datacenters.

(2) Second, Spanner has two features that are difficult to implement in a distributed database: it provides externally consistent reads and writes, and globally-consistent reads across the database at a timestamp.These features enable Spanner to support consistent backups, consistent MapReduce executions , and atomic schema updates, all at global scale, and even
in the presence of ongoing transactions.

(2)’ External Consistency. ——[16] Information Storage in a DecentralizedComputer System
External consistency guarantees that a transaction will always receive current information. Using the concepts we have just introduced, we can provide a formal definition of external consistency. The actual time order in which transactions complete defines a unique serial schedule. This serial schedule is called the external schedule. A system is said to provide external consistency if it guarantees that the schedule it will use to process a set of transactions is equivalent to its external schedule.

(3) Spanner’s Globally-meaningful commit timestamps

Two features are enabled by the fact that Spanner assigns globally-meaningful commit timestamps to transactions, even though transactions may be distributed;
The timestamps reflect serialization order;
In addition, the serialization order satisfies external consistency (or equivalently, linearizability) : if a transaction T1 commits before another transaction T2 starts, then T1’s commit timestamp is smaller than T2’s. Spanner is the first system to provide such guarantees at global scale.

(3)’ Spanner’s new TrueTime API

The API directly exposes clock uncertainty, and the guarantees on Spanner’s timestamps depend on the bounds that the implementation provides;
If the uncertainty is large, Spanner slows down to wait out that uncertainty.This implementation keeps uncertainty small (generally less than 10ms) by using multiple modern clock references (GPS and atomic clocks).

Directory

(1) Section 2: describes the structure of Spanner’s implementation,its feature set, and the engineering decisions that went into their design.

(2) Section 3: describes our new TrueTime API and sketches its implementation.

(3) Section 4: describes how Spanner uses TrueTime to implement externally-consistent distributed transactions, lock-free read-only transactions, and atomic schema updates.

(4) Section 5: provides some benchmarks on Spanner’s performance and TrueTime behavior, and discusses the experiences of F1.

(5) Sections 6, 7, and 8 :describe related and future work, and summarize our conclusions.

2.1 Implemention

This section describes the structure of and rationale underlying Spanner’s implementation;
It then describes the directory abstraction, which is used to manage replication and locality, and is the unit of data movement;
Finally, it describes our data model, why Spanner looks like a relational database instead of a key-value store, and how applications can control data locality.

Universe

A Spanner deployment is called a universe.
We currently run a test/playground universe, a development/production universe, and a production-only universe.

Zone

(1) Spanner is organized as a set of zones;
(2) Zones are the unit of administrative deployment;
(3) The set of zones is also the set of locations acrosswhich data can be replicated.——???
(4) Zones can be added to or removed from a running system as new datacenters are brought into service and old ones are turned off, respectively;
(5) Zones are also the unit of physical isolation: there may be one or more zones in a datacenter, for example, if different applications’ data must be partitioned across different sets of servers in the same datacenter.

Servers in a Spanner universe
在这里插入图片描述
(1) A zone has one zonemaster and between one hundred and several thousand spanservers.
(2) The zonemaster assigns data to spanservers;
(3) The spanserver serve data to clients.
(4) The per-zone location proxies are used by clients to locate the spanservers assigned to serve their data.
(5) The universe master is primarily a console that displays status information about all the zones for interactive debugging.
(6) The placement driver handles automated movement of data across zones on the timescale of minutes. The placement driver periodically communicates with the spanservers to find data that needs to be moved, either to meet updated replication constraints or to balance load.

2.2Spanserver Software Stack

This section focuses on the spanserver implementation to illustrate how replication and distributed transactions have been layered.

在这里插入图片描述

Tablet

At the bottom, each spanserver is responsible for between 100 and 1000 instances of a data structure called a tablet.
It implements a bag of the following mappings:

(key:string, timestamp:int64) ——> string

Unlike Bigtable, Spanner assigns timestamps to data, which is an important way in which Spanner is more like a multi-version database than a key-value store.

Colossus

A tablet’s state is stored in set of B-tree-like files and a write-ahead log(WAL), all on a distributed file system called Colossus (the successor to the Google File System ).

Paxos state machine
The set of replicas is collectively a Paxos group.

Requirement:To support replication, each spanserver implements a single Paxos state machine on top of each tablet.

Implemention:Each state machine stores its metadata and log in its corresponding tablet.

Features:
(1) Our Paxos implementation supports long-lived leaders with time-based leader leases, whose length defaults to 10 seconds.
(2) The current Spanner implementation logs every Paxos write twice: once in the tablet’s log, and once in the Paxos log.
(3) Our implementation of Paxos is pipelined, so as to improve Spanner’s throughput in the presence of WAN latencies; but writes are applied by Paxos in order.————???
(4) The Paxos state machines are used to implement a consistently replicated bag of mappings.(state machine keep the mapping bag consistenly)
(5) Writes must initiate the Paxos protocol at the leader; reads access state directly from the underlying tablet at any replica that is sufficiently up-to-date.

Lock table
At every replica that is a leader, each spanserver implements a lock table to implement concurrency control.

Inplemention:
The lock table contains the state for two-phase locking: it maps ranges of keys to lock states.————???
(Note that having a long-lived Paxos leader is critical to efficiently managing the lock table.)

Features:
(1) We designed for long-lived transactions (for example, for report generation, which might take on the order of minutes), which perform poorly under optimistic concurrency control in the presence of conflicts.
(2) Operations that require synchronization, such as transactional reads, acquire locks in the lock table; other operations bypass the lock table.

Transaction manager
At every replica that is a leader, each spanserver also implements a transaction manager to support distributed transactions.

Inplemention:
The transaction manager is used to implement a participant leader; the other replicas in the group will be referred to as participant slaves.

case1——If a transaction involves only one Paxos group (as is the case for most transactions):
It can bypass the transaction manager, since the lock table and Paxos together provide transactionality.

case2——If a transaction involves more than one Paxos group.
Those groups’ leaders coordinate to perform two-phase commit;
One of the participant groups is chosen as the coordinator: the participant leader of that group will be referred to as the coordinator leader, and the slaves of that group as coordinator slaves.

#Directories and Placement

Directory
A bucketing abstraction called a directory, which is a set of contiguous keys that share a common prefix.

Features:

(1) Supporting directories allows applications to control the locality of their data by choosing keys carefully.

(2) A directory is the unit of data placement. All data in a directory has the same replication configuration. When data is moved between Paxos groups, it is moved directory by directory, as shown in Figure 3.Spanner might move a directory to shed load from a Paxos group; to put directories that are frequently accessed together into the same group; or to move a directory into a group that is closer to its accessors.
在这里插入图片描述
(From Figure 3,a Paxos group consists of a set of zones;different Paxos group may contain same zones.)

(3) Bigtable tablet:a single lexicographically contiguous partition of the row space.
Spanner:a container that may encapsulate multiple partitions of the row space.————???
->We made this decision so that it would be possible to colocate multiple directories that are frequently accessed together.
->The fact that a Paxos group may contain multiple directories.

(4) A directory is also the smallest unit whose geographic replication properties can be specified by an application.

Premise:

The design of our placement-specification language separates responsibilities for managing replication configurations.

Inplemention:

Administrators control two dimensions: the number and types of replicas, and the geographic placement of those replicas,and they create a menu of named options in these two dimensions;
An application controls how data is replicated, by tagging each database and/or individual directories with a combination of those options;

For example:

An application might store each end-user’s data in its own directory, which would enable user A’s data(individual directory) to have three replicas (replica number) in Europe(replica geographic placement) , and user B’s data(individual directory) to have five replicas(replica number) in North America(replica geographic placement).

Moviedir

Features:
(1) * is the background task used to move directories between Paxos groups.
(2) * is also used to add or remove replicas to Paxos groups (because Spanner does not yet support in-Paxos configuration changes)
(3) * is not implemented as a single transaction, so as to avoid blocking ongoing reads and writes on a bulky data move.

Inplemention:
(1) Movedir registers the fact that it is starting to move data and moves the data in the background.
(2) When it has moved all but a nominal amount————??? of the data.
(3) It uses a transaction to atomically move that nominal amount and update the metadata for the two Paxos groups.

Fragment

Spanner will shard a directory into multiple fragments if it grows too large.
Movedir actually moves fragments, and not whole directories, between groups.

2.3 Data Model

Spanner exposes the following set of data features to applications:
(1) A data model based on schematized semi-relational tables.
(2) A query language.
(3) The general-purpose transactions

Factors:
(1) The need to support schematized semi-relational tables and synchronous replication is supported by the popularity of Megastore(despite its relatively low performance),because its data model is simpler to manage than Bigtable’s, and because of its support for synchronous replication across datacenters.

(2) The need to support a SQL-like query language in Spanner was also clear, given the popularity of Dremel as an interactive data-analysis tool.

(3) The lack of cross-row transactions in Bigtable;
We believe it is better to have application programmers deal with performance problems due to overuse of transactions as bottlenecks arise;
Running two-phase commit over Paxos mitigates the availability problems.

The application data model

Location:is layered on top of the directory-bucketed key-value mappings supported by the implementation.

Construction:
(1) An application creates one or more databases in a universe;
(2) Each database can contain an unlimited number of schematized tables.
(3) Tables look like relational-database tables, with rows, columns, and versioned values.
(4) We will not go into detail about the query language for Spanner. It looks like SQL with some extensions to support protocol-buffer-valued fields.

For example:Spanner schema for storing photo metadata on a per-user, per-album basis.
在这里插入图片描述
Rows with name

Every table is required to have an ordered set of one or more primary-key columns.->(Albums(2,1),means the rows that user_id=2,album_id=1 in Albums)
Imposing this structure is useful because it lets applications control data locality through their choices of keys.

INTERLEAVE IN

Client applications declare the hierarchies in database schemas via the INTERLEAVE IN declarations.
->(INTERLEAVE IN PARENT Users,then Albums interleaves in Users)

Directory/Descendant table

The table at the top of a hierarchy is a directory table.->(Users),desendant table->(Albums).
Each row in a directory table with key K, together with all of the rows in descendant tables that start with K in lexicographic order, forms a directory.

ON DELETE CASCADE

Deleting a row in the directory table deletes any associated child rows.

Target

This interleaving of tables to form directories(Schema) is significant because it allows clients to describe the locality relationships that exist between multiple tables, which is necessary for good performance in a sharded, distributed database.

3 TrueTime

Table 1 lists the methods of the API.
在这里插入图片描述
TTinterval
is an interval with bounded time uncertainty (unlike standard time interfaces that give clients no notion of uncertainty). The endpoints of a TTinterval are of type TTstamp.

TT.now()
The TT.now() method returns a TTinterval that is guaranteed to contain the absolute time during which TT.now() was invoked;
The time epoch is analogous to UNIX time with leap-second smearing.————???
Define the instantaneous error bound as ε , which is half of the interval’s width, and the average error bound as ε’.

TT.after()/TT.before()
The TT.after() and TT.before() methods are convenience wrappers around TT.now().

Absolute time of an event
Denote the absolute time of an event e by the function tabs(e). In more formal terms, TrueTime guarantees
that for an invocation tt = TT.now(), tt.earliest ≤ tabs(e now) ≤ tt.latest, where e now is the invocation event.

Time references

The underlying time references used by TrueTime are GPS and atomic clocks.
TrueTime uses two forms of time reference because they have different failure modes.
GPS reference-source vulnerabilities include antenna and receiver failures, local radio interference, and GPS system outages;
Atomic clocks can fail in ways uncorrelated to GPS and each other, and over long periods of time can drift significantly due to frequency error.

Two Eviction Strategys

Inplemention:TrueTime is implemented by a set of time master machines per datacenter and a timeslave daemon per machine.Some are GPS masters chosen from nearby datacenters; the rest are GPS masters from farther datacenters, as well as some Armageddon masters.(the course of timemaster->timeslave)

(1) All masters’ time references are regularly compared against each other. Each master also cross-checks the rate at which its reference advances time against its own local clock, and evicts itself if there is substantial divergence.

(2) Every daemon polls a variety of masters to reduce vulnerability to errors from any one master.
Daemons apply a variant of Marzullo’s algorithm————??? to detect and reject liars, and synchronize the local machine clocks to the nonliars;
To protect against broken local clocks, machines that exhibit frequency excursions larger than the worst-case bound derived from component specifications and operating environment are evicted.

**Time uncertainty **

Cause:

Between synchronizations, a daemon advertises a slowly increasing time uncertainty.

Time uncertainty ε is derived from conservatively applied worst-case 1. local clock drift, also depends on 2. time-master uncertainty and 3. communication delay to the time masters.

Armageddon masters advertise a slowly increasing time uncertainty that is derived from conservatively applied
worst-case clock drift;
GPS masters advertise uncertainty that is typically close to zero.

Inplemention:

(1) In our production environment, ε is typically a sawtooth function of time, varying from about 1 to 7 ms over each poll interval.ε’ is therefore 4 ms most of the time.

(2) The daemon’s poll interval is currently 30 seconds, and the current applied drift rate is set at 200 microseconds/second(30*200microseconds=6ms), which together account for the sawtooth bounds from 0 to 6 ms.

(3) The remaining 1 ms comes from the communication delay to the time masters.

Excursions from this sawtooth are possible in the presence of failures:occasional time-master unavailability;overloaded machines and network links.

4 Concurrency Control

(1) This section describes how TrueTime is used to guarantee the correctness properties around concurrency control;

(2) And how those properties are used to implement features such as 1. externally consistent transactions, 2. lock-free read-only transactions, and 3. non-blocking reads in the past;

(3) It will be important to distinguish writes as seen by Paxos (which we will refer to as Paxos writes unless the context is clear) from Spanner client writes.

4.1 Timestamp Management

Leader lease(disjointness invariant)->
RW transactions’ timestamp(monotonicity,external consistency invariant)->
Reads at timestamp(t safe:paxos write,prepared but not committed transactions)->
RO transactions’ timestamp(s read,oldest timestamp preserve the external consistency invariant,and not blocking)

Table 2 lists the types of operations that Spanner supports.

在这里插入图片描述

The Spanner implementation supports:
(1) read-write transactions(include Standalone writes)
(2) read-only transactions (include non-snapshot standalone reads)
(3) snapshot reads

Read-only transaction

A read-only transaction is a kind of transaction that has the performance benefits of snapshot isolation———???
A read-only transaction must be predeclared as not having any writes:
(1) It is not simply a read-write transaction without any writes.
(2) Reads in a read-only transaction execute at a system-chosen timestamp without locking, so that incoming writes are not blocked.

Snapshot reads

A snapshot read is a read in the past that executes without locking.
A client can either specify a timestamp for a snapshot read, or provide an upper bound on the desired timestamp’s staleness and let Spanner choose a timestamp.

Read benefits

For both read-only transactions and snapshot reads, commit is inevitable once a timestamp has been chosen, unless the data at that timestamp has been garbage-collected————???.
As a result, clients can avoid buffering results inside a retry loop(client).
When a server fails, clients can internally continue the query on a different server by repeating the timestamp and the current read position.

4.1.1 Paxos Leader Leases

Spanner’s Paxos implementation uses timed leases to make leadership long-lived (10 seconds by default).

Inplemention:
(1) A potential leader sends requests for timed lease votes;
(2) Upon receiving a quorum of lease votes the leader knows it has a lease.
(3) Define a leader’s lease interval as starting when it discovers it has a quorum of lease votes, and as ending when it no longer has a quorum of lease votes (because some have expired).
(4) Spanner depends on the following disjointness invariant: for each Paxos group, each Paxos leader’s lease interval is disjoint from every other leader’s.

The folloing figure(deduction form Appendix A) discribes how this invariant is enforced:

在这里插入图片描述
To prove disjointness, we make use of the fact that the i th and (i + 1)th leaders must have one replica in common in their quorums. Call that replica r0. Proof:

在这里插入图片描述

(5) A replica extends its lease vote implicitly on a successful write, and the leader requests lease-vote extensions if they are near expiration.

4.1.2 Assigning Timestamps to RW Transactions

Transactional reads and writes use two-phase locking. As a result, they can be assigned timestamps at any time when all locks have been acquired, but before any locks have been released.

monotonicity invariant

Spanner assigns timestamps to Paxos writes in monotonically increasing order, even across leaders.
(1) Single leader replica can trivially assign timestamps in monotonically increasing order.
(2) This invariant is enforced across leaders by making use of the disjointness invariant: a leader must only assign
timestamps within the interval of its leader lease. Note that whenever a timestamp s is assigned, s max is advanced to s to preserve disjointness.(s max :max timestamp user by leader)

external consistency invariant

在这里插入图片描述

4.1.3 Serving Reads at a Timestamp

The monotonicity invariant described in Section 4.1.2 allows Spanner to correctly determine whether a replica’s state is sufficiently up-to-date to satisfy a read.

Every replica tracks a value called safe time t safe which is the maximum timestamp at which a replica is up-to-date. A replica can satisfy a read at a timestamp t if t <= t safe.

The definition of t safe will be shown below:

在这里插入图片描述

4.1.4 Assigning Timestamps to RO Transactions

Read-only transaction executes in two phases: assign a timestamp s read , and then execute the transaction’s reads as snapshot reads at s read. The snapshot reads can execute at any replicas that are sufficiently up-to-date.

S read
The simple assignment of s read = TT.now().latest, at any time after a transaction starts, preserves external consistency by an argument analogous to that presented for writes in Section 4.1.2.

Blocking
However, such a timestamp may require the execution of the data reads at s read to block if t safe has not advanced sufficiently.(in that other write events would be executed after t safe,read may cause blocking);
To reduce the chances of blocking, Spanner should assign the oldest timestamp that preserves external consisten0cy.

4.2 Details

(1) Practical details of read-write transactions
(2) Practical details of read-only transactions
(3) Inplemention of atomic schema changes to transactions
(4) Refinement of the basic schemes.

4.2.1 Read-Write Transactions

Bigtables’s design

Writes that occur in a transaction are buffered at the client until commit. As a result, reads in a transaction do not see the effects of the transaction’s writes.

Spanner’s inplemention

A read returns the timestamps of any data read, and uncommitted writes have not yet been assigned timestamps.

Procedure of two-phase commit

  1. Premise:
    (1) Reads within read-write transactions use wound-wait————??? to avoid deadlocks;
    (2) The client issues reads to the leader replica of the appropriate group, which acquires read locks and then reads the most recent data;
    (3) While a client transaction remains open, it sends keep-alive messages to prevent participant leaders from timing out its transaction(extend leader lease).

  2. Chooses a coordinator:

(1) When a client has completed all reads and buffered all writes, it begins two-phase commit.

(2) The client chooses a coordinator group and sends a commit message to each participant’s leader with the identity of the coordinator and any buffered writes together.(avoid sending data twice across wide-area links)

  1. Prepare for non-coordinator leader/assign commit timestamp for coordinator leader:

(1) A non-coordinator-participant leader first acquires write locks ->
chooses a prepare timestamp ≥ any timestamps it has assigned to previous transactions->
logs a prepare record through Paxos->
notifies the coordinator of its prepare timestamp.

(2) The coordinator leader also first acquires write locks,but skips the prepare phase.->
After hearing from all other participant leaders’ prepare timestamp.->
Chooses a timestamp s for the entire transaction: s ≥ any prepare timestmp,s > TT.now(coordinator receive commit message).latest , s > any timestampm the leader has assigned to previous transactions.->

(3) The coordinator leader then logs a commit record through Paxos (or an abort if it timed out while waiting on the other participants).

  1. Commit wait

Before allowing any coordinator replica to apply the commit record,the coordinator leader waits until
TT.after(s),so as to obey the commit-wait;
Because the coordinator leader chose s based on TT.now().latest, and now waits until that timestamp
is guaranteed to be in the past, the expected wait is at least 2 * ε(avg).
(ε is half of the interval that [TT.now,TT.after])

  1. Apply the commit record

(1) After commit wait, the coordinator sends the commit timestamp to the client and all other participant leaders.

(2) Each participant leader logs the transaction’s outcome through Paxos.

4.2.2 Read-Write Transactions

Negotiation phase for timestamp:

Assigning a timestamp requires a negotiation phase between all of the Paxos groups that are involved in the reads;
Spanner requires a scope expression for every read-only transaction, which is an expression that summarizes the keys that will be read by the entire transaction. Spanner automatically infers the scope for standalone queries.

Scope’s values are served by a single Paxos group:

(1) Client issues the read-only transaction to that group’s leader…
(2) For a single-site read, Spanner generally does better than TT.now().latest. Define LastTS() to be the timestamp of the last committed write at a Paxos group.
If there are no prepared transactions
(s read is earlier t safe,t safe=min(t paxos,t TM),t TM would be infinite if no prepared transactions), the assignment s read = LastTS() trivially satisfies external consistency.

Scope’s values are served by multiple Paxos group:

option1:The most complicated option is to do a round of communication with all of the groups’s leaders to negotiate s read based on LastTS().

option2:The client avoids a negotiation round, and just has its reads execute at s read = TT.now().latest (which may wait for safe time to advance). All reads in the transaction can be sent to replicas that are sufficiently up-to-date.

4.2.3 Schema-Change Transactions

Essence: TrueTime enables Spanner to support atomic schema changes;

Problem: It would be infeasible to use a standard transaction, because the number of participants (the number of groups in a database) could be in the millions;

Bigtable supports atomic schema changes in one datacenter, but its schema changes block all operations.

Solution of Spanner for blocking operations:

(1) It is explicitly assigned a timestamp in the future, which is registered in the prepare phase. As a result, schema changes across thousands of servers can complete with minimal disruption to other concurrent activity.

(2) Reads and writes, which implicitly depend on the schema, synchronize with any registered schema-change timestamp at time t: they may proceed if their timestamps precede t, but they must block behind the schemachange transaction if their timestamps are after t.

4.2.4 Refinements

(1) t(TM,safe)'s fine grain

Problem: if a single prepared transaction prevents t safe from advancing,no reads can occur at later timestamps, even if the reads do not conflict with the transaction.

Refinement: Such false conflicts can be removed by augmenting t(TM,safe) with a fine-grained mapping from key ranges to prepared transaction timestamps. This information can be stored in the lock table;
When a read arrives, it only needs to be checked against the fine-grained safe time for key ranges with which the read conflicts.

(2) LastTS()'s fine grain

Problem: if a transaction has just committed(write transaction), a non-conflicting readonly transaction must still be assigned s read so as to follow that transaction. As a result, the execution of the read could be delayed.

Refinement: This weakness can be remedied similarly by augmenting LastTS() with a fine-grained mapping from key ranges to commit timestamps in the lock table;
When a read-only transaction arrives, its timestamp can be assigned by taking the maximum value of LastTS() for the key ranges with which the transaction conflicts, unless there is a conflicting prepared transaction (which can be determined from fine-grained safe time.

(3) t(Paxos,safe)'s fine grain

Problem: it has a weakness in that it cannot advance in the absence of Paxos writes.That is, a snapshot read at t cannot execute at Paxos groups whose last write happened before t.

Refinement: Spanner addresses this problem by taking advantage of the disjointness of leader-lease intervals;

Each Paxos leader advances t(Paxos,safe)'s fine grain by keeping a threshold above which future writes’ timestamps will occur:
A mapping MinNextTS(n) from Paxos sequence number n to the minimum timestamp that may be assigned to Paxos sequence number n + 1. (A replica can advance t(Paxos,safe) to MinNextTS(n) − 1 when it has applied through n.);

If a leader wishes to advance MinNextTS() beyond the end of its leader lease, it must first extend its lease. Note that s max is always advanced to the highest value in MinNextTS() to preserve disjointness.A leader by default advances MinNextTS() values every 8 seconds.

spanner Google’s Globally-Distributed Database Google’s Globally-Distributed Database 立即下载

相关推荐

库存管理基于Excel的多商品组合订单需求拆解模型:SKU级供需预测与四情景压力测试系统设计 Excel 多商品组合订单的需求拆解|Excel模型与模拟数据

内容概要:本文档围绕Excel中多商品组合订单的基础SKU需求拆解,构建从订单行、组合用量表到仓库周需求、期初可供、计划到货及欠交结转的完整计算链条。通过四种组合、六种SKU、两座仓库和八个业务周的模拟数据,演示如何将组合套数准确转换为SKU件数,防止重复扣减与错误状态纳入,并按周递推供需覆盖与欠交变化。文档提供结构化输入校验、公式体系、守恒检查与四情景复算机制,确保结果可追溯、可核对。全部数据为基于固定随机种子生成的原创模拟记录,配套可编辑Excel工作簿与独立Python程序实现双向验证。 适合人群:适用于负责订单汇总、组合商品管理、库存分析、仓配协同、需求计划及业务分析文档编制的相关人员。日常使用者需掌握Excel基本操作如单元格引用、筛选与求和;具备Python基础者可配合标准库运行程序进行批量验证或数据重生成。业务管理岗可重点阅读结果与风险章节,结合工作表索引追踪数值来源。 使用场景及目标:适用于活动套单、同单含组合与单品、多仓备货、到货周期偏移及需求波动等场景。目标是实现组合订单向基础SKU的精准拆解,按周粒度完成供需匹配与欠交递推,识别输入冲突与窗口外到货影响,支持需求增幅、到货延期等多情景模拟分析,所有结论均可从源订单、BOM、Excel公式或独立程序追溯验证。 其他说明:项目交付包含A4文档、可编辑Excel、完整Python代码、CSV输入表、计算快照、四情景结果、测试记录、README指引及作者验收记录。采用固定随机种子确保数据一致性,强调输入有效性校验与双守恒(供给与需求)原则。Excel工作簿采用三层结构(源输入—公式计算—结果展示),支持手动编辑与自动重算,但扩容需重新生成网格。独立Python程序可用于交叉验证,保障模型可靠性。

Spanner: Google’s Globally-Distributed Database 总结

Spanner总结一、前言二、关于框架三、关于数据模型四、关于时间五、关于并发控制 一、前言 二、关于框架 三、关于数据模型 四、关于时间 五、关于并发控制

xiaopan的博客 1819

东汉AD35年世界历史地图矢量文件SHP格式.zip

本资源为《东汉AD35年世界历史地图矢量文件SHP格式》压缩包,文件大小约 29.99 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见JSON 文件、属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。

Spanner: Google’s Globally Distributed Database

1. INTRODUCTION Spanner可以扩展到跨数百个数据中心的数百万台机器与数万亿个数据库行。 Spanner是一个可伸缩、全球化分布的数据库,其由Google设计、构建、并部署。在抽象的最高层,Spanner是一个将数据分片(shard)到分布在全世界的多个数据中心中的跨多个Paxos状态机集合上的数据库。 Spanner的有趣特性: 应用程序可以细粒度地动态控制数据的副本配置。包括:那个数据中心包含哪些数据、数据离它的用户多远(以控制读取延迟)、副本间多远(以控制写入延迟)、维护了多少份

yangguanghaozi的专栏 1101

AI第三篇:ScaBench-用真实审计竞赛数据构建可复现的 AI 审计评测集

AI第三篇:ScaBench-用真实审计竞赛数据构建可复现的 AI 审计评测集

导带、价带

价带是电子的“束缚态”能量区间,决定材料的化学性质;导带是电子的“自由态”能量区间,直接决定材料的导电能力;禁带宽度则是区分金属、半导体与绝缘体的核心参数。通过调控能带结构(如掺杂、应变工程),可设计出具有特定电学和光学特性的功能材料,推动电子信息、能源转换等领域的技术革新。

weixin_51552564的博客 5162

Spanner: Google’s Globally-Distributed Database

Spanner: Google’s Globally-Distributed Database Spanner 是谷歌公司研发的、可扩展的、多版本、全球分布式、同步复制数据库。它是第一个把数据分布在全球范围内的系统,并且支持外部一致性的分布式事务。本文描述 了 Spanner 的架构、特性、不同设计决策的背后机理和一个新的时间 API,这个 API 可以暴 露时钟的不确定性。这个 API 及其实现,对于支持外部一致性和许多强大特性而言,是非常 重要的,这些强大特性包括:非阻塞的读、不采用锁机制的只读事务.

小蚂蚁与大象 921

ESP32对接百度智能云语音识别:从硬件配置到API调用的完整指南

本文详细介绍了ESP32对接百度智能云语音识别的完整流程,从硬件配置到API调用,涵盖麦克风选择、音频处理、错误处理及性能优化等关键环节。通过实战案例展示如何实现低成本、高效率的语音交互方案,特别适合智能硬件开发者参考。

weixin_29198045的博客 378

Google Spanner:谷歌的全球分布式数据库

Spanner 是谷歌公司研发的、可扩展的、多版本、全球分布式、同步复制数据库。它是第一个把数据分布在全球范围内的系统,并且支持外部一致性的分布式事务。

Tyler_Zx的博客 2796

哈工大OS实验四——进程运行轨迹的跟踪与统计

进程运行轨迹的跟踪与统计 进程从创建(Linux 下调用 fork())到结束的整个过程就是进程的生命期,进程在其生命期中的运行轨迹实际上就表现为进程状态的多次切换,如进程创建以后会成为就绪态;当该进程被调度以后会切换到运行态;在运行的过程中如果启动了一个文件读写操作,操作系统会将该进程切换到阻塞态(等待态)从而让出 CPU;当文件读写完毕以后,操作系统会在将其切换成就绪态,等待进程调度算法来调度该进程执行…… process.c解读 void cpuio_bound(int last, int cpu_

CSDN-ych 1010

【RT-DETR创新改进】改进前必看!对Ultralytics调参, 1:1还原RT-DETR官方版本实验参数,使用原汁原味的RT-DETR模型,才能高效跑实验、高效涨点、收割小论文、完成大论文!!!

本文针对Ultralytics训练RT-DETR精度不佳问题,提供参数配置优化方案。通过对比官方RT-DETR参数设置,详细指导如何修改Ultralytics版本的关键参数,包括优化器、学习率、权重衰减等6处配置调整。操作步骤涵盖default.yaml文件修改和trainer.py代码调整,确保模型收敛性能达到官方水平,帮助研究者快速提升实验效果。文末附官方源码链接和具体参数配置网址供参考。

Ai缝合怪、助力小伙伴高效发论文 1801

论文阅读笔记 - Spanner: Google'sGlobally-Distributed Database

作者:刘旭晖 Raymond 转载请注明出处 Email:colorant at 163.com BLOG:http://blog.csdn.net/colorant/ 更多论文阅读笔记 http://blog.csdn.net/colorant/article/details/8256145 关键字 Spanner, 外部一致性, 跨机房,

colorant的专栏 6783

eCognition易康操作教程(一):如何利用eCognition易康软件进行影像分割之棋盘分割、四叉树分割、光谱差异分割

进程执行完成后,植被覆盖区域与裸地区域合并了。第三步:清除分割结果,点击“Image Objects”菜单栏,点击“Delete Level(s)”,选中“ResultLevel1”,点击”ok”删除棋盘分割结果。四叉树分割之后,有的正方形大一些,有的正方形小一些,大说明该区域的光谱特性更加均一,而小说明不太均一。Leve:选择运行算法的矢量层名称,这里选择四叉树分割算法得到的矢量层“ResultLevel2”。Image Layer weights:图层权重,这里设置为“1,1,1,1”。

蒹葭苍苍 4617

第三十七章 SQL函数 CURRENT_TIMESTAMP

文章目录第三十七章 SQL函数 CURRENT_TIMESTAMP大纲参数描述精确到小数部分的秒配置精度日期和时间函数比较示例 第三十七章 SQL函数 CURRENT_TIMESTAMP 日期/时间函数,返回当前本地日期和时间。 大纲 CURRENT_TIMESTAMP CURRENT_TIMESTAMP(precision) 参数 precision - 一个正整数,它将时间精度指定为小数秒的位数。 默认值是0(没有小数秒); 这个默认值是可配置的。 CURRENT_TIMESTAMP返回TIMES

yaoxin521123的博客 1万+

【知识分享】什么是同轴传输线结构?

同轴传输线的几何形状由中心导体组,嵌在介电材料(Dielectric)中,并且,被连续的外导体所包围,也被称为屏蔽(Shield)。内外导体有相同的几何中心轴,因此得名同轴(Coaxial)。

一只豌豆象的博客 2386

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

note: Spanner: Google’s Globally-Distributed Database

note: Spanner: Google’s Globally-Distributed Database 1. Abstract & introduction ref:http://static.googleusercontent.com/media/research.google.com/zh-CN//archive/spanne...

weixin_30901729的博客 251

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

[论文笔记] Google Spanner Distributed Database

Spanner 是谷歌的可伸缩、多版本、全球分布、支持同步复制的数据库,它是第一个在全球范围内传递数据且保证外部一致的分布式事务的系统。论文叙述了它的架构、特征、许多设计的依据和一个新的可以暴露时钟不确定性的API。 简介 开篇叙述了 Spanner 的一些特性,在全球分布的 Paxos 状态机上进行 data sharding,利用复制保证整体可用性和地域局部性,客户端会自动在副本间进行fa...

旧时光 | YoungChen's 博客 1653

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

解析全球级分布式数据库Google Spanner(http://www.csdn.net/article/2012-09-19/2810132-google-spanner-next-databa)

摘要:2009年10月25日,Google提出名为Spanner的远景计划。该规划的心中为一旦流量激增、硬件超负荷,数据就会在百万级的数据中心中自动转移。Spanner:“扳手”,又有“桥梁的交叉支撑”。寓意为:“横跨数据中心,自动移动与复制数据。” 一.Spanner功能概要 在Spanner面世篇中简单的介绍过:Spanner具有高扩展性,多版本(multi-version)、

starlistener的专栏 933

Google Spanner原理- 全球级的分布式数据库

原文地址:http://qing.weibo.com/2294942122/88ca09aa3300221n.html   标签:大数据云计算 Google Spanner简介 Spanner 是Google的全球级的分布式数据库 (Globally-Distributed Database) 。Spanner的扩展性达到了令人咋舌的全球级,可以扩展到数百万的机器,数已百计

forever1dreamsxx--NLP 1642

Spanner 论文阅读笔记

Spanner: Google’s globally-distributed database 论文阅读笔记 重点就是如何用 TrueTime 做 MVCC 介绍 分布式多版本数据库:(key, timestamp) -> row 外部一致性:第一个事务提交后,第二个事务开始,那么第二个事务提交时间戳一定大于第一个事务提交时间戳 实现 placement driver:定期与 s...

rsy56640的博客 2048

Google Spanner和F1介绍

ZZ From http://qing.weibo.com/2294942122/88ca09aa3300221n.html Google Spanner原理- 全球级的分布式数据库 标签:大数据云计算 Google Spanner简介 Spanner 是Google的全球级的分布式数据库 (Globally-Distributed Database) 。Spanner的扩展性

哲学的叛徒的专栏 1199

真正统治世界的十大算法

本文由 伯乐在线 - Justin Wu 翻译自 Marcos Otero。欢迎加入技术翻译小组。转载请参见文章末尾处的要求。 不久前的某一天,我在浏览Reddit发现了一篇有趣的文章《统治世界的十大算法》,作者George Dvorsky在那篇文章中试图解释算法之于当今世界的重要性,以及哪些算法对人类文明最为重要。 此时此刻,如果你已经学过算法的话,那么在你阅读那篇文章时

Embeded system Development 4928

Schema创建表

laravel5.x 出现 HTTP ERROR 500解决写自定义目录标题PHP only, required if PHP was built with --enable-force-cgi-redirect 如查看access.log里面只有一个500错误的话,那需要打开php.ini中的display_errors display_errors = ON,改为这样之后在次访问可以看到php...

qq_35786481的博客 1514

Spanner——Google的全球化分布式数据库

Spanner论文出来后大家山呼万岁,但是它是否适合业务?可能只有自己能搞明白。本文是读spanner过程的一点小记录,不准备全文翻译,权当笔记。如有错漏,烦请指正,如有见解也欢迎讨论。 section 1 介绍 优点: 高可用、可扩展、(中间态的?tmp)多版本、全分布式、同步复制、对外一致的分布式事务 应用: F1 高可用 vs 低延迟:大多数应用使用3-5个dat...

weixin_30900589的博客 211
上一篇: Reading Ingestion-Time, Clocks, and the Ordering of Events in a Distributed System
下一篇: Reading Ingestion —— Bigtable: A Distributed Storage System for Structured Data
pourtheworld
博客等级 码龄10年 64粉丝 75原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值