Strange problem of distributed jdbc cache store for index.
seto Jun 9, 2018 8:52 AMprivate ConfigurationBuilder persistenceConfigLucene(ConfigurationBuilder configurationBuilder) {
configurationBuilder.persistence()
.addStore(JdbcStringBasedStoreConfigurationBuilder.class)
.key2StringMapper(LuceneKey2StringMapper.class)
.async().enable()
.preload(preload)
.shared(shared)
.fetchPersistentState(fetchPersistentState)
.ignoreModifications(ignoreModifications)
.purgeOnStartup(purgeOnStartup)
.table()
.createOnStart(createOnStart)
.dropOnExit(dropOnExit)
.tableNamePrefix("ISPN_STRING_TABLE")
.idColumnName("ID_COLUMN").idColumnType("VARCHAR(255)")
.dataColumnName("DATA_COLUMN").dataColumnType("BLOB")
.timestampColumnName("TIMESTAMP_COLUMN").timestampColumnType("BIGINT")
.connectionPool()
.connectionUrl(connectionUrl)
.username(username)
.password(password)
.driverClass(driverClass);
return configurationBuilder;
}
preload = true, shared = true, fetchPersistentState = true, ignoreModifications = false, purgeOnStartup = true
It seems that I will got incorrect remaining data even purgeOnStartup is true. PurgeOnStartup for debug purpose.
public void sendStoryList(DataRef<User> userDataRef, DataRef<ClientChannel> clientChannelDataRef) {
SearchManager searchManager = distributedDataAPI.getSearchManager();
QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(StoryPending.class).get();
Query query = queryBuilder.keyword().onField("user").matching(userDataRef.get().getId()).createQuery();
System.out.println("sendList:" + searchManager.getQuery(query, StoryPending.class).getResultSize());
CacheQuery<StoryPending> cacheQuery = searchManager.getQuery(query, StoryPending.class);
List<StoryPending> storyPendings = cacheQuery.list();
System.out.println("sendList:" + storyPendings.size());
DimensionStory.StoryList.Builder builder = DimensionStory.StoryList.newBuilder();
for (StoryPending storyPending : storyPendings) {System.out.println("sendList:" + storyPending.getStory());
DimensionStory.Story.Builder builder0 = DimensionStory.Story.newBuilder().setId(storyPending.getStory());
builder.addStories(builder0);
}clientChannelDataRef.get().send(builder);
}
The getResultSize will get 1, but the second is 0.
I thought that there should be not remaining incorrect data if purgeOnStartue is true.
No remaining incorrect data if I deleted the tables in the mysql database before the second launch.
Yet, my project is complicated. So I can't provide a reproducing project.
But I'd like you guys to check this. Or do I misunderstand the purgeOnStartup in this case?