Skip to content

Commit

Permalink
*: pass make race (pingcap#1617)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenli authored Aug 23, 2016
1 parent e31b281 commit 997e4a5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ func (d *ddl) handleDDLJobQueue() error {

log.Warnf("[ddl] run DDL job %v", job)

d.m.RLock()
d.hook.OnJobRunBefore(job)
d.m.RUnlock()

// if run job meets error, we will save this error in job Error
// and retry later if the job is not cancelled.
Expand Down Expand Up @@ -281,7 +283,9 @@ func (d *ddl) handleDDLJobQueue() error {
return nil
}

d.m.RLock()
d.hook.OnJobUpdated(job)
d.m.RUnlock()

// here means the job enters another state (delete only, write only, public, etc...) or is cancelled.
// if the job is done or still running, we will wait 2 * lease time to guarantee other servers to update
Expand Down
2 changes: 2 additions & 0 deletions ddl/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,9 @@ func (s *testIndexSuite) TestDropIndex(c *C) {
oldIndexCol = index
}

d.m.Lock()
d.hook = tc
d.m.Unlock()

// Use local ddl for callback test.
s.d.close()
Expand Down
6 changes: 4 additions & 2 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package server
import (
"database/sql"
"encoding/json"
"fmt"
"net/http"
"strings"
"testing"
Expand Down Expand Up @@ -329,12 +330,13 @@ func runTestStatusAPI(c *C) {

func runTestMultiPacket(c *C) {
runTests(c, dsn, func(dbt *DBTest) {
dbt.mustExec("set global max_allowed_packet=167772160") // 160M
dbt.mustExec(fmt.Sprintf("set global max_allowed_packet=%d", 1024*1024*160)) // 160M
})

runTests(c, dsn, func(dbt *DBTest) {
dbt.mustExec("create table test (a longtext)")
for i := 0; i < 100; i++ {
// When i == 30, packet size will be 16777215(2^24−1) bytes.
for i := 30; i < 32; i++ {
dbt.mustExec("insert into test values ('" + strings.Repeat("x", 1024*1024*16-i) + "')")
}
})
Expand Down
1 change: 1 addition & 0 deletions server/tidb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.
// +build !race

package server

Expand Down

0 comments on commit 997e4a5

Please sign in to comment.