@@ -252,13 +252,13 @@ func (pi *PSQLInteractor) Version(_ context.Context) error {
252
252
// Returns:
253
253
// - error: An error if sending the messages fails, otherwise nil.
254
254
func (pi * PSQLInteractor ) AddShard (shard * datashards.DataShard ) error {
255
- if err := pi .WriteHeader ("add datashard " ); err != nil {
255
+ if err := pi .WriteHeader ("add shard " ); err != nil {
256
256
spqrlog .Zero .Error ().Err (err ).Msg ("" )
257
257
return err
258
258
}
259
259
260
260
for _ , msg := range []pgproto3.BackendMessage {
261
- & pgproto3.DataRow {Values : [][]byte {[]byte (fmt .Sprintf ("created datashard with name %s" , shard .ID ))}},
261
+ & pgproto3.DataRow {Values : [][]byte {[]byte (fmt .Sprintf ("shard id -> %s" , shard .ID ))}},
262
262
} {
263
263
if err := pi .cl .Send (msg ); err != nil {
264
264
spqrlog .Zero .Error ().Err (err ).Msg ("" )
@@ -286,7 +286,7 @@ func (pi *PSQLInteractor) DropShard(id string) error {
286
286
}
287
287
288
288
for _ , msg := range []pgproto3.BackendMessage {
289
- & pgproto3.DataRow {Values : [][]byte {[]byte (fmt .Sprintf ("dropped shard with %s" , id ))}},
289
+ & pgproto3.DataRow {Values : [][]byte {[]byte (fmt .Sprintf ("shard id -> %s" , id ))}},
290
290
} {
291
291
if err := pi .cl .Send (msg ); err != nil {
292
292
spqrlog .Zero .Error ().Err (err ).Msg ("" )
@@ -359,7 +359,7 @@ func (pi *PSQLInteractor) CreateKeyRange(ctx context.Context, keyRange *kr.KeyRa
359
359
}
360
360
361
361
for _ , msg := range []pgproto3.BackendMessage {
362
- & pgproto3.DataRow {Values : [][]byte {[]byte (fmt .Sprintf ("created key range with bound %s" , keyRange .LowerBound ))}},
362
+ & pgproto3.DataRow {Values : [][]byte {[]byte (fmt .Sprintf ("bound -> %s" , keyRange .LowerBound ))}},
363
363
} {
364
364
if err := pi .cl .Send (msg ); err != nil {
365
365
spqrlog .Zero .Error ().Err (err ).Msg ("" )
@@ -388,7 +388,8 @@ func (pi *PSQLInteractor) SplitKeyRange(ctx context.Context, split *kr.SplitKeyR
388
388
}
389
389
390
390
for _ , msg := range []pgproto3.BackendMessage {
391
- & pgproto3.DataRow {Values : [][]byte {[]byte (fmt .Sprintf ("split key range %v by %s" , split .SourceID , string (split .Bound )))}},
391
+ & pgproto3.DataRow {Values : [][]byte {[]byte (fmt .Sprintf ("key range id -> %v" , split .SourceID ))}},
392
+ & pgproto3.DataRow {Values : [][]byte {[]byte (fmt .Sprintf ("bound -> %s" , string (split .Bound )))}},
392
393
} {
393
394
if err := pi .cl .Send (msg ); err != nil {
394
395
spqrlog .Zero .Error ().Err (err ).Msg ("" )
@@ -418,7 +419,7 @@ func (pi *PSQLInteractor) LockKeyRange(ctx context.Context, krid string) error {
418
419
419
420
for _ , msg := range []pgproto3.BackendMessage {
420
421
& pgproto3.DataRow {Values : [][]byte {
421
- []byte (fmt .Sprintf ("lock key range with id %v" , krid ))},
422
+ []byte (fmt .Sprintf ("key range id -> %v" , krid ))},
422
423
},
423
424
} {
424
425
if err := pi .cl .Send (msg ); err != nil {
@@ -450,7 +451,7 @@ func (pi *PSQLInteractor) UnlockKeyRange(ctx context.Context, krid string) error
450
451
for _ , msg := range []pgproto3.BackendMessage {
451
452
& pgproto3.DataRow {Values : [][]byte {
452
453
[]byte (
453
- fmt .Sprintf ("unlocked key range with id %v" , krid )),
454
+ fmt .Sprintf ("key range id -> %v" , krid )),
454
455
},
455
456
},
456
457
} {
@@ -551,7 +552,7 @@ func (pi *PSQLInteractor) Shards(ctx context.Context, shards []*datashards.DataS
551
552
552
553
for _ , shard := range shards {
553
554
if err := pi .cl .Send (& pgproto3.DataRow {
554
- Values : [][]byte {[]byte (fmt .Sprintf ("datashard with ID %s" , shard .ID ))},
555
+ Values : [][]byte {[]byte (fmt .Sprintf ("shard id -> %s" , shard .ID ))},
555
556
}); err != nil {
556
557
spqrlog .Zero .Error ().Err (err ).Msg ("" )
557
558
return err
@@ -927,7 +928,7 @@ func (pi *PSQLInteractor) Routers(resp []*topology.Router) error {
927
928
}
928
929
929
930
for _ , msg := range resp {
930
- if err := pi .WriteDataRow (fmt .Sprintf ("router %s-%s" , msg .ID , msg .Address ), string (msg .State )); err != nil {
931
+ if err := pi .WriteDataRow (fmt .Sprintf ("router -> %s-%s" , msg .ID , msg .Address ), string (msg .State )); err != nil {
931
932
spqrlog .Zero .Error ().Err (err ).Msg ("" )
932
933
return err
933
934
}
@@ -946,12 +947,12 @@ func (pi *PSQLInteractor) Routers(resp []*topology.Router) error {
946
947
// Returns:
947
948
// - error: An error if any occurred during the operation.
948
949
func (pi * PSQLInteractor ) UnregisterRouter (id string ) error {
949
- if err := pi .WriteHeader ("unregister routers " ); err != nil {
950
+ if err := pi .WriteHeader ("unregister router " ); err != nil {
950
951
spqrlog .Zero .Error ().Err (err ).Msg ("" )
951
952
return err
952
953
}
953
954
954
- if err := pi .WriteDataRow (fmt .Sprintf ("router %s unregistered " , id )); err != nil {
955
+ if err := pi .WriteDataRow (fmt .Sprintf ("router id -> %s " , id )); err != nil {
955
956
spqrlog .Zero .Error ().Err (err ).Msg ("" )
956
957
return err
957
958
}
@@ -971,12 +972,12 @@ func (pi *PSQLInteractor) UnregisterRouter(id string) error {
971
972
// Returns:
972
973
// - error: An error if any occurred during the operation.
973
974
func (pi * PSQLInteractor ) RegisterRouter (ctx context.Context , id string , addr string ) error {
974
- if err := pi .WriteHeader ("register routers " ); err != nil {
975
+ if err := pi .WriteHeader ("register router " ); err != nil {
975
976
spqrlog .Zero .Error ().Err (err ).Msg ("" )
976
977
return err
977
978
}
978
979
979
- if err := pi .WriteDataRow (fmt .Sprintf ("router %s-%s registered " , id , addr )); err != nil {
980
+ if err := pi .WriteDataRow (fmt .Sprintf ("router -> %s-%s" , id , addr )); err != nil {
980
981
spqrlog .Zero .Error ().Err (err ).Msg ("" )
981
982
return err
982
983
}
@@ -1046,7 +1047,7 @@ func (pi *PSQLInteractor) DropKeyRange(ctx context.Context, ids []string) error
1046
1047
}
1047
1048
1048
1049
for _ , id := range ids {
1049
- if err := pi .WriteDataRow (fmt .Sprintf ("drop key range %s" , id )); err != nil {
1050
+ if err := pi .WriteDataRow (fmt .Sprintf ("key range id -> %s" , id )); err != nil {
1050
1051
spqrlog .Zero .Error ().Err (err ).Msg ("" )
1051
1052
return err
1052
1053
}
@@ -1071,7 +1072,7 @@ func (pi *PSQLInteractor) AddDistribution(ctx context.Context, ks *distributions
1071
1072
return err
1072
1073
}
1073
1074
1074
- if err := pi .WriteDataRow (fmt .Sprintf ("created distribution with id %s" , ks .ID ())); err != nil {
1075
+ if err := pi .WriteDataRow (fmt .Sprintf ("distribution id -> %s" , ks .ID ())); err != nil {
1075
1076
spqrlog .Zero .Error ().Err (err ).Msg ("" )
1076
1077
return err
1077
1078
}
@@ -1095,7 +1096,7 @@ func (pi *PSQLInteractor) DropDistribution(ctx context.Context, ids []string) er
1095
1096
}
1096
1097
1097
1098
for _ , id := range ids {
1098
- if err := pi .WriteDataRow (fmt .Sprintf ("drop distribution %s" , id )); err != nil {
1099
+ if err := pi .WriteDataRow (fmt .Sprintf ("distribution id -> %s" , id )); err != nil {
1099
1100
spqrlog .Zero .Error ().Err (err ).Msg ("" )
1100
1101
return err
1101
1102
}
@@ -1122,7 +1123,12 @@ func (pi *PSQLInteractor) AlterDistributionAttach(ctx context.Context, id string
1122
1123
}
1123
1124
1124
1125
for _ , r := range ds {
1125
- if err := pi .WriteDataRow (fmt .Sprintf ("attached relation %s to distribution %s" , r .Name , id )); err != nil {
1126
+ if err := pi .WriteDataRow (fmt .Sprintf ("relation name -> %s" , r .Name )); err != nil {
1127
+ spqrlog .Zero .Error ().Err (err ).Msg ("" )
1128
+ return err
1129
+ }
1130
+
1131
+ if err := pi .WriteDataRow (fmt .Sprintf ("distribution id -> %s" , id )); err != nil {
1126
1132
spqrlog .Zero .Error ().Err (err ).Msg ("" )
1127
1133
return err
1128
1134
}
@@ -1148,7 +1154,12 @@ func (pi *PSQLInteractor) AlterDistributionDetach(_ context.Context, id string,
1148
1154
return err
1149
1155
}
1150
1156
1151
- if err := pi .WriteDataRow (fmt .Sprintf ("detached relation %s from distribution %s" , relName , id )); err != nil {
1157
+ if err := pi .WriteDataRow (fmt .Sprintf ("relation name -> %s" , relName )); err != nil {
1158
+ spqrlog .Zero .Error ().Err (err ).Msg ("" )
1159
+ return err
1160
+ }
1161
+
1162
+ if err := pi .WriteDataRow (fmt .Sprintf ("distribution id -> %s" , id )); err != nil {
1152
1163
spqrlog .Zero .Error ().Err (err ).Msg ("" )
1153
1164
return err
1154
1165
}
@@ -1193,7 +1204,7 @@ func (pi *PSQLInteractor) KillClient(clientID uint) error {
1193
1204
return err
1194
1205
}
1195
1206
1196
- if err := pi .WriteDataRow (fmt .Sprintf ("the client %d was killed " , clientID )); err != nil {
1207
+ if err := pi .WriteDataRow (fmt .Sprintf ("client id -> %d " , clientID )); err != nil {
1197
1208
spqrlog .Zero .Error ().Err (err ).Msg ("" )
1198
1209
return err
1199
1210
}
0 commit comments