Skip to content

Commit 78fd872

Browse files
WIP: fix tests & docs
Signed-off-by: Maurice van Veen <[email protected]>
1 parent 92fbf1c commit 78fd872

File tree

4 files changed

+7
-31
lines changed

4 files changed

+7
-31
lines changed

server/errors.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,20 +2049,10 @@
20492049
"url": "",
20502050
"deprecates": ""
20512051
},
2052-
{
2053-
"constant": "JSBatchPublishInvalidGapModeErr",
2054-
"code": 400,
2055-
"error_code": 10207,
2056-
"description": "batch publish gap mode is invalid",
2057-
"comment": "",
2058-
"help": "",
2059-
"url": "",
2060-
"deprecates": ""
2061-
},
20622052
{
20632053
"constant": "JSMirrorWithBatchPublishErr",
20642054
"code": 400,
2065-
"error_code": 10208,
2055+
"error_code": 10207,
20662056
"description": "stream mirrors can not also use batch publishing",
20672057
"comment": "",
20682058
"help": "",

server/jetstream_batching.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (b *batchGroup) readyForCommit() bool {
121121

122122
// fastBatchRegisterSequences registers the highest stored batch and stream sequence and returns
123123
// whether a PubAck should be sent if the batch has been committed.
124-
// TODO(mvv): docs about flow acks
124+
// Also returns whether a flow control message should be sent.
125125
// Lock should be held.
126126
func (batches *batching) fastBatchRegisterSequences(batchId string, batchSeq, streamSeq uint64) (*batchGroup, bool, string) {
127127
if b, ok := batches.group[batchId]; ok {

server/jetstream_batching_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3122,11 +3122,11 @@ func TestJetStreamFastBatchPublishGapDetection(t *testing.T) {
31223122
rmsg, err := sub.NextMsg(time.Second)
31233123
require_NoError(t, err)
31243124

3125-
if gapMode == _EMPTY_ || gapMode == "unknown" {
3125+
if gapMode == "unknown" {
31263126
pubAck = JSPubAckResponse{}
31273127
require_NoError(t, json.Unmarshal(rmsg.Data, &pubAck))
31283128
require_NotNil(t, pubAck.Error)
3129-
require_Error(t, pubAck.Error, NewJSBatchPublishInvalidGapModeError())
3129+
require_Error(t, pubAck.Error, NewJSBatchPublishInvalidPatternError())
31303130
return
31313131
}
31323132

@@ -3179,7 +3179,7 @@ func TestJetStreamFastBatchPublishGapDetection(t *testing.T) {
31793179
for _, storage := range []StorageType{FileStorage, MemoryStorage} {
31803180
for _, retention := range []RetentionPolicy{LimitsPolicy, InterestPolicy, WorkQueuePolicy} {
31813181
for _, replicas := range []int{1, 3} {
3182-
for _, gapMode := range []string{_EMPTY_, "fail", "ok", "unknown"} {
3182+
for _, gapMode := range []string{"fail", "ok", "unknown"} {
31833183
t.Run(fmt.Sprintf("%s/%s/R%d/%s", storage, retention, replicas, gapMode), func(t *testing.T) {
31843184
test(t, storage, retention, replicas, gapMode)
31853185
})

server/jetstream_errors_generated.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ const (
4141
// JSBatchPublishInvalidBatchIDErr batch publish ID is invalid
4242
JSBatchPublishInvalidBatchIDErr ErrorIdentifier = 10205
4343

44-
// JSBatchPublishInvalidGapModeErr batch publish gap mode is invalid
45-
JSBatchPublishInvalidGapModeErr ErrorIdentifier = 10207
46-
4744
// JSBatchPublishInvalidPatternErr batch publish pattern is invalid
4845
JSBatchPublishInvalidPatternErr ErrorIdentifier = 10204
4946

@@ -369,7 +366,7 @@ const (
369366
JSMirrorWithAtomicPublishErr ErrorIdentifier = 10198
370367

371368
// JSMirrorWithBatchPublishErr stream mirrors can not also use batch publishing
372-
JSMirrorWithBatchPublishErr ErrorIdentifier = 10208
369+
JSMirrorWithBatchPublishErr ErrorIdentifier = 10207
373370

374371
// JSMirrorWithCountersErr stream mirrors can not also calculate counters
375372
JSMirrorWithCountersErr ErrorIdentifier = 10173
@@ -641,7 +638,6 @@ var (
641638
JSBadRequestErr: {Code: 400, ErrCode: 10003, Description: "bad request"},
642639
JSBatchPublishDisabledErr: {Code: 400, ErrCode: 10203, Description: "batch publish is disabled"},
643640
JSBatchPublishInvalidBatchIDErr: {Code: 400, ErrCode: 10205, Description: "batch publish ID is invalid"},
644-
JSBatchPublishInvalidGapModeErr: {Code: 400, ErrCode: 10207, Description: "batch publish gap mode is invalid"},
645641
JSBatchPublishInvalidPatternErr: {Code: 400, ErrCode: 10204, Description: "batch publish pattern is invalid"},
646642
JSBatchPublishUnknownBatchIDErr: {Code: 400, ErrCode: 10206, Description: "batch publish ID unknown"},
647643
JSClusterIncompleteErr: {Code: 503, ErrCode: 10004, Description: "incomplete results"},
@@ -750,7 +746,7 @@ var (
750746
JSMirrorMultipleFiltersNotAllowed: {Code: 400, ErrCode: 10150, Description: "mirror with multiple subject transforms cannot also have a single subject filter"},
751747
JSMirrorOverlappingSubjectFilters: {Code: 400, ErrCode: 10152, Description: "mirror subject filters can not overlap"},
752748
JSMirrorWithAtomicPublishErr: {Code: 400, ErrCode: 10198, Description: "stream mirrors can not also use atomic publishing"},
753-
JSMirrorWithBatchPublishErr: {Code: 400, ErrCode: 10208, Description: "stream mirrors can not also use batch publishing"},
749+
JSMirrorWithBatchPublishErr: {Code: 400, ErrCode: 10207, Description: "stream mirrors can not also use batch publishing"},
754750
JSMirrorWithCountersErr: {Code: 400, ErrCode: 10173, Description: "stream mirrors can not also calculate counters"},
755751
JSMirrorWithFirstSeqErr: {Code: 400, ErrCode: 10143, Description: "stream mirrors can not have first sequence configured"},
756752
JSMirrorWithMsgSchedulesErr: {Code: 400, ErrCode: 10186, Description: "stream mirrors can not also schedule messages"},
@@ -993,16 +989,6 @@ func NewJSBatchPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
993989
return ApiErrors[JSBatchPublishInvalidBatchIDErr]
994990
}
995991

996-
// NewJSBatchPublishInvalidGapModeError creates a new JSBatchPublishInvalidGapModeErr error: "batch publish gap mode is invalid"
997-
func NewJSBatchPublishInvalidGapModeError(opts ...ErrorOption) *ApiError {
998-
eopts := parseOpts(opts)
999-
if ae, ok := eopts.err.(*ApiError); ok {
1000-
return ae
1001-
}
1002-
1003-
return ApiErrors[JSBatchPublishInvalidGapModeErr]
1004-
}
1005-
1006992
// NewJSBatchPublishInvalidPatternError creates a new JSBatchPublishInvalidPatternErr error: "batch publish pattern is invalid"
1007993
func NewJSBatchPublishInvalidPatternError(opts ...ErrorOption) *ApiError {
1008994
eopts := parseOpts(opts)

0 commit comments

Comments
 (0)