@@ -98,7 +98,9 @@ func newPersistentStorage(
98
98
}
99
99
100
100
// TODO: update pebble options
101
- db , err := pebble .Open (dbPath , & pebble.Options {})
101
+ db , err := pebble .Open (dbPath , & pebble.Options {
102
+ DisableWAL : true ,
103
+ })
102
104
if err != nil {
103
105
log .Fatal ("open db failed" , zap .Error (err ))
104
106
}
@@ -162,7 +164,9 @@ func (p *persistentStorage) initializeFromKVStorage(dbPath string, storage kv.St
162
164
163
165
var err error
164
166
// TODO: update pebble options
165
- if p .db , err = pebble .Open (dbPath , & pebble.Options {}); err != nil {
167
+ if p .db , err = pebble .Open (dbPath , & pebble.Options {
168
+ DisableWAL : true ,
169
+ }); err != nil {
166
170
log .Fatal ("open db failed" , zap .Error (err ))
167
171
}
168
172
log .Info ("schema store initialize from kv storage begin" ,
@@ -195,7 +199,7 @@ func (p *persistentStorage) initializeFromDisk() {
195
199
log .Fatal ("load database info from disk failed" )
196
200
}
197
201
198
- if p .tableMap , err = loadTablesInKVSnap (storageSnap , p .gcTs ); err != nil {
202
+ if p .tableMap , err = loadTablesInKVSnap (storageSnap , p .gcTs , p . databaseMap ); err != nil {
199
203
log .Fatal ("load tables in kv snapshot failed" )
200
204
}
201
205
@@ -226,9 +230,9 @@ func (p *persistentStorage) getAllPhysicalTables(snapTs uint64, tableFilter filt
226
230
defer func () {
227
231
log .Info ("getAllPhysicalTables finish" ,
228
232
zap .Uint64 ("snapTs" , snapTs ),
229
- zap .Any ("duration" , time .Since (start ).Seconds ()))
233
+ zap .Any ("duration(s) " , time .Since (start ).Seconds ()))
230
234
}()
231
- return loadAllPhysicalTablesInSnap (storageSnap , gcTs , snapTs , tableFilter )
235
+ return loadAllPhysicalTablesAtTs (storageSnap , gcTs , snapTs , tableFilter )
232
236
}
233
237
234
238
// only return when table info is initialized
@@ -580,6 +584,11 @@ func (p *persistentStorage) handleSortedDDLEvents(ddlEvents ...PersistedDDLEvent
580
584
581
585
for i := range ddlEvents {
582
586
p .mu .Lock ()
587
+ log .Info ("handle resolved ddl event" ,
588
+ zap .Int64 ("schemaID" , ddlEvents [i ].SchemaID ),
589
+ zap .Int64 ("tableID" , ddlEvents [i ].TableID ),
590
+ zap .Uint64 ("finishedTs" , ddlEvents [i ].FinishedTs ),
591
+ zap .String ("query" , ddlEvents [i ].Query ))
583
592
if shouldSkipDDL (& ddlEvents [i ], p .databaseMap , p .tableMap ) {
584
593
p .mu .Unlock ()
585
594
continue
@@ -648,6 +657,10 @@ func completePersistedDDLEvent(
648
657
switch model .ActionType (event .Type ) {
649
658
case model .ActionCreateSchema ,
650
659
model .ActionDropSchema :
660
+ log .Info ("completePersistedDDLEvent for create/drop schema" ,
661
+ zap .Any ("type" , event .Type ),
662
+ zap .Int64 ("schemaID" , event .SchemaID ),
663
+ zap .String ("schemaName" , event .DBInfo .Name .O ))
651
664
event .SchemaName = event .DBInfo .Name .O
652
665
case model .ActionCreateTable :
653
666
event .SchemaName = getSchemaName (event .SchemaID )
@@ -831,6 +844,9 @@ func updateDatabaseInfoAndTableInfo(
831
844
Tables : make (map [int64 ]bool ),
832
845
}
833
846
case model .ActionDropSchema :
847
+ for tableID := range databaseMap [event .SchemaID ].Tables {
848
+ delete (tableMap , tableID )
849
+ }
834
850
delete (databaseMap , event .SchemaID )
835
851
case model .ActionCreateTable :
836
852
createTable (event .SchemaID , event .TableID )
0 commit comments