Skip to content

Commit

Permalink
Fix FetchSnapshot in more recent Tarantool versions
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Oct 28, 2024
1 parent 5711080 commit e5ab9f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions anon_slave_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ func TestAnonSlaveSubscribeExpectedReplicaSetUUIDFail(t *testing.T) {

ver, err := tntBoxVersion(box)
require.NoError(err)
if ver >= version2_8_0 && ver < version2_9_0 {
t.Skip("Tarantool 2.8 returns an empty replicaset UUID, skip check")
if ver >= version2_8_0 && ver < version2_9_0 || ver >= version2_11_0 {
t.Skip("Tarantool 2.8/2.11 returns an empty replicaset UUID, skip check")
}

s, _ := NewAnonSlave(box.Listen, Options{
Expand Down
8 changes: 5 additions & 3 deletions const.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
KeyLSN = uint(0x03)
KeyTimestamp = uint(0x04)
KeySchemaID = uint(0x05)
KeyVersionID = uint(0x06)
KeySpaceNo = uint(0x10)
KeyIndexNo = uint(0x11)
KeyLimit = uint(0x12)
Expand Down Expand Up @@ -378,7 +379,8 @@ const (
// 2.3.1 is min version for anonymous replication
version2_3_1 = uint32(131841) // VersionID(2, 3, 1)
// Add box.info.replication_anon
version2_5_1 = uint32(132353) // VersionID(2, 5, 1)
version2_8_0 = uint32(133120) // VersionID(2, 8, 0)
version2_9_0 = uint32(133376) // VersionID(2, 9, 0)
version2_5_1 = uint32(132353) // VersionID(2, 5, 1)
version2_8_0 = uint32(133120) // VersionID(2, 8, 0)
version2_9_0 = uint32(133376) // VersionID(2, 9, 0)
version2_11_0 = uint32(133888) // VersionID(2, 11, 0)
)
5 changes: 5 additions & 0 deletions fetch_snapshot.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package tarantool

import "github.com/tinylib/msgp/msgp"

// FetchSnapshot is the FETCH_SNAPSHOT command
type FetchSnapshot struct{}

Expand All @@ -12,6 +14,9 @@ func (q *FetchSnapshot) GetCommandID() uint {
// MarshalMsg implements msgp.Marshaler
func (q *FetchSnapshot) MarshalMsg(b []byte) (o []byte, err error) {
o = b
o = msgp.AppendMapHeader(o, 1)
o = msgp.AppendUint(o, KeyVersionID)
o = msgp.AppendUint(o, uint(version2_9_0))
return o, nil
}

Expand Down

0 comments on commit e5ab9f7

Please sign in to comment.