enhance: improve the lock key of the create/drop collection task (#37759)

/kind improvement

Signed-off-by: SimFG <bang.fu@zilliz.com>
This commit is contained in:
SimFG 2024-11-19 15:50:32 +08:00 committed by GitHub
parent 8216345b07
commit 3bbbf3cd95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 5 deletions

View File

@ -157,7 +157,7 @@ Currently, the objects injected by expr include: <code>param</code>, <code>proxy
if (xhr.status === 200) {
document.getElementById('resultText').textContent = JSON.stringify(JSON.parse(xhr.responseText), null, 2);
} else {
document.getElementById('resultText').textContent = 'Error: ' + xhr.status;
document.getElementById('resultText').textContent = `Error: ${xhr.status}, detail: ${xhr.responseText}`;
}
};
xhr.send();

View File

@ -664,6 +664,7 @@ func (t *createCollectionTask) Execute(ctx context.Context) error {
func (t *createCollectionTask) GetLockerKey() LockerKey {
return NewLockerKeyChain(
NewClusterLockerKey(false),
NewDatabaseLockerKey(t.Req.GetDbName(), true),
NewDatabaseLockerKey(t.Req.GetDbName(), false),
NewCollectionLockerKey(t.Req.GetCollectionName(), true),
)
}

View File

@ -121,5 +121,9 @@ func (t *dropCollectionTask) Execute(ctx context.Context) error {
}
func (t *dropCollectionTask) GetLockerKey() LockerKey {
return NewLockerKeyChain(NewClusterLockerKey(false), NewDatabaseLockerKey(t.Req.GetDbName(), true))
return NewLockerKeyChain(
NewClusterLockerKey(false),
NewDatabaseLockerKey(t.Req.GetDbName(), false),
NewCollectionLockerKey(t.Req.GetCollectionName(), true),
)
}

View File

@ -147,7 +147,7 @@ func TestGetLockerKey(t *testing.T) {
},
}
key := tt.GetLockerKey()
assert.Equal(t, GetLockerKeyString(key), "$-0-false|foo-1-true")
assert.Equal(t, GetLockerKeyString(key), "$-0-false|foo-1-false|bar-2-true")
})
t.Run("create database task locker key", func(t *testing.T) {
tt := &createDatabaseTask{
@ -233,7 +233,7 @@ func TestGetLockerKey(t *testing.T) {
},
}
key := tt.GetLockerKey()
assert.Equal(t, GetLockerKeyString(key), "$-0-false|foo-1-true")
assert.Equal(t, GetLockerKeyString(key), "$-0-false|foo-1-false|bar-2-true")
})
t.Run("drop database task locker key", func(t *testing.T) {
tt := &dropDatabaseTask{